Download Shmem Programming Manual - Pittsburgh Supercomputing Center

Transcript
2
The Shmem Library
2.1 Introduction
This chapter describes in detail the functions belonging to the Shmem programming
library. This library allows user to write parallel applications using a shared-memory
programming model, where all the processes can operate on a globally accessible
address space. In order to support this programming model, the Shmem routines
supply remote data transfer, work-shared broadcast and reduction, barrier
synchronization, and atomic memory operations. Furthermore the Shmem routines
minimize the overhead associated with data passing requests, maximize bandwidth,
and minimize data latency. The Shmem library can be used in conjunction with or as
a replacement for message passing routines (e.g. MPI), so that developers can
optimally mix message-passing and shared-memory programming models in the same
application.
2.2 Compiling
To use the functions in the Shmem library, programs must include the header file
shmem.h. The library functions reference header files which are, by default, installed
in the directory /usr/include (or /opt/rms/include for Solaris.
Programs must be linked with libshmem.so. An example command line to compile a
program prog.c is shown here.
cc -o prog prog.c -lshmem
Definitions for the Fortran interface to Shmem can be found in the header file
shmem.fh.
The Shmem Library 2-1