.TH P_Transpose 3 "10/22/2001" " " "ParLib 1.1" .SH NAME P_Transpose \- Performs blocking transposition .SH SYNOPSIS .nf \fB#include "parlib.h"\fR \fBint P_Transpose(\fR int ndims, void *arr_source, int dim_source, int *lblks_source, void *arr_dest, int dim_dest, int *lblks_dest, int *stride, int *blklen, int *overlap, MPI_Datatype datatype, MPI_Comm comm, int period \fB);\fR .fi .SH INPUT PARAMETERS .PD 0 .TP .B ndims - number of dimensions of the arrays (positive integer) .PD 1 .PD 0 .TP .B arr_source - address of the local part of the source array (choice) .PD 1 .PD 0 .TP .B dim_source - decomposed dimension of array \fIarr_source\fR .PD 1 .PD 0 .TP .B lblks_source - distribution of array \fIarr_source\fR .PD 1 .PD 0 .TP .B dim_dest - decomposed dimension of array \fIarr_dest\fR .PD 1 .PD 0 .TP .B lblks_dest - distribution of array \fIarr_dest\fR .PD 1 .PD 0 .TP .B stride, blklen - parameters specifying dimensions of the arrays \fIarr_source\fR, \fIarr_dest\fR and location of the communicated data within the arrays .PD 1 .PD 0 .TP .B overlap - overlapping of the output array \fIarr_dest\fR .PD 1 .PD 0 .TP .B datatype - data type of the arrays .PD 1 .PD 0 .TP .B comm - communicator specifying the processor group .PD 1 .PD 0 .TP .B period - true, if the overlapping is periodic, false otherwise (logical) .SH OUTPUT PARAMETER .PD 0 .TP .B arr_dest - address of the local part of the destination array (choice) .SH DESCRIPTION .PD 0 The routine performes a transposition of array \fIarr_source\fR storing the result in array \fIarr_dest\fR. Both of the arrays should have the same number of dimensions \fIndims\fR. Array \fIarr_source\fR have to be distriduted in dimension \fIdim_source\fR while array \fIarr_dest\fR in dimension \fIdim_dest\fR. The dimensions and the location of the communicated data within the arrays are specified by parameters \fIstride\fR, \fIblklen\fR, \fIlblks_source\fR and \fIlblks_dest\fR. We assume all indexes to be ranged from 1 in this manual. The arrays have the following dimensions: .nf | regular dim | \fIdim_source\fR | \fIdim_dest\fR -----------|-------------|--------------------|----------------- \fIarr_source\fR | \fIstride\fR(dim) | \fIblklen\fR(\fIdim_source\fR) | \fIstride\fR(\fIdim_dest\fR) \fIarr_dest\fR | \fIstride\fR(dim) | \fIstride\fR(\fIdim_source\fR) | \fIblklen\fR(\fIdim_dest\fR) .fi The following blocks of the arrays are communicated: .nf | regular dim | \fIdim_source\fR | \fIdim_dest\fR -----------|-------------|---------------------|------------------- \fIarr_source\fR |1:\fIblklen\fR(dim)|1:\fIlblks_source\fR(\fIiproc\fR)|1:\fBSUM\fR(\fIlblks_dest\fR) \fIarr_dest\fR |1:\fIblklen\fR(dim)|1:\fBSUM\fR(\fIlblks_source\fR) |1:\fIlblks_dest\fR(\fIiproc\fR) .fi where the regular dimension is any dimension but \fIdim_source\fR and \fIdim_dest\fR, \fIiproc\fR is the processor number within the given group; \fBSUM\fR denotes the summation upon all processors of the group (e.g., .nf \fBSUM\fR(\fIlblks_source\fR)=SUM(\fIlblks_source\fR(i),i=1,\fInproc\fR)), .fi \fInproc\fR is the number of processors in the group. These blocks should be augmented by overlapped regions, if overlapping is taking place. In the next section, we will assume that the first index corresponds to dimension \fIdim_source\fR while the second to dimension \fIdim_dest\fR. Then the transposition algorithm can be outlined as follows. Processor \fIiproc\fR sends .nf \fIarr_source\fR(1:\fIlblks_source\fR(\fIiproc\fR), \fIjb\fR(\fIjproc\fR)-overlap(1):\fIje\fR(\fIjproc\fR)+overlap(2)) .fi to every processor \fIjproc\fR of the group including himself and receives .nf \fIarr_dest\fR(\fIib\fR(\fIjproc\fR):\fIie\fR(\fIjproc\fR), 1-overlap(1):\fIlblks_dest\fR(\fIiproc\fR)+overlap(2)) .fi In the nonperiodic case (\fIperiod\fR is false), \fIoverlap\fR(1) is counted for 0, if \fIiproc\fR is equal to 1 as well as \fIoverlap\fR(2), if \fIiproc\fR is equal to \fInproc\fR. Starting and ending indexes \fIib\fR, \fIie\fR, \fIjb\fR, \fIje\fR are calculated as follows .nf \fIib\fR(1)=1; \fIib\fR(i+1)=\fIib\fR(i)+\fIlblks_dest\fR(i),i=1,...,\fInproc\fR-1; \fIie\fR(\fInproc\fR)=\fBSUM\fR(\fIlblks_dest\fR); \fIie\fR(i-1)=\fIie\fR(i)-\fIlblks_dest\fR(i),i=\fInproc\fR,...,2; .fi .nf \fIjb\fR(1)=1; \fIjb\fR(j+1)=\fIjb\fR(j)+\fIlblks_source\fR(j),j=1,...,\fInproc\fR-1; \fIje\fR(\fInproc\fR)=\fBSUM\fR(\fIlblks_source\fR); \fIje\fR(j-1)=\fIje\fR(j)-\fIlblks_source\fR(j),j=\fInproc\fR,...,2. .fi .SH NOTES Transposition with overlapping is equiualent to transposition widthout overlapping and subsequent interprocessor boundary exchange applied to the resultant array \fIarr_dest\fR. .SH NOTES FOR FORTRAN All INM ParLib routines in Fortran have an additional argument .I ierr at the end of the argument list. .I ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, INM ParLib routines are subroutines, and are invoked with the .I call statement. All INM ParLib objects (e.g., \fIBExchange\fR, \fITransposition\fR) are \fIINTEGER\fR arrays of size \fIHANDLE_SIZE\fR in Fortran. The parameter \fIHANDLE_SIZE\fR is defined in 'parlibf.h' which is recommended to be included in Fortran code beforehand. .SH ERRORS The routine returns the following error codes: .RS 3 .TP .PD 0 .TP 3 .B 0 - No error; the routine completed successfully. .TP .B 1 - Number of dimensions \fIndims\fR is less than 2. .TP .B 2 - \fIdim_source\fR is out of range [1,\fIndims\fR]. .TP .B 3 - \fIdim_dest\fR is out of range [1,\fIndims\fR]. .TP .B 4 - \fIdim_source\fR and \fIdim_dest\fR coincide. .TP .B 5 - Nonpositive array dimension. .TP .B 6 - Negative overlapping. .TP .B 7 - \fIblklen\fR exceeds \fIstride\fR. .TP .B 8 - \fIlblks_source\fR(\fIiproc\fR) exceeds \fIblklen\fR(\fIdim_source\fR). .TP .B 9 - \fIlblks_dest\fR(\fIiproc\fR) exceeds \fIblklen\fR(\fIdim_dest\fR). .TP .B 10 - \fBSUM\fR(\fIlblks_source\fR) exceeds \fIstride\fR(\fIdim_source\fR). .TP .B 11 - \fBSUM\fR(\fIlblks_dest\fR) exceeds \fIstride\fR(\fIdim_dest\fR). .TP .B 12 - \fIoverlap\fR(1) exceeds \fIlblks_dest\fR(1). .TP .B 13 - \fIoverlap\fR(2) exceeds \fIlblks_dest\fR(\fInproc\fR). .TP .B 14 - \fIlblks_source\fR is nonpositive. .TP .B 15 - \fIlblks_dest\fR is nonpositive. .SH SEE ALSO \fBP_Transpose_init\fR(3), \fBP_Transpose_start\fR(3), \fBP_Transpose_end\fR(3), \fBP_Transpose_free\fR(3) .SH AUTHOR Val N. Gloukhov, gluhoff@inm.ras.ru