Skip to content

Instantly share code, notes, and snippets.

@parejkoj
Created December 21, 2015 19:12
Show Gist options
  • Save parejkoj/90a9b7f279f814370862 to your computer and use it in GitHub Desktop.
Save parejkoj/90a9b7f279f814370862 to your computer and use it in GitHub Desktop.
Getting numbapro GPU acceleration working.

numbapro

Install via anaconda:

https://store.continuum.io/cshop/academicanaconda

and click the "Free" button next to "Anaconda Academic License" in the upper-right. Put in your contact information, and be sure to use your .edu email address. You will receive an email (possibly immediately) with your academic license and instructions, the gist of which are:

Copy the license file attached to the email into ~/.continuum/ conda update conda conda install accelerate conda install iopro

To see if it worked, running the following in a python instance should produce no errors:

import numpy as np
from numbapro import vectorize
@vectorize(['float64(float64, float64)'], target='parallel')
def sum(a, b):
   return a + b

N = 10000
xx = np.random.random(N)
yy = np.random.random(N)
sum(xx,yy)

CUDA for GPU acceleration

To use the 'gpu' vectorize target, you have to install the CUDA drivers and libraries from NVIDA (and have a compatible NVIDIA GPU). Continuum.io has instructions on their website:

http://docs.continuum.io/numbapro/install.html#cuda-gpus-setup

Which essentially involve installing the CUDA toolkit and drivers from here:

https://developer.nvidia.com/cuda-toolkit

Afterwhich, this should give you some useful output (if everything worked and you have a valid GPU):

import numbapro
numbapro.check_cuda()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment