1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
/* ---------------------------------------------------------------------
*
* -- PBLAS auxiliary routine (version 2.0) --
* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
* and University of California, Berkeley.
* April 1, 1998
*
* ---------------------------------------------------------------------
*/
/*
* Include files
*/
#include "../pblas.h"
#include "../PBpblas.h"
#include "../PBtools.h"
#include "../PBblacs.h"
#include "../PBblas.h"
#ifdef __STDC__
char * PB_Ctop( int * ICTXT, char * OP, char * SCOPE, char * TOP )
#else
char * PB_Ctop( ICTXT, OP, SCOPE, TOP )
/*
* .. Scalar Arguments ..
*/
int * ICTXT;
/*
* .. Array Arguments ..
*/
char * OP, * SCOPE, * TOP;
#endif
{
/*
* Purpose
* =======
*
* PB_Ctop returns or initializes the row-, column- or all- broadcast
* or combine topologies.
*
* Arguments
* =========
*
* ICTXT (local input) INTEGER
* On entry, ICTXT specifies the BLACS context handle, indica-
* ting the global context of the operation. The context itself
* is global, but the value of ICTXT is local.
*
* OP (global input) pointer to CHAR
* On input, OP specifies the BLACS operation defined as fol-
* lows:
* OP = 'B' or 'b', BLACS broadcast operation,
* OP = 'C' or 'c', BLACS combine operation.
*
* SCOPE (global input) pointer to CHAR
* On entry, SCOPE specifies the scope of the BLACS operation as
* follows:
* SCOPE = 'R' or 'r', rowwise broadcast or combine,
* SCOPE = 'C' or 'c', column broadcast or combine,
* SCOPE = 'A' or 'a', all broadcast or combine.
*
* TOP (global input) pointer to CHAR
* On entry, TOP is a character string specifying the BLACS to-
* pology to be used i.e. to be set for the given operation spe-
* cified by OP and SCOPE. If TOP = TOP_GET, the routine instead
* returns the current topology in use for the given operation
* specified by OP and SCOPE.
*
* -- Written on April 1, 1998 by
* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
*
* ---------------------------------------------------------------------
*/
/*
* .. Local Scalars ..
*/
static char rbtop = CTOP_DEFAULT;
static char cbtop = CTOP_DEFAULT;
static char abtop = CTOP_DEFAULT;
static char rctop = CTOP_DEFAULT;
static char cctop = CTOP_DEFAULT;
static char actop = CTOP_DEFAULT;
/* ..
* .. Executable Statements ..
*
*/
/*
* This BLACS topology information should be cached within a BLACS context.
* This will be corrected in the near future. Sorry.
*/
if( *OP == CBCAST )
{
/*
* BLACS broadcast operations
*/
if( *TOP == CTOP_GET )
{
/*
* retrieve the current topology in SCOPE
*/
if( *SCOPE == CROW ) { return( &rbtop ); }
else if( *SCOPE == CCOLUMN ) { return( &cbtop ); }
else { return( &abtop ); }
}
else
{
/*
* set the topology to be used from now on in SCOPE
*/
if( *SCOPE == CROW ) { rbtop = *TOP; return( &rbtop ); }
else if( *SCOPE == CCOLUMN ) { cbtop = *TOP; return( &cbtop ); }
else { abtop = *TOP; return( &abtop ); }
}
}
else
{
/*
* BLACS combine operations
*/
if( *TOP == CTOP_GET )
{
/*
* retrieve the current topology in SCOPE
*/
if( *SCOPE == CROW ) { return( &rctop ); }
else if( *SCOPE == CCOLUMN ) { return( &cctop ); }
else { return( &actop ); }
}
else
{
/*
* set the topology to be used from now on in SCOPE
*/
if( *SCOPE == CROW ) { rctop = *TOP; return( &rctop ); }
else if( *SCOPE == CCOLUMN ) { cctop = *TOP; return( &cctop ); }
else { actop = *TOP; return( &actop ); }
}
}
/*
* End of PB_Ctop
*/
}
|