CUDA: Difference between revisions

Jump to navigation Jump to search
132 bytes added ,  6 years ago
Marked this version for translation
(created, copied from cgeroux's work at CUDA tutorial)
 
(Marked this version for translation)
Line 3: Line 3:
<translate>
<translate>


<!--T:37-->
"CUDA® is a parallel computing platform and programming model developed by NVIDIA for general computing on graphical processing units (GPUs)."<ref>[http://www.nvidia.com/object/cuda_home_new.html Nvidia CUDA Home Page]. CUDA is a registered trademark of NVIDIA.</ref>
"CUDA® is a parallel computing platform and programming model developed by NVIDIA for general computing on graphical processing units (GPUs)."<ref>[http://www.nvidia.com/object/cuda_home_new.html Nvidia CUDA Home Page]. CUDA is a registered trademark of NVIDIA.</ref>


<!--T:38-->
It is reasonable to think of CUDA as a set of libraries and associated C, C++, and Fortran compilers that enable you to write code for GPUs. See [[OpenACC Tutorial]] for another set of GPU programming tools.
It is reasonable to think of CUDA as a set of libraries and associated C, C++, and Fortran compilers that enable you to write code for GPUs. See [[OpenACC Tutorial]] for another set of GPU programming tools.


== Quick start guide ==
== Quick start guide == <!--T:39-->


<!--T:40-->
Here we show a simple example of how to use the CUDA C/C++ language compiler, <code>nvcc</code>, and run code created with it. For a longer tutorial in CUDA programming, see [[CUDA tutorial]].
Here we show a simple example of how to use the CUDA C/C++ language compiler, <code>nvcc</code>, and run code created with it. For a longer tutorial in CUDA programming, see [[CUDA tutorial]].


<!--T:41-->
First, load a CUDA [[Utiliser des modules/en|module]].
First, load a CUDA [[Utiliser des modules/en|module]].
<source lang="console">
<source lang="console">
Line 17: Line 21:
</source>
</source>


<!--T:42-->
The following program will add two numbers together on a GPU. Save the file as <code>add.cu</code>. ''The <code>cu</code> file extension is important!''.  
The following program will add two numbers together on a GPU. Save the file as <code>add.cu</code>. ''The <code>cu</code> file extension is important!''.  


Line 57: Line 62:
<translate>
<translate>


<!--T:43-->
Compile the program with <code>nvcc</code> to create an executable named <code>add</code>.
Compile the program with <code>nvcc</code> to create an executable named <code>add</code>.
<source lang="console">
<source lang="console">
Line 62: Line 68:
</source>
</source>


<!--T:44-->
To run the program, create a Slurm job script as shown below. Be sure to replace <code>def-someuser</code> with your specific account (see [[Running_jobs#Accounts_and_projects|accounts and projects]]). For options relating to scheduling jobs with GPUs see [[Using GPUs with Slurm]].  
To run the program, create a Slurm job script as shown below. Be sure to replace <code>def-someuser</code> with your specific account (see [[Running_jobs#Accounts_and_projects|accounts and projects]]). For options relating to scheduling jobs with GPUs see [[Using GPUs with Slurm]].  
{{File
{{File
Line 75: Line 82:
}}
}}


<!--T:45-->
Submit your GPU job to the scheduler with this command.  
Submit your GPU job to the scheduler with this command.  
<source lang="console">
<source lang="console">
Line 81: Line 89:
</source>For more information about the <code>sbatch</code> command and running and monitoring jobs see [[Running jobs]].
</source>For more information about the <code>sbatch</code> command and running and monitoring jobs see [[Running jobs]].


<!--T:46-->
Once your job has finished you should see an output file similar to this.
Once your job has finished you should see an output file similar to this.
<source lang="console">
<source lang="console">
Line 88: Line 97:
If you run this without a GPU present you might see output like <code>2+7=0</code>.  
If you run this without a GPU present you might see output like <code>2+7=0</code>.  


<!--T:47-->
To learn more about how the above program works and how to make the use of a GPUs parallelism see [[CUDA tutorial]].
To learn more about how the above program works and how to make the use of a GPUs parallelism see [[CUDA tutorial]].


</translate>
</translate>
Bureaucrats, cc_docs_admin, cc_staff
2,879

edits

Navigation menu