GPU Use
Resources
Two (2) NVIDIA Quadro K2200 (2014)
Access
Access can be requested through GLPI.
WARNING: the following instructions are no longer up to date
Basic use
Login
Then, the login is performed with a command
ssh lpnws5232.in2p3.fr
Environment configuration
WARNING: the rest of these instructions is no longer up to date To access to CUDA
. /usr/local/bin/cuda-setup.sh # sh, bash
or
source /usr/local/bin/cuda-setup.csh # csh, tcsh
Please note that GPU boards are also available on the Mesu-Beta of ICS.
How to begin
CUDA samples
To install CUDA samples :
cuda-install-samples-8.0.sh $destDir
cd $destDir
cuda-fix-samples.sh # to make them compatible with SL
cd NVIDIA_CUDA-8.0_Samples
make -j # to compile everything
Then, one should find compiled codes in each subdir, organized by item :
SOMEWHERE/cuda-samples/NVIDIA_CUDA-8.0_Samples $ ls
0_Simple 2_Graphics 4_Finance 6_Advanced bin EULA.txt
1_Utilities 3_Imaging 5_Simulations 7_CUDALibraries common Makefile
Binaries are directly available at SOMEWHERE/cuda-samples/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/
Local examples
CUDA example
Based on the pi estimation :
- basic code : pi_gpu.cu
- better implemented code : pi_gpu_v2.cu
- Multi-GPU version : pi_gpu_multiGPU.cu
- Using thrust : pi_gpu_thrust.cu
Python examples
In order to use pythlon examples, one should install some python modules locally. The simpliest way is to use anaconda, which gives a local python environment, and install needed modules which does not require root privileges. The tool is available on the GPU machine. To proceed :
export ANACONDADIR="/usr/local/anaconda3-2.5.0"
export PATH="$ANACONDADIR/bin:$PATH"
Then, for samples, one need to install to use (a priori it's already available for all users — to be confirmed) the numba module which allows automatic optimization of the python code and uses the NVIDIA CUDA library for GPU programming :
conda install numba
conda install accelerate
Other informations
Available GPU boards
On the machine with GPU, there are two available boards, numbered 0 et 1. By default, if one use only one board, the 0th is used; it's an issue if all users are using the 0th board and none on the 1st.
Thus, the CUDA_VISIBLE_DEVICES
variable is randomly set (actually not, it's done according to the session parity) to 0 or 1.
If you wish to use 2 boards :
export CUDA_VISIBLE_DEVICES=0,1
or
unset CUDA_VISIBLE_DEVICES
Profiling CUDA code
It's done with the use of the Nvidia Visual Profiler (nvvp
) tool.
Monitoring
In order to have a sort of top
for GPUs :
nvidia-smi --loop=2
For more informations :
nvidia-smi -q -d MEMORY,UTILIZATION,TEMPERATURE,POWER,CLOCK,COMPUTE,PIDS,PERFORMANCE -l
Using OpenCL
OpenCL is a programming standard of GPU architectures based on C++ extensions. To use OpenCL :
- include files are located at
/usr/local/cuda/include/CL
; one should use-I/usr/local/cuda/include
option for compiling ; - the OpenCL library is located at
/usr/lib64
; then just add the-lOpenCL
option for linking.
Some references on the web (mainly in french)
- La lettre IN2P3 informatique
- http://www.info.univ-angers.fr/~richer/cuda_crs2.php
- http://blogs.msdn.com/b/devpara/archive/2011/11/18/introduction-224-la-programmation-gpu-part-3.aspx
- http://www.enseignement.polytechnique.fr/profs/informatique/Eric.Goubault/Cours12/cours3-4.pdf
- http://www.irisa.fr/alf/downloads/collange/cours/gpuprog_ufmg/gpuprog_2.pdf