-
Notifications
You must be signed in to change notification settings - Fork 107
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
Executing Pyfftw in a nogil block #374
Comments
Sorry for the horrendous formatting of the previous message, this is straight from the "Reference in a new issue" feature from Github. Anyway. Coming back to the idea of computing ffts with the gil released, turns out you still need the gil to call cpdef execute(self):
'''execute()
Execute the planned operation, taking the correct kind of FFT of
the input array (i.e. :attr:`FFTW.input_array`),
and putting the result in the output array (i.e.
:attr:`FFTW.output_array`).
'''
cdef void *input_pointer = (
<void *>np.PyArray_DATA(self._input_array))
cdef void *output_pointer = (
<void *>np.PyArray_DATA(self._output_array))
cdef void *plan = self._plan
cdef fftw_generic_execute fftw_execute = self._fftw_execute
with nogil:
fftw_execute(plan, input_pointer, output_pointer) In order to call it from a nogil block, this should really be marked nogil (and probably be cdef, I'm not sure) HOWEVER, if My question is: how do you feel about those two properties being readonly ? |
I think execute can happily be nogil for calling from Cython (though we should check that Do you have a reference to making it readonly? Does this just make it more broadly accessible from Cython? |
Hi Henry.I'm in vacations this week, but I'll try and submit a PR next week to show what I mean.
|
I think you can call
execute
withnogil
. The innards of that are read-only properties so unless you're doing something nefarious to the class it should be ok. Is it more than just the execute part?Have you noted that
execute
already runs as no-gil?Originally posted by @hgomersall in #373 (comment)
The text was updated successfully, but these errors were encountered: