[Numpy-discussion] Re: Tricky ufunc implementation question

2025-07-03 Thread Bill Ross
Do the JVM-based pythons solve any threading issues? Plain parallel java seems indispensable. Bill -- Phobrain.com On 2025-07-03 05:05, Nathan via NumPy-Discussion wrote: > If a NumPy array is shared between two threads, NumPy doesn't do anything to > synchronize array access. This is true

[Numpy-discussion] Re: Tricky ufunc implementation question

2025-07-03 Thread Nathan via NumPy-Discussion
If a NumPy array is shared between two threads, NumPy doesn’t do anything to synchronize array access. This is true in all Python versions and build configurations - since NumPy releases the GIL during most array operations whether or not you’re using free-threaded Python doesn’t change much except

[Numpy-discussion] Re: Tricky ufunc implementation question

2025-07-03 Thread Benjamin Root via NumPy-Discussion
On a related note, does numpy's gufunc mechanism provide any thread safety, or is the responsibility on the extension writer to do that? For simple numpy array inputs, I would think that I don't have to worry about free-threaded python messing things up (unless I have a global state), I'm wondering

[Numpy-discussion] Re: Tricky ufunc implementation question

2025-07-01 Thread Benjamin Root via NumPy-Discussion
Warren, The examples in ufunclab helped clear up a few things and I was able to experiment and get a working gufunc! Thank you for your help! Ben Root On Fri, Jun 27, 2025 at 8:54 PM Benjamin Root wrote: > Warren, > > I'm fine with implementing it in C. I just didn't think gufuncs were for > m

[Numpy-discussion] Re: Tricky ufunc implementation question

2025-06-27 Thread Benjamin Root via NumPy-Discussion
Warren, I'm fine with implementing it in C. I just didn't think gufuncs were for me. I couldn't tell from the description if it would be for my usecase since I wasn't looping over subarrays, and I didn't see any good examples. Maybe the documentation could be clearer. I'll have a look at your exam

[Numpy-discussion] Re: Tricky ufunc implementation question

2025-06-27 Thread Warren Weckesser via NumPy-Discussion
On Fri, Jun 27, 2025 at 5:29 PM Benjamin Root via NumPy-Discussion wrote: > > I'm looking at a situation where I like to wrap a C++ function that takes two > doubles as inputs, and returns an error code, a position vector, and a > velocity vector so that I essentially would have a function signa