hpi-epic/gpucsl

Make use of numpy/cupy consistent

benrobby opened this issue · 0 comments

Currently, we use numpy/np and cp/cupy very inconsistently.

In fact, for example for the types, a lot of cupy types are just aliases to numpy.
https://docs.cupy.dev/en/stable/reference/comparison.html#numpy-cupy-apis
(search for numpy.float_)
cp.float_ is apparently only an alias to numpy.float_

My gut feeling would be: Always use numpy, except in cases where really something on the gpu is happening, like cp.max or so (so "real" cupy functions), but opening this to discuss this behaviour.

Toms inituition would be: numpy types for numpy functions and cupy types for cupy functions. Whoever reads the code is probably not that familiar with cupy to know this are only aliases and wonders that cupy takes numpy types.

But even so I do not have that strong of an opinion regards this topic, as long as we do it consequently.