Skip to content

Instantly share code, notes, and snippets.

@dapperfu
Last active November 17, 2017 11:07
Show Gist options
  • Save dapperfu/1ec09ccd606922bab78261ec225f7778 to your computer and use it in GitHub Desktop.
Save dapperfu/1ec09ccd606922bab78261ec225f7778 to your computer and use it in GitHub Desktop.
Using GPU Numba with Vanilla Python on Linux.

NUMBAPRO_CUDALIB is undocumented and buried in numba/cuda/cudadrv/libs.pyto find.

My numba cuda checking scripts:

check.sh

#!/bin/sh
export NUMBAPRO_NVVM="/usr/local/cuda/nvvm/lib64/libnvvm.so"
export NUMBAPRO_CUDALIB="/usr/local/cuda/targets/x86_64-linux/lib/"
export NUMBAPRO_LIBDEVICE="/usr/local/cuda/nvvm/libdevice/"

python2 check.py
python3 check.py

check.py

import numba.cuda
numba.cuda.api.detect()
numba.cuda.cudadrv.libs.test()

If it all works it should look something like this:

Found 1 CUDA devices
id 0      b'GeForce GTX 960'                              [SUPPORTED]
                      compute capability: 5.2
                           pci device id: 0
                              pci bus id: 1
Summary:
    1/1 devices are supported
Finding cublas
    located at /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so.8.0.45
    trying to open library...	ok
Finding cusparse
    located at /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so.8.0.44
    trying to open library...	ok
Finding cufft
    located at /usr/local/cuda/targets/x86_64-linux/lib/libcufft.so.8.0.44
    trying to open library...	ok
Finding curand
    located at /usr/local/cuda/targets/x86_64-linux/lib/libcurand.so.8.0.44
    trying to open library...	ok
Finding nvvm
    located at /usr/local/cuda/nvvm/lib64/libnvvm.so
    trying to open library...	ok
    finding libdevice for compute_20...	ok
    finding libdevice for compute_30...	ok
    finding libdevice for compute_35...	ok
    finding libdevice for compute_50...	ok
@askerlee
Copy link

Thank you so much! I met this problem and your trick saved my day 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment