Windows

The setup for Windows is very similar, but you also need to provide the C compilers that are required for both Go and CUDA. This setup is outlined in the following steps:

  1. Install a GCC environment; the easiest way to do this on Windows is to install MSYS2. You can download MSYS2 from https://www.msys2.org/.
  2. After installing MSYS2, update your installation with the following commands:
pacman -Syu
  1. Restart MSYS2 and run the following again:
pacman -Su
  1. Install the GCC package as follows:
pacman -S mingw-w64-x86_64-toolchain
  1. Install Visual Studio 2017 to get a compiler compatible with CUDA. At the time of writing, you can download this from https://visualstudio.microsoft.com/downloads/. The Community Edition works fine; if you have a license for any of the other editions, they will do as well.
  2. Install CUDA. Download this from the NVIDIA website at: https://developer.nvidia.com/cuda-downloads. In my experience, the network installer is less reliable than the local installer, so do try the local installer if you cannot get the network installer to work.
  3. Following that, you should also install cuDNN from NVIDIA: https://developer.nvidia.com/cudnn. The installation process is literally a copy and paste operation and is fairly straightforward.
  4. Set up the environment variables so that Go and the NVIDIA CUDA compiler driver (nvcc) know where to find the relevant compilers. You should replace paths, where appropriate, with the location where CUDA, MSYS2, and Visual Studio are installed. The items you need to add and the relevant variable names are as follows:
C_INCLUDE_PATH
C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2include

LIBRARY_PATH
C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2libx64

PATH
C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2in
C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2libnvvp
C:msys64mingw64in
C:Program Files (x86)Microsoft Visual Studio 14.0VCinx86_amd64
  1. Your environment should now be set up correctly to compile CUDA-enabled Go binaries.

Now, for Gorgonia, you need to do a few things first, as outlined in the following steps:

  1. Firstly, ensure the following target directory for the modules you will be building exists:
$GOPATH/src/gorgonia.org/gorgonia/cuda modules/target
  1. Next, run cudagen to build the modules as follows:
cd $GOPATH/src/gorgonia.org/gorgonia/cmd/cudagen
go run main.go
  1. Now that you have everything in place, you should install cudatest, like so:
go install gorgonia.org/cu/cmd/cudatest cudatest
  1. If you run cudatest now and all is well, you will get something similar to the following output:
CUDA version: 9020
CUDA devices: 1
Device 0
========
Name : "GeForce GTX 1080"
Clock Rate: 1835000 kHz
Memory : 8589934592 bytes
Compute : 6.1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.144.228