Open bradybhalla opened 1 year ago
Thank you for reporting!
One workaround is to use math.exp
instead of numpy.exp
:
import math
from PySDM.backends import GPU
a = GPU().Storage.empty((1,), dtype=float)
a *= math.exp(1)
This behaviour is kind of expected as the GPU
backend doesn't really depend on, rely or even cater to NumPy code much.
Of course, the error message is not clear.
The good news is that this has been already addressed in the Storage-refactor PR #994, where a new is_storage(multiplier)
check is used instead of the hasattr(multiplier, "data")
one which causes the problem (the problem originates from hasattr(np.exp(1), "data")
evaluating to True
).
The not so good news is that we are lacking resources to work on #994 - to make it mergable, review it and merge it :(
Stale issue message
Stale issue message
When scaling a
Storage
by a numpy float type (e.g.np.float64
) using the ThrustRTC backend, an exception is thrownTo reproduce:
In the example above, the error disappears using
backend=CPU()
or by converting to a float withstorage *= float(np.exp(1))
.If this behavior is expected, there could be an error message explaining how to fix the exception.
@edejong-caltech