How to make this function work with or without a GPU available. What is the best way? Checking if this https://github.com/anderskm/gputil will return anything (None type if no GPUs available) i.e.
GPUtil.showUtilization()
OR:
try:
import cupy
make cupy array
else:
Make dask array
By virtue of the __array_function protocol you shouldn't have to conditionally import anything; cupy will call the numpy function equivalents (and vice versa) depending on whether or not a GPU is present.
How to make this function work with or without a GPU available. What is the best way? Checking if this https://github.com/anderskm/gputil will return anything (None type if no GPUs available) i.e.
OR: