Difference between revisions of "Nvidia CUDA Toolkit"

From UFRC
Jump to navigation Jump to search
 
(115 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Software]]
+
[[Category:Software]][[Category:Programming]][[Category:Library]][[Category:Graphics]]
 
{|<!--CONFIGURATION: REQUIRED-->
 
{|<!--CONFIGURATION: REQUIRED-->
 
|{{#vardefine:app|cuda}}
 
|{{#vardefine:app|cuda}}
Line 6: Line 6:
 
|{{#vardefine:conf|}}          <!--CONFIGURATION-->
 
|{{#vardefine:conf|}}          <!--CONFIGURATION-->
 
|{{#vardefine:exe|1}}            <!--ADDITIONAL INFO-->
 
|{{#vardefine:exe|1}}            <!--ADDITIONAL INFO-->
|{{#vardefine:pbs|1}}            <!--PBS SCRIPTS-->
+
|{{#vardefine:pbs|1}}            <!--JOB SCRIPTS-->
 
|{{#vardefine:policy|1}}        <!--POLICY-->
 
|{{#vardefine:policy|1}}        <!--POLICY-->
|{{#vardefine:testing|}}       <!--PROFILING-->
+
|{{#vardefine:testing|}}       <!--PROFILING-->
 
|{{#vardefine:faq|}}            <!--FAQ-->
 
|{{#vardefine:faq|}}            <!--FAQ-->
 
|{{#vardefine:citation|}}      <!--CITATION-->
 
|{{#vardefine:citation|}}      <!--CITATION-->
Line 19: Line 19:
 
CUDA™ is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). With millions of CUDA-enabled GPUs sold to date, software developers, scientists and researchers are finding broad-ranging uses for GPU computing with CUDA.
 
CUDA™ is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). With millions of CUDA-enabled GPUs sold to date, software developers, scientists and researchers are finding broad-ranging uses for GPU computing with CUDA.
 
<!--Modules-->
 
<!--Modules-->
==Required Modules==
+
==Environment Modules==
cuda
+
Use the 'module avail' command after loading a cuda environment module to see the available module trees or see which compiler and openmpi modules require the cuda module to be loaded.
 +
 
 
==System Variables==
 
==System Variables==
* HPC_{{#uppercase:{{#var:app}}}}_DIR
+
* HPC_{{uc:{{#var:app}}}}_DIR
* HPC_{{#uppercase:{{#var:app}}}}_BIN
+
* HPC_{{uc:{{#var:app}}}}_BIN
* HPC_{{#uppercase:{{#var:app}}}}_INC
+
* HPC_{{uc:{{#var:app}}}}_INC
* HPC_{{#uppercase:{{#var:app}}}}_LIB
+
* HPC_{{uc:{{#var:app}}}}_LIB
 
<!--Configuration-->
 
<!--Configuration-->
 
{{#if: {{#var: conf}}|==Configuration==
 
{{#if: {{#var: conf}}|==Configuration==
Line 31: Line 32:
 
|}}
 
|}}
 
<!--Run-->
 
<!--Run-->
{{#if: {{#var: exe}}|==Additional Information==
+
==Program Development==
Also see [[NVIDIA GPUs]].
 
|}}
 
<!--PBS scripts-->
 
{{#if: {{#var: pbs}}|==PBS Script Examples==
 
See the [[{{PAGENAME}}_PBS]] page for {{#var: app}} PBS script examples.
 
|}}
 
<!--Policy-->
 
{{#if: {{#var: policy}}|==Usage Policy==
 
===Interactive Use===
 
  
If you need interactive access to a gpu for development and testing you may do so by requesting an interactive session through the batch system.
+
===Environment===
 +
For CUDA development please load the "cuda" module.  Doing so will ensure that your environment is set up correctly for the use of the CUDA compiler, header files, and libraries. Currently cuda/9.2.88 and cuda/10.0.130 are the only versions supported on hipergator.  
  
In order to gain interactive access to a GPU server you should run similar to the one that follows.
+
<pre>
 +
$ module spider cuda
 +
-------------------------------------------------------------
 +
cuda:
 +
-------------------------------------------------------------
 +
    Description:
 +
      NVIDIA CUDA Toolkit
  
<pre>
+
    Versions:
qsub -I -l nodes=1:gpus=1:tesla,walltime=01:00:00 -q gpu
+
        cuda/9.2.88
</pre>
+
        cuda/10.0.130
 +
       
  
To gain access to one of the Fermi-class GPUs, you can make a similar request but specify the "fermi" attribute in your resource request as below.
+
--------------------------------------------------------------------------------------------------------------------
 +
  For detailed information about a specific "cuda" module (including how to load the modules) use the module full name.
 +
  For example:
  
<pre>
+
    $ module spider cuda/10.0.130
qsub -I -l nodes=1:gpus=1:fermi,walltime=01:00:00 -q gpu
+
--------------------------------------------------------------------------------------------------------------------
</pre>
 
  
If a gpu is available, you will get a prompt on one of the nodes within a minute or two.  Otherwise, you will have to wait or try another time.  If you choose to wait, you will be connected when a gpu is available.    The default walltime limit for the gpu queue is 10 minutes. You should request the amount of time you need but be sure to log out and end your session when you are finished so that the GPU will be available to others.
+
$ module load cuda/10.0.130
  
If your work needs both GPUs attached to the same node, you would run the following command instead.
+
$ which nvcc
 +
/apps/compilers/cuda/10.0.130/bin/nvcc
  
<pre>
+
$ printenv | grep CUDA
qsub -I -l nodes=1:gpus=2,walltime=01:00:00 -q gpu
+
HPC_CUDA_LIB=/apps/compilers/cuda/10.0.130/lib64
 +
HPC_CUDA_DIR=/apps/compilers/cuda/10.0.130
 +
HPC_CUDA_BIN=/apps/compilers/cuda/10.0.130/bin
 +
HPC_CUDA_INC=/apps/compilers/cuda/10.0.130/include
 +
UFRC_FAMILY_CUDA_VERSION=10.0.130
 
</pre>
 
</pre>
  
If you need to request a particular machine, say ''tesla1'', you would use the following qsub command.
 
  
<pre>
+
===Selecting CUDA Arch Flags===
qsub -I -l nodes=tesla1:gpus=1,walltime=01:00:00 -q gpu
+
When compiling with NVCC, you need to specify the Nvidia architecture that the CUDA files will be compiled for. Please refer to [https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list GPU Feature List] for CUDA naming scheme sm_xy where x denotes the GPU generation and y denotes the version. The table below lists the SM flags for the three types of GPUs on HiPerGator.
</pre>
+
 
===Batch Jobs===
+
{| class="wikitable"
 +
|-
 +
! SM !! Nvidia Cards
 +
|-
 +
| SM_37 || Tesla K80 (No longer available)
 +
|-
 +
| SM_61 || GeForce GTX 1080Ti
 +
|-
 +
| SM_75|| GeForce RTX 2080Ti
 +
|-
 +
| SM_80 || DGX A100
 +
|}
  
The process is much the same for batch jobs.  To access a node with an M2090, you can add the following to your submission script.
+
==Sample GPU Batch Job Scripts==
  
<pre>
+
===SLURM Job Scripts===
#PBS -q gpu
 
#PBS -l nodes=1:gpus=1:M2090
 
#PBS -l walltime=1:00:00
 
</pre>
 
  
To access a node with an M2070 GPU, you can add the following to your submission script.
+
See the [[Example_SLURM-GPU-Job-Scripts]] page for an example.
  
<pre>
+
<!--|}}-->
#PBS -q gpu
 
#PBS -l nodes=1:gpus=1:m2070
 
#PBS -l walltime=1:00:00
 
</pre>
 
  
|}}
 
<!--Performance-->
 
{{#if: {{#var: testing}}|==Performance==
 
WRITE_PERFORMANCE_TESTING_RESULTS_HERE
 
|}}
 
 
<!--Faq-->
 
<!--Faq-->
 
{{#if: {{#var: faq}}|==FAQ==
 
{{#if: {{#var: faq}}|==FAQ==
Line 103: Line 106:
 
{{#if: {{#var: installation}}|==Installation==
 
{{#if: {{#var: installation}}|==Installation==
 
See the [[{{PAGENAME}}_Install]] page for {{#var: app}} installation notes.|}}
 
See the [[{{PAGENAME}}_Install]] page for {{#var: app}} installation notes.|}}
<!--Turn the Table of Contents and Edit paragraph links ON/OFF-->
+
<!--Turn the Table of Contents and Edit paragraph links ON/OFF
 
__NOTOC____NOEDITSECTION__
 
__NOTOC____NOEDITSECTION__
 +
-->

Latest revision as of 14:17, 15 August 2022

Description

cuda website  
CUDA™ is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). With millions of CUDA-enabled GPUs sold to date, software developers, scientists and researchers are finding broad-ranging uses for GPU computing with CUDA.

Environment Modules

Use the 'module avail' command after loading a cuda environment module to see the available module trees or see which compiler and openmpi modules require the cuda module to be loaded.

System Variables

  • HPC_CUDA_DIR
  • HPC_CUDA_BIN
  • HPC_CUDA_INC
  • HPC_CUDA_LIB

Program Development

Environment

For CUDA development please load the "cuda" module. Doing so will ensure that your environment is set up correctly for the use of the CUDA compiler, header files, and libraries. Currently cuda/9.2.88 and cuda/10.0.130 are the only versions supported on hipergator.

$ module spider cuda
-------------------------------------------------------------
cuda:
-------------------------------------------------------------
    Description:
      NVIDIA CUDA Toolkit

     Versions:
        cuda/9.2.88
        cuda/10.0.130
        

--------------------------------------------------------------------------------------------------------------------
  For detailed information about a specific "cuda" module (including how to load the modules) use the module full name.
  For example:

     $ module spider cuda/10.0.130
--------------------------------------------------------------------------------------------------------------------

$ module load cuda/10.0.130

$ which nvcc
/apps/compilers/cuda/10.0.130/bin/nvcc

$ printenv | grep CUDA
HPC_CUDA_LIB=/apps/compilers/cuda/10.0.130/lib64
HPC_CUDA_DIR=/apps/compilers/cuda/10.0.130
HPC_CUDA_BIN=/apps/compilers/cuda/10.0.130/bin
HPC_CUDA_INC=/apps/compilers/cuda/10.0.130/include
UFRC_FAMILY_CUDA_VERSION=10.0.130


Selecting CUDA Arch Flags

When compiling with NVCC, you need to specify the Nvidia architecture that the CUDA files will be compiled for. Please refer to GPU Feature List for CUDA naming scheme sm_xy where x denotes the GPU generation and y denotes the version. The table below lists the SM flags for the three types of GPUs on HiPerGator.

SM Nvidia Cards
SM_37 Tesla K80 (No longer available)
SM_61 GeForce GTX 1080Ti
SM_75 GeForce RTX 2080Ti
SM_80 DGX A100

Sample GPU Batch Job Scripts

SLURM Job Scripts

See the Example_SLURM-GPU-Job-Scripts page for an example.