Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notes on overwriting gufunc inputs to docs #4957

Merged
merged 4 commits into from Jan 22, 2020
Merged

Conversation

gmarkall
Copy link
Member

As discussed in #4952, one cannot rely on writing to gufunc input values. This PR adds some notes on this to the documentation. I decided against explicitly stating that you shouldn't do it, because I understand it is a "feature" that people make use of from time to time.

It is possible to write gufuncs that overwrite input arrays, but
the new values may not be visible outside the gufunc execution,
for example if a temporary array is passed in. This commit adds
notes to the documentation warning the user of this case.
@gmarkall gmarkall changed the title Add notes on overwriting gufunc inputs to docs [WIP] Add notes on overwriting gufunc inputs to docs Dec 12, 2019
@gmarkall
Copy link
Member Author

Added WIP tag while I see what the build failures are.

@gmarkall gmarkall changed the title [WIP] Add notes on overwriting gufunc inputs to docs Add notes on overwriting gufunc inputs to docs Dec 12, 2019
@gmarkall
Copy link
Member Author

Removed WIP - I see master is broken with the same problem.

@stuartarchibald
Copy link
Contributor

/AzurePipelines run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This is a helpful clarification. Couple of minor edits suggested else good to merge. Thanks again!

docs/source/reference/jit-compilation.rst Outdated Show resolved Hide resolved
[4.2, 4.2, 4.2],
[4.2, 4.2, 4.2]])

This works because Numpy passes a pointer to the input data directly into the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This works because Numpy passes a pointer to the input data directly into the
This works because NumPy can pass the input data directly into the `init_values` function as the data `dtype` matches that of the declared argument.

Or something like ^. I think this needs to not refer to pointers and note that it's the dtype match that prevents the copy.

docs/source/user/vectorize.rst Outdated Show resolved Hide resolved
@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Jan 15, 2020
gmarkall and others added 2 commits January 20, 2020 12:51
@gmarkall
Copy link
Member Author

Thanks for the review - all suggestions now applied. I did modify the suggestion about referring to input data rather than pointers, as it left a trailing half-sentence, but otherwise it is applied as you suggested.

@stuartarchibald
Copy link
Contributor

Thanks for the fixes so far, one more Numpy - > NumPy and this can be merge! Thanks.

Co-Authored-By: stuartarchibald <stuartarchibald@users.noreply.github.com>
@stuartarchibald stuartarchibald added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on author Waiting for author to respond to review labels Jan 21, 2020
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

@sklam sklam merged commit f89680c into numba:master Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants