CUDA tutorial: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 48: Line 48:
$ nvcc add.cu -o add
$ nvcc add.cu -o add
</source>
</source>
To run the program first create a Slurm job script called gpu_job.sh.
To run the program first create a Slurm job script called gpu_job.sh. See also [[Using GPUs with Slurm|using GPUs with Slurm]].
{{File
{{File
   |name=gpu_job.sh
   |name=gpu_job.sh
Line 59: Line 59:
#SBATCH --time=0-00:10            # time (DD-HH:MM)
#SBATCH --time=0-00:10            # time (DD-HH:MM)
./add #name of your program
./add #name of your program
}}For information about GPU job scripts see [[Using GPUs with Slurm|using GPUs with Slurm]].
}}


Submit your GPU job to the scheduler with this command.
Submit your GPU job to the scheduler with this command.
Line 65: Line 65:
$ sbatch gpu_job.sh
$ sbatch gpu_job.sh
Submitted batch job 3127733
Submitted batch job 3127733
</source>For information about the <code>sbatch</code> command and running and monitoring jobs see [[Running jobs|running jobs]].
</source>For information about the <code>sbatch</code> command and running and monitoring jobs see the [[Running jobs|running jobs]] page.


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.
Line 72: Line 72:
2+7=9
2+7=9
</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>. To learn more about what the above program does keep reading.


=Introduction= <!--T:1-->
=Introduction= <!--T:1-->
cc_staff
1,486

edits

Navigation menu