OpenACC Guide

From Storrs HPC Wiki
Jump to: navigation, search

Compiling OpenACC code on the HPC Cluster

On the HPC we use the pgi accelerator compilers. This requires loading a cuda module. You can load the pgi module using

module load cuda/4.2.9
module load pgi/13.7

Loading this module will allow you to compile c code with the pgcc command, fortran 90 with pgf90, and c++ with pgc++. Many of the compiler flags for openacc are as you would expect; you can use -l<library> to link a library, -o to specify the output file, and so on. On the HPC you will most likely want to use the following command line flags to compile your code.

pgcc -acc -ta=nvidia <file>.c -o <outfile>

The -acc flag tells the compiler to enable OpenACC pragmas and the -ta specifies the target architecture. You can use -Minfo=accel to print additional OpenACC debugging information.

Running OpenACC code

Once you have compiled your binary you will want to submit the code to the gpu queue. You can submit this with the submission script via sbatch:

$ cat
#SBATCH --gres=gpu:8


$ sbatch

You do not need to load a cuda module to use OpenACC. You can read more about the GPU Guide.


A number of OpenACC links from pgi

A simple hello world type program

Slides from an Xsede workshop on OpenACC

PGI Accelerators OpenACC Getting Started Guide