NERSCPowering Scientific Discovery Since 1974

UPC (Unified Parallel C)

Description

Unified Parallel C is a partitioned global address space (PGAS) language and an extension of the C programming language.

Availability

UPC is available on Edison and Hopper via both the Cray compilers, as well as through Berkeley UPC, a portable high-performance UPC compiler and runtime implementation.

Using UPC

To compile a UPC source file using the Cray compilers, you must first swap the Cray compiler with the default compiler.

On Hopper:

% module swap PrgEnv-pgi PrgEnv-cray

On Edison:

% module swap PrgEnv-intel PrgEnv-cray

Then compile the code like this:

% cc -h upc -o UPCProg UPCProg.c

The "-h upc" option is needed on the cc command line.

To use Berkeley UPC, simply load the bupc module, after which the compiler will be available as the upcc comand.

Unlike the Cray UPC compiler, Berkeley UPC has its own internal source code translator, but leaves the choice of underlying compiler up to you. Upon loading the bupc module, the correct configuration is chosen to match your current PrgEnv.

Note that if you later want to swap to a different PrgEnv, you will need to reload the bupc module. This point is also noted when you initially load bupc.

% module load bupc
## Loaded module 'bupc/2.20.2-5.2.40-pgi-14.2.0' based on current PrgEnv
## and compiler.  If you change PrgEnv or compiler modules, then you should
## run 'module switch bupc bupc' to get the correct bupc module.
% module swap PrgEnv-pgi PrgEnv-intel
% module swap bupc bupc
## Loaded module 'bupc/2.20.2-5.2.40-gnu-4.9.2' based on current PrgEnv
## and compiler.  If you change PrgEnv or compiler modules, then you should
## run 'module switch bupc bupc' to get the correct bupc module.
% upcc -V
This is upcc (the Berkeley Unified Parallel C compiler), v. 2.20.2
... snip ...

For more information on Berkeley UPC, please see their documentation.

Documentation

For questions about using UPC at NERSC contact the consultants at consult@nersc.gov.