NERSCPowering Scientific Discovery Since 1974

IWOMP 2017 OpenMP Tutorial

OpenMP “Common Core,” A Short Introduction

This tutorial is a shortened (half day) version of the OpenMP Common Core Material

First logon to your training to your training account. Although you can change your password through the interface at, we recommend that you do not. The training account will enable you to access a reserved set of nodes for this tutorial. Substitute your training account as handed out for train171.

ssh -X
(Type your password -- carefully please!)

Then recursively copy the tutorial exercises to your home directory. Use the period at the end of the command to specify the destination.

%cp -r /project/projectdirs/training/IWOMP2017/omp-core/ .
%cd omp-core/OMP_Exercises

The tutorial exercises run interactively on both the Cori systems. To use Edison's compute nodes you must request one node and have the batch system allocate resources from the pool of free nodes. Please use only one node for your exercises. The following command requests one using either the debug partition or the special training partition. (Change debug to sc16 to use the reservation nodes, but this will only work on tutorial day.) You can compile on the login nodes, which are different from the compute nodes.

During the ACTUAL TUTORIAL use this box below. After the tutorial, use the debug queue (2nd box). The reservation will only work with training accounts, not your NERSC account. Run the make on the login nodes.

cori06% salloc -N 1 --reservation=omptutorial -p special -C knl,quad,cache -t 1:00:00
(Wait for your resource)

Skip this box below during the tutorial. You should already have a node from the reservation.

cori06% salloc -N 1 -p debug -C knl,quad,cache
(Wait for your resource)


The -p flag specifies the name of the partition and the -N option specifies the number of nodes to allocate for your job. We are doing OpenMP only codes, so just grab one node (IMPORTANT not to hog nodes). The debug partition has a 30 minute wall clock limit, so your interactive job will be terminated after 30 minutes from its start. If you do not need full 30 minutes, you can type the exit command to release the node.

Assuming there are free nodes, and the salloc command returns your shell prompt, you will land on the requested compute node, and will be in your work directory where the salloc command was executed. 

cori% ./hello
cori% export OMP_NUM_THREADS=6
cori% ./pi_recur

Your training accounts should have the bash shell (which can be changed) however for this page instructions are given for that shell.