CUDA tutorial: Difference between revisions

Jump to navigation Jump to search
Line 3: Line 3:
[[Category:Software]]
[[Category:Software]]
=Quick start guide=
=Quick start guide=
To begin working with CUDA load a CUDA module.
<source lang="console">
$ module purge
$ module load cuda
</source>
As a first step we will add two numbers together. Save the below file as <code>add.cu</code>. '''The <code>cu</code> file extension is important!'''.
{{File   
{{File   
   |name=add.cu
   |name=add.cu
Line 38: Line 44:
}
}
}}
}}
Save the above file as <code>add.cu</code>. '''The <code>cu</code> file extension is important!'''. To build it issue the following commands:
To build this program issue the following commands:
<source lang="console">
<source lang="console">
$ module purge
$ module load cuda
$ nvcc add.cu -o add
$ nvcc add.cu -o add
</source>
</source>
Create a GPU job script called gpu_job.sh
To run the program first create a GPU job script called gpu_job.sh
{{File
{{File
   |name=gpu_job.sh
   |name=gpu_job.sh
cc_staff
1,486

edits

Navigation menu