Skip to content
Snippets Groups Projects

Replace PyCuda with CuPy

Merged Markus Holzer requested to merge holzer/pystencils:cupy into master
Viewing commit 6d9e6476
Show latest version
1 file
+ 5
6
Preferences
Compare changes
+ 5
6
@@ -43,10 +43,9 @@ del get_versions
@@ -43,10 +43,9 @@ del get_versions
# setting the default GPU to the one with maximal memory. GPU_DEVICE is safe to overwrite for different needs
# setting the default GPU to the one with maximal memory. GPU_DEVICE is safe to overwrite for different needs
try:
try:
import cupy
import cupy
if cupy.cuda.runtime.getDeviceCount() > 0:
if cupy.cuda.runtime.getDeviceCount() > 0:
GPU_DEVICE = sorted(range(cupy.cuda.runtime.getDeviceCount()),
GPU_DEVICE = sorted(range(cupy.cuda.runtime.getDeviceCount()),
key=lambda i: cupy.cuda.Device(i).mem_info[1], reverse=True)[0]
key=lambda i: cupy.cuda.Device(i).mem_info[1], reverse=True)[0]
except ImportError:
except ImportError:
pass
pass