CUDA: Difference between revisions

From UMIACS
Jump to navigation Jump to search
Line 30: Line 30:
'''Note''': Compiling requires the <tt>LIBRARY_PATH</tt> environmental variable above to tell GCC where to find the nvidia shared libraries.  If using an alternate compiler please consult it as to how to modify the compile time linker path.
'''Note''': Compiling requires the <tt>LIBRARY_PATH</tt> environmental variable above to tell GCC where to find the nvidia shared libraries.  If using an alternate compiler please consult it as to how to modify the compile time linker path.


===Cuda 6.0 Beta===
===Cuda 6.0===


You need to have driver 331.62 or later installed to use this (see above for finding out what driver version you are running) and you will need to ask staff to upgrade if not.  This is only available currently on RHEL6 x86_64.
You need to have driver 331.62 or later installed to use this (see above for finding out what driver version you are running) and you will need to ask staff to upgrade if not.  This is only available currently on RHEL6 x86_64.

Revision as of 02:06, 24 April 2014

CUDA is a programming architecture developed by NVIDIA to allow General Purpose Computing on GPUs or "GPGPU". It requires a specific card and driver to work correctly, UMIACS has a number of facilities and labs that have Cuda hardware available.

CUDA Software on Linux

RHEL

The first component you will need if you are not using a resource that you know is running CUDA is to check to see if you have the Nvidia driver running. You can run cat /proc/driver/nvidia/version

If something like the following example does not show you will need to contact staff to see if your hardware is capable and if so we will need to add the driver to the machine. You must have version 319.30 or greater for Cuda 5.5.22.

# cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  331.20  Wed Oct 30 17:43:35 PDT 2013
GCC version:  gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)

You can now load the Cuda environment variables by the Modules command. This will load the latest version into your environment. If you need to specify a version, please see module avail cuda for available versions.

 module load cuda

Cuda 5.5

To get started you might want to build and test with the Cuda GPU Computing SDK. In Cuda 5 the SDK is no longer separate and you need to make a copy of the examples directory inside the cuda toolkit directory. You can do this by running the following command.

  • RHEL5 - rsync -a /opt/stow/cuda/cuda-5.5.22/samples ~/cuda_samples
  • RHEL6 - rsync -a /opt/common/cuda/cuda-5.5.22/samples ~/cuda_samples

You should now be able to run make command in the ~/cuda_samples directory and compile all the examples. Please note that you will need to activate an MPI module if you wish to be able to compile all the examples correctly. For example, you can run module load openmpi-x86_64 (Please note this only works on RHEL6. On RHEL5 you will need to have the appropriate MPI include/libs in your environment). You can alternatively compile the specific sample codes by going into the respective directories and typing make

Note: Compiling requires the LIBRARY_PATH environmental variable above to tell GCC where to find the nvidia shared libraries. If using an alternate compiler please consult it as to how to modify the compile time linker path.

Cuda 6.0

You need to have driver 331.62 or later installed to use this (see above for finding out what driver version you are running) and you will need to ask staff to upgrade if not. This is only available currently on RHEL6 x86_64.

  module load cuda/6.0.37

You can then make a copy of the samples to test with. All the same caveats as with the 5.5 samples above.

  • RHEL6 - rsync -a /opt/common/cuda/cuda-6.0.37/samples ~/cuda6_samples

Ubuntu 12.04

First you will need to ensure you have the updated x-updates repository added to your workstation. Please contact staff@umiacs.umd.edu and we will help get this in place for your workstation.

The other component is the toolkit and in Ubuntu non-locally compiled software is available in /opt/common. This includes the CUDA toolkit. You can find all the versions available in /opt/common/cuda.

Cuda 4.2.9 and higher are tested on Ubuntu.

$ ls /opt/common/cuda
cudatoolkit-3.2.16  cudatoolkit-4.0.17  cudatoolkit-4.1.28 cudatoolkit-4.2.9
  • bash/sh
    • export PATH=/opt/common/cuda/cudatoolkit-4.2.9/bin:${PATH}
    • export LD_LIBRARY_PATH=/opt/common/cuda/cudatoolkit-4.2.9/lib64:/opt/common/cuda/cudatoolkit-4.2.9/lib:${LD_LIBRARY_PATH}
  • tcsh/csh
    • setenv PATH /opt/common/cuda/cudatoolkit-4.2.9/bin:${PATH}
    • setenv LD_LIBRARY_PATH /opt/common/cuda/cudatoolkit-4.2.9/lib64:/opt/common/cuda/cudatoolkit-4.2.9/lib:${LD_LIBRARY_PATH}

To get started you might want to build and test with the GPU Computing SDK. You can do this by running /opt/common/cuda/cudatoolkit-4.2.9/gpucomputingsdk_4.2.9_linux.run. It will prompt you to where you want to install the SDK.

Once it is installed please apply this patch from the directory you installed the SDK into.

patch -p1 < /opt/common/cuda/cudatoolkit-4.2.9/UMIACS-CUDA-SDK-Ubuntu-12.04.diff

You should now be able to run make and compile all the examples.