|
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 char * PB_Ctop( int * ICTXT, char * OP, char * SCOPE, char * TOP ) 00021 #else 00022 char * PB_Ctop( ICTXT, OP, SCOPE, TOP ) 00023 /* 00024 * .. Scalar Arguments .. 00025 */ 00026 int * ICTXT; 00027 /* 00028 * .. Array Arguments .. 00029 */ 00030 char * OP, * SCOPE, * TOP; 00031 #endif 00032 { 00033 /* 00034 * Purpose 00035 * ======= 00036 * 00037 * PB_Ctop returns or initializes the row-, column- or all- broadcast 00038 * or combine topologies. 00039 * 00040 * Arguments 00041 * ========= 00042 * 00043 * ICTXT (local input) INTEGER 00044 * On entry, ICTXT specifies the BLACS context handle, indica- 00045 * ting the global context of the operation. The context itself 00046 * is global, but the value of ICTXT is local. 00047 * 00048 * OP (global input) pointer to CHAR 00049 * On input, OP specifies the BLACS operation defined as fol- 00050 * lows: 00051 * OP = 'B' or 'b', BLACS broadcast operation, 00052 * OP = 'C' or 'c', BLACS combine operation. 00053 * 00054 * SCOPE (global input) pointer to CHAR 00055 * On entry, SCOPE specifies the scope of the BLACS operation as 00056 * follows: 00057 * SCOPE = 'R' or 'r', rowwise broadcast or combine, 00058 * SCOPE = 'C' or 'c', column broadcast or combine, 00059 * SCOPE = 'A' or 'a', all broadcast or combine. 00060 * 00061 * TOP (global input) pointer to CHAR 00062 * On entry, TOP is a character string specifying the BLACS to- 00063 * pology to be used i.e. to be set for the given operation spe- 00064 * cified by OP and SCOPE. If TOP = TOP_GET, the routine instead 00065 * returns the current topology in use for the given operation 00066 * specified by OP and SCOPE. 00067 * 00068 * -- Written on April 1, 1998 by 00069 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA. 00070 * 00071 * --------------------------------------------------------------------- 00072 */ 00073 /* 00074 * .. Local Scalars .. 00075 */ 00076 static char rbtop = CTOP_DEFAULT; 00077 static char cbtop = CTOP_DEFAULT; 00078 static char abtop = CTOP_DEFAULT; 00079 static char rctop = CTOP_DEFAULT; 00080 static char cctop = CTOP_DEFAULT; 00081 static char actop = CTOP_DEFAULT; 00082 /* .. 00083 * .. Executable Statements .. 00084 * 00085 */ 00086 /* 00087 * This BLACS topology information should be cached within a BLACS context. 00088 * This will be corrected in the near future. Sorry. 00089 */ 00090 if( *OP == CBCAST ) 00091 { 00092 /* 00093 * BLACS broadcast operations 00094 */ 00095 if( *TOP == CTOP_GET ) 00096 { 00097 /* 00098 * retrieve the current topology in SCOPE 00099 */ 00100 if( *SCOPE == CROW ) { return( &rbtop ); } 00101 else if( *SCOPE == CCOLUMN ) { return( &cbtop ); } 00102 else { return( &abtop ); } 00103 } 00104 else 00105 { 00106 /* 00107 * set the topology to be used from now on in SCOPE 00108 */ 00109 if( *SCOPE == CROW ) { rbtop = *TOP; return( &rbtop ); } 00110 else if( *SCOPE == CCOLUMN ) { cbtop = *TOP; return( &cbtop ); } 00111 else { abtop = *TOP; return( &abtop ); } 00112 } 00113 } 00114 else 00115 { 00116 /* 00117 * BLACS combine operations 00118 */ 00119 if( *TOP == CTOP_GET ) 00120 { 00121 /* 00122 * retrieve the current topology in SCOPE 00123 */ 00124 if( *SCOPE == CROW ) { return( &rctop ); } 00125 else if( *SCOPE == CCOLUMN ) { return( &cctop ); } 00126 else { return( &actop ); } 00127 } 00128 else 00129 { 00130 /* 00131 * set the topology to be used from now on in SCOPE 00132 */ 00133 if( *SCOPE == CROW ) { rctop = *TOP; return( &rctop ); } 00134 else if( *SCOPE == CCOLUMN ) { cctop = *TOP; return( &cctop ); } 00135 else { actop = *TOP; return( &actop ); } 00136 } 00137 } 00138 /* 00139 * End of PB_Ctop 00140 */ 00141 }