Using NVIDIA CUDA on Spear


Eight of the Spear nodes contain two TESLA M2050 GPUs available for GPU parallel programming using CUDA. The current version of CUDA is 5.0.35 and includes the CUDA Toolkit and Computing SDK. Please note that currently there is no mechanism in place to allocate GPU resources to only one user at a time, so attention should be paid to the run time of your programs. If the run time is slower than it should be, it may be best to move to another Spear node to find GPU resources that are not being used by another user (SSH to spear-# where # is a number between 2 and 8).

Using CUDA

After logging onto a Spear node, load the CUDA library with the command:

module load cuda

This will allow the user to use all of the available resources for compiling and profiling CUDA programs, as well as have access to the non-compiled example programs found in the CUDA Computing SDK.

The nvcc compiler and associated profiling tools are located in the directory:


and the example programs are located in:


Sample Code

To compile a sample code, copy the desired sample folder directory, for example


to a folder in your home directory and use the provided Makefile. Additionally, by using the NVIDIA Nsight Eclipse IDE (which requires the piping of X) also found in the compiler directory, a user can create a project starting with the example code (which will be apparent when going through the process of creating a new project in the Eclipse IDE), and compile it there. The example here will simply output information about the GPUs available on the Spear node. If no devices (GPUs) are listed, then the current Spear node does not have GPUs installed on it (in this case, SSH to another Spear node and try again).

If the user is new to GPU programming, NVIDIA provides a few tools for getting started with CUDA on their website including an Udacity course on GPU programming. For the more advanced user, details on CUDA best practices can be found in the Best Practices guide.