Parallel programming models provide perspectives from which
you can write—or adapt—code to run on a high-end
HP system. You can perform both shared-memory programming and message-passing
programming on an SMP. This book focuses on using the shared-memory
paradigm, but includes reference material and pointers to other
manuals about message passing.
The
shared-memory paradigm |
 |
In the shared-memory paradigm, compilers handle optimizations,
and, if requested, parallelization. Numerous compiler directives
and pragmas are available to further increase optimization opportunities. Parallelization
can also be specified using POSIX threads (Pthreads). Figure 1-1 “Symmetric
multiprocessor system” shows the SMP model for the shared-memory
paradigm.
The directives and pragmas associated with the shared-memory programming
model are discussed in the chapter titled “Parallel Programming
Techniques,” “Memory classes,” and “Parallel synchronization.”
The
message-passing paradigm |
 |
HP has implemented a version of the message-passing interface
(MPI) standard known as HP MPI. This implementation is
finely tuned for HP technical servers.
In message-passing, a parallel application consists of a number
of processes that run concurrently. Each process has its own local
memory. It communicates with other processes by sending and receiving messages.
When data is passed in a message, both processes must work to transfer
the data from the local memory of one to the local memory of the
other.
Under the message-passing paradigm, functions allow you to
explicitly spawn parallel processes, communicate data among them,
and coordinate their activities. Unlike the previous model, there
is no shared-memory. Each process has its own private 16-terabyte
(Tbyte) address space, and any data that must be shared must be
explicitly passed between processes. Figure 1-2 “Message-passing
programming model” shows a layout of the message-passing paradigm.
Support of message passing allows programs written under this paradigm
for distributed memory to be easily ported to HP servers. Programs
that require more per-process memory than possible using shared-memory
benefit from the manually-tuned message-passing style.
For more information about HP MPI, see the HP MPI
User’s Guide and the MPI Reference.