hpi-epic / gpucsl

Constraint-based Causal Structure Learning on GPUs.
MIT License
38 stars 1 forks source link

Make use of numpy/cupy consistent #9

Open benrobby opened 2 years ago

benrobby commented 2 years ago

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.