Setting Up Programming Environment¶
1. Load the compiler module¶
We need the Nvidia HPC SDK compiler for compiling and testing OpenACC code.
$ module load OpenMPI/5.0.3-NVHPC-24.9-CUDA-12.6.0
### or
$ source module.sh
Check if the module is loaded properly
$ ml
Currently Loaded Modules:
1) NVHPC/24.9-CUDA-12.6.0
2) CUDA/12.6.0
3) OpenMPI/5.0.3-NVHPC-24.9-CUDA-12.6.0
...
2. Compile your OpenACC application¶
$ nvc -fast -acc=gpu -gpu=cc80 -Minfo=accel <source_file>.c -o <output>
For example:
$ nvc -fast -acc=gpu -gpu=cc80 -Minfo=accel Hello-world.c -o Hello-World-GPU
3. Execute your application¶
$ ./<output>
For example:
$ ./Hello-World-GPU
Hello World from GPU!
Hello World from GPU!
Hello World from GPU!
Hello World from GPU!