You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
import cupy as cp
import dask.array as da
x = cp.random.randn(128, 128)
x = da.from_array(x)
da.fft.fft2(x)
Similar to my last issue. It may be that I've mistakenly assumed dask has support for cupy, in which case my apologies. I've seen examples with dask and cupy, but do not know how extensive that is.
For some reason my browser opened up this issue to me 🧐 @izaid@pentschev Could you please check if the execution runs correctly, i.e. the result of da.fft.fft2(x) is correct? Note that the error happens at __del__, which in my experience is related to object lifetime not being properly handled in a given context (CUDA's or other libraries').
I tested this with CuPy 8.0.0b5 and it works, but still fails with 7.7.0. Given there has been a lot of changes for CuPy 8 on the cuFFT front, I think it's unlikely that those changes will be backported to CuPy 7.
@izaid FYI, CuPy 8 is scheduled for release in late September, so by then this should be no problem anymore, if you can't wait you may considering building it from source to get past this issue.
I'm confused about how this should work? Running the initial code does indeed produce an FFT but from what I can tell (by watching nvidia-smi) dask does not use my GPUs when I run in this way. Is that correct? Is there a way to get dask to perform these FFTs on gpu workers?
@makslevental -- I would recommend opening up a new issue with a minimal reproducer if you have a problem here. Generally, the way this works is through is with NEP-18 , a protocol to dispatch to other libraries from NumPy
In [1]: importcupyIn [2]: importnumpyasnpIn [3]: arr=cupy.random.randn(128, 128)
In [4]: res=np.fft.fft(arr)
In [5]: type(res)
Out[5]: cupy.core.core.ndarray
Activity
mrocklin commentedon Apr 21, 2020
@izaid thanks for raising. cc @pentschev and @quasiben from NVIDIA in case they have time to test this out.
pentschev commentedon Apr 21, 2020
For completeness, this is the error:
I'm not totally sure what's missing here, perhaps we need to do some handling of plans for CuPy, that would need to be investigated. For sure at least
dask/dask/array/fft.py
Line 173 in 71113ea
dask/dask/array/utils.py
Line 313 in 71113ea
Unfortunately, I won't have time for any further investigation until at least mid/late May.
pentschev commentedon Apr 21, 2020
Also linked this to our
__array_function__issue tracker in #4731 .mrocklin commentedon Apr 21, 2020
Sure, I'm certain that all of the UCX issues will be ironed out before then ;)
pentschev commentedon Apr 21, 2020
I hope so, but no idea at this point as I thought so many times in the past several months.
mrocklin commentedon Apr 21, 2020
leofang commentedon Jul 27, 2020
For some reason my browser opened up this issue to me 🧐 @izaid @pentschev Could you please check if the execution runs correctly, i.e. the result of
da.fft.fft2(x)is correct? Note that the error happens at__del__, which in my experience is related to object lifetime not being properly handled in a given context (CUDA's or other libraries').quasiben commentedon Jul 28, 2020
Things do work but an odd exception is raised?
I am guessing the exception happens during meta construction...
This is with cupy version 7.6.0
pentschev commentedon Aug 5, 2020
I tested this with CuPy 8.0.0b5 and it works, but still fails with 7.7.0. Given there has been a lot of changes for CuPy 8 on the cuFFT front, I think it's unlikely that those changes will be backported to CuPy 7.
@izaid FYI, CuPy 8 is scheduled for release in late September, so by then this should be no problem anymore, if you can't wait you may considering building it from source to get past this issue.
izaid commentedon Aug 27, 2020
@pentschev Cheers, thanks for that! Looking forward to giving this a shot with CuPy 8.
leofang commentedon Nov 2, 2020
I verified this works with CuPy v8 and Dask v2.30.
mrocklin commentedon Nov 3, 2020
I'm glad to hear it. Thanks for reporting @leofang .
Closing.
makslevental commentedon Dec 15, 2020
I'm confused about how this should work? Running the initial code does indeed produce an FFT but from what I can tell (by watching
nvidia-smi) dask does not use my GPUs when I run in this way. Is that correct? Is there a way to get dask to perform these FFTs on gpu workers?quasiben commentedon Dec 15, 2020
@makslevental -- I would recommend opening up a new issue with a minimal reproducer if you have a problem here. Generally, the way this works is through is with NEP-18 , a protocol to dispatch to other libraries from NumPy
makslevental commentedon Dec 15, 2020
@quasiben thanks for the tip. will do if I can't track it down.