Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (19 sloc) 1.31 KB
title date draft weight alwaysopen
2018-09-24 21:32:15 +0200

Gorgonia comes with CUDA support out of the box. However, usage is specialized. To use CUDA, you must build your application with the build tag cuda, like so:

go build -tags='cuda' .

Furthermore, there are some additional requirements:

  1. CUDA toolkit 9.0 is required. Installing this installs the nvcc compiler which is required to run your code with CUDA.
  2. Be sure to follow the post-installation steps
  3. go install This installs the cudagen program. Running cudagen will generate the relevant CUDA related code for Gorgonia. Note that you will need a folder at src\\gorgonia\cuda modules\target
  4. The CUDA ops must be manually enabled in your code with the UseCudaFor option.
  5. runtime.LockOSThread() must be called in the main function where the VM is running. CUDA requires thread affinity, and therefore the OS thread must be locked.

Because nvcc only plays well with gcc version 6 and below (the current version is 7), this is also quite helpful:

sudo ln -s /path/to/gcc-6 /usr/local/cuda-9.0/bin/gcc