OpenACC Introduction

OpenACC is an API, composed of compiler directives to specify loops and regions of code to be offloaded from a host CPU to an attached accelerator, such as a GPU (or APU or multi-core processor). Using OpenACC, you can utilize accelerators without the need to explicitly initialize the accelerator, manage data or program transfers between the host and accelerator, or initiate accelerator startup and shutdown.

  1. kernals directive

    USAGE: #pragma acc kernels [clause ...] {}

    A kernel is a parallel routine to run on the GPU. We request that each loop execute as a separate kernel on the GPU.

    #pragma acc kernels
    	for(int i=0; i < myMax; i++){/* one kernel */
    		...
    	}
    	for(int j=0; j < limit; j++){/* another kernel */
    		...
    	}

Code to copy

Copy code into your workspace:
cp -r ~instr006/openacc .

OpenACC is not supported in Blue Waters' GNU environment, but is available in the Cray and PGI environments. To use OpenACC in a Cray environment, we need to load these three modules:

When submitting jobs, be sure to specify "xk" as the node type; also recall that the the max processors per node is 16, not 32 for the "xk" nodes. For instance:

qsub -I -l nodes=1:ppn=16:xk,walltime=00:30:00

Resources