|
ScaLAPACK
2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
|
00001 /* --------------------------------------------------------------------- 00002 * 00003 * -- PBLAS auxiliary routine (version 2.0) -- 00004 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00005 * and University of California, Berkeley. 00006 * April 1, 1998 00007 * 00008 * --------------------------------------------------------------------- 00009 */ 00010 /* 00011 * Include files 00012 */ 00013 #include "../pblas.h" 00014 #include "../PBpblas.h" 00015 #include "../PBtools.h" 00016 #include "../PBblacs.h" 00017 #include "../PBblas.h" 00018 00019 #ifdef __STDC__ 00020 int PB_Cindxg2p( int IG, int INB, int NB, int PROC, int SRCPROC, int NPROCS ) 00021 #else 00022 int PB_Cindxg2p( IG, INB, NB, PROC, SRCPROC, NPROCS ) 00023 /* 00024 * .. Scalar Arguments .. 00025 */ 00026 int IG, INB, NB, NPROCS, PROC, SRCPROC; 00027 #endif 00028 { 00029 /* 00030 * Purpose 00031 * ======= 00032 * 00033 * PB_Cindxg2p computes the process coordinate which posseses the entry 00034 * of a matrix specified by a global index IG. 00035 * 00036 * Arguments 00037 * ========= 00038 * 00039 * IG (global input) INTEGER 00040 * On entry, IG specifies the global index of the matrix entry. 00041 * IG must be at least zero. 00042 * 00043 * INB (global input) INTEGER 00044 * On entry, INB specifies the size of the first block of the 00045 * global matrix. INB must be at least one. 00046 * 00047 * NB (global input) INTEGER 00048 * On entry, NB specifies the size of the blocks used to parti- 00049 * tion the matrix. NB must be at least one. 00050 * 00051 * PROC (local dummy) INTEGER 00052 * On entry, PROC is a dummy argument in this case in order to 00053 * unify the calling sequence of the tool-routines. 00054 * 00055 * SRCPROC (global input) INTEGER 00056 * On entry, SRCPROC specifies the coordinate of the process 00057 * that possesses the first row or column of the matrix. When 00058 * SRCPROC = -1, the data is not distributed but replicated, 00059 * otherwise SRCPROC must be at least zero and strictly less 00060 * than NPROCS. 00061 * 00062 * NPROCS (global input) INTEGER 00063 * On entry, NPROCS specifies the total number of process rows 00064 * or columns over which the matrix is distributed. NPROCS must 00065 * be at least one. 00066 * 00067 * -- Written on April 1, 1998 by 00068 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA. 00069 * 00070 * --------------------------------------------------------------------- 00071 */ 00072 /* .. 00073 * .. Executable Statements .. 00074 * 00075 */ 00076 if( ( IG < INB ) || ( SRCPROC == -1 ) || ( NPROCS == 1 ) ) 00077 /* 00078 * IG belongs to the first block, or the data is not distributed, or there is 00079 * just one process in this dimension of the grid. 00080 */ 00081 return( SRCPROC ); 00082 /* 00083 * Otherwise, IG is in block 1 + ( IG - INB ) / NB. Add this to SRCPROC and 00084 * take the NPROCS modulo (definition of the block-cyclic data distribution). 00085 */ 00086 PROC = SRCPROC + 1 + ( IG - INB ) / NB; 00087 return( MPosMod( PROC, NPROCS ) ); 00088 /* 00089 * End of PB_Cindxg2p 00090 */ 00091 }