UK National HPC Service

Computer Services for Academic Research Logo
Home | Helpdesk | Machine Status | Search | Apply
 

Parallelising Codes 2

Shared Memory Parallelism

Shared memory parallelism is only applicable to shared memory machines such as the CSAR Origin and Altix computers. All processors can see the same memory and they can all read and write to the same memory. In the case of the SGI machines at CSAR, the computer is actually a distributed memory machine, but the interconnect is so fast that it has been possible to write the operating system and compilers in such a way that it acts as a shared memory device.

The standard way of writing shared memory codes is to use the OpenMP set of compiler directives. These directives appear as comments in the source code, and it is therefore possible to compile OpenMP codes as normal serial codes.

The parallelism in OpenMP codes is normally introduced over iterative loops, so that each thread carries out a number of the iterations with other threads carrying out the other iterations. In Fortran with a compiler which supports the full OpenMP 2 standard it is also possible to parallelise parts of the code which use array syntax, although the Intel compilers do not support this feature at present.

When coding for shared memory programming, it is possible to iteratively refine the amount of code which is parallelised, by tackling one loop at a time. This makes the task of converting a serial code into a parallel code much easier than when using the distributed memory model, but it is also much easier to write poorly performing code as shared memory programming requires a greater understanding of the machine's underlying hardware. OpenMP codes do not normally scale to a level approaching that of well written MPI codes.

Page maintained by This page last updated: Tuesday, 17-Aug-2004 15:32:52 BST