The wonderful CuPy library allows you to easily run NumPy-compatible code on a NVIDIA GPU. However, sometimes

  • you (or your users) don’t have a compatible GPU, or
  • you don’t have a CuPy-compatible Python environment, or
  • your code runs slower on our GPU than on your multiple CPUs.

By defining three simple utility functions, you can make your code _GPU-optional. (_Find the utility functions’ definitions in this small GitHub project.)

#data-science #python #gpu

GPU-Optional Python
2.15 GEEK