Closed ShantanuKodgirwar closed 4 months ago
Does cupy have something like is_functional
? Just detecting GPU is not enough I believe.
I haven't really used cupy
, but there seems to be something similar. Also this would depend on whether cupy
is already installed, which is not true when you are on CPU, this is the reason we made it optional to install.
Currently it raises cupy not available
warning many times when you simply import ptylab
on CPU. It's a bit cumbersome and unnecessary in my opinion and the package should automatically detect the device and ignore the cupy
dependency if it's on CPU.
However, TensorFlow is a compulsory dependency at the moment, we could do something like:
import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')
if len(physical_devices) > 0:
params.gpuSwitch = True
However, we need to ensure this is accessible to all the instances of params.gpuSwitch
. This feature would mostly be a minor release then.
EDIT: The above is probably not a good idea. TensorFlow requires installing other CUDA dependencies and might make sense after all to use cupy
when it becomes available with a GPU.
I think a feature to detect automatically an nvidia gpu and set the
Params.gpuSwitch=True
instead of manually setting this could be useful.