Tutorial - Using CUDA in the laboratory workstations

All the laboratory workstations have the latest CUDA SDK (v10.1) and one of the latest NVIDIA drivers installed. The graphics card available on each computer is a GeForce GTX 745, which would be enough to work on the assignments and the final project.

The installation of the SDK is located in the following folder:

/usr/local/cuda-10.1

The folder is symbolic linked to:

/usr/local/cuda

To use the nvcc compiler, you will need to add the "bin" folder inside this path to your PATH environment variable. From that point, you can directly use it as any other command:

export PATH=/usr/local/cuda/bin:$PATH
nvcc -arch=sm_50 your_cuda_program.cu -o your_cuda_program.out

The -arch flag is necessary to specify the CUDA architecture that we would like to use. Without it, we might compile our code to an architecture not supported by the GPU of the workstation. GTX 745 uses the GM107 processor that belongs to the first generation of Maxwell architecture. It supports compute capability 5.0 and for this reason, we specify -arch=sm_50.