question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding `writeable` to `flags`

See original GitHub issue

NumPy arrays have the writeable option in flags. This can be useful for checking to see if one can write to an array or not. Also it can be useful to ensure an array is not written to (by setting this flag to False). Would be useful to have this flag on CuPy arrays as well.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
leofangcommented, Nov 25, 2019

I think what @kmaehashi meant is that it is hard to respect that flag in almost all basic CuPy operations except in ElementwiseKernel/ReductionKernel, where the input/output array attributes are put into inspection before processing.

I think this puts an extra layer of burden in general across all Python GPU libraries. Note that Numba does not respect that flag either. @jakirkham, could you point us to examples where (and how) this is implemented?

1reaction
jakirkhamcommented, Nov 8, 2019

Right the interest here would be to mark arrays as read-only. 🙂

Yeah NumPy honors this at the C level as well. It does bit masking against the flags (an int) to check. Only operations that are manipulating the data itself.

I’m not sure. Would think __setitem__ and the inplace math operations would be the main issues. Are there other cases outside of these that would manipulate data in CuPy? You know the code here better than I. 😉

That seems like a useful feature to include. Though agree it is a different concern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

post it flags writable - Amazon.com
Amazon.com: post it flags writable. ... RESULTS. Amazon's Choice. Post-it Memo Flags, 60 Count, 1 in Wide, Assorted Bright Colors. Pinch to zoom-in...
Read more >
numpy.ndarray.flags — NumPy v1.24 Manual
The flags object can be accessed dictionary-like (as in a.flags['WRITEABLE'] ), or by using lowercased attribute names (as in a.flags.writeable ).
Read more >
Property flags and descriptors - The Modern JavaScript Tutorial
Returns true if adding/removing/changing properties is forbidden, and all current properties are configurable: false, writable: false . These ...
Read more >
Why configurable:false allows to change writable flag but does ...
Why did the writable flag change without throwing any error. Because the specification allows changing the writable flag on a data property ...
Read more >
Stalogy 012 Writeable Page Flags - Tokyo Pen Shop
Long adhesive area prevents flags from falling off surfaces. Pigmented, yet transparent, allowing for ... Stalogy 012 Writeable Page Flags ... Add to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found