CUDA: Difference between revisions

314 bytes added ,  5 years ago
add subsections, information on linking
(Marked this version for translation)
(add subsections, information on linking)
Line 11: Line 11:
== Quick start guide == <!--T:39-->
== Quick start guide == <!--T:39-->


===Compiling===
<!--T:40-->
<!--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]].
Line 68: Line 69:
</source>
</source>


=== Submitting jobs===
<!--T:44-->
<!--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]].  
Line 96: Line 98:
</source>
</source>
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>.  
=== Linking libraries ===
If you have a program that needs to link some libraries included with CUDA, for example [https://developer.nvidia.com/cublas cuBLAS], compile with the following flags
<source lang="console">
nvcc -lcublas -Xlinker=-rpath,$CUDA_PATH/lib64
</source>


<!--T:47-->
<!--T:47-->
cc_staff
229

edits