Parallel programming environments provide new challenges for developers of general-purpose software libraries. In particular, message passing environments such as PVM on the one hand, and data parallel environments such as CM Fortran on the other, require specific code modifications in order to attain high performance on the particular machines. The plurality of programming models and environments also makes it more difficult to maintain multiple nearly-identical versions of code for different machines.
Portability of PCG is achieved by use of various software tools which allow the coding of the algorithms to take place at a high level. In the present work, the Gnu m4 macro preprocessor is employed. By use of macros which expand differently for different machine versions, a substantial portion of the source code can be kept machine-independent. Other components which may require machine-specific code optimizations may be accommodated in this setting as well.
For data parallel versions of Fortran, such as CM Fortran and Cray Fortran for the T3D, arrays are provided within the language which assume a given data distribution across processors. In these cases, arrays representing the matrix and vectors passed to PCG are assumed to be such distributed arrays.
A great deal of flexibility is available for the rank, size and distribution of such arrays. However, the arrays must satisfy certain alignment conditions in order for high performance to be achieved.
Since the Fortran 90 rules for array sequence and storage association are typically violated by data parallel Fortrans for parallel machines, certain modifications are sometimes necessary. For example, issues such as the handling of pointers and management of temporary memory require more careful consideration.
On the other hand, for message passing implementations, arrays for the matrix and vectors refer to the part of that matrix or vector local to that processor. The user specifies the size of the subvectors and submatrix on each processor as well as the assumed distribution of the matrix and vectors across the processors. Other arguments sent to PCG must match across processors, such as the parameter arrays.
In message passing environments, message types must be carefully managed to insure that messages are passed correctly. In PCG, the user specifies a range of message types of at least a certain size which can be used for PCG communication. This range may either be shared by the user in a specified manner, or set to a range outside that used by the application code and other libraries.
For most message passing versions, it is assumed that all allocated processors call PCG. On the other hand, PVM and MPI versions allow PCG to be run on arbitrary user-defined processor groups. PCG is also reentrant and can be called in a thread-safe manner.
Error messages from the package are printed from processor zero. For some versions, the package sets the i/o modes appropriately and restores them upon return from the package.