Skip to content

Instantly share code, notes, and snippets.

@4OH4
Created November 16, 2021 21:14
Show Gist options
  • Save 4OH4/96b7ca209129e5d6017f53707ba5a22d to your computer and use it in GitHub Desktop.
Save 4OH4/96b7ca209129e5d6017f53707ba5a22d to your computer and use it in GitHub Desktop.
Checking if PyCUDA is available
# Check if PyCuda is installed
package_name = 'pycuda'
use_cuda = importlib.util.find_spec(package_name) is not None
if use_cuda:
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment