At the time of writing the MPI standard does not offer the possibility to address a common memory segment for a group of tasks on shared memory systems. Nevertheless shared memory can be used with the help of the Unix System V inter-process communication functions shmget, shmat , which allocate a memory segment and attach it to the memory space of each calling task.
The main steps to this algorithm are as follows:
The implementation uses a set of functions written in C which group the tasks that can use shared memory and create the shared memory segment for them. The subroutines that make available the shared memory to a FORTRAN pointer using Cray pointers are provided in a FORTRAN module .
There are two non-portable components in this implementation according to the CASINO coding standard (FORTRAN95+MPI), although widely available on currently used parallel computers: the shared memory subroutines, which are not portable on a all operating systems, and the Cray pointers, which are not FORTRAN 95 compliant.
In order to conform with CASINO portability requirements or for use in cases that do not need shared memory an alternative FORTRAN module is provided that implements the initial algorithm, that is, each task has a full copy of the BC. The user can switch between the two modules with the help of a makefile variable (CASINO does not use code preprocessing).