ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cabort.c
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * ---------------------------------------------------------------------
9 */
10 /*
11 * Include files
12 */
13 #ifdef TestingPblas
14 #include "../SRC/pblas.h"
15 #include "../SRC/PBpblas.h"
16 #include "../SRC/PBtools.h"
17 #include "../SRC/PBblacs.h"
18 #include "../SRC/PBblas.h"
19 #else
20 #include "../pblas.h"
21 #include "../PBpblas.h"
22 #include "../PBtools.h"
23 #include "../PBblacs.h"
24 #include "../PBblas.h"
25 #endif
26 
27 /*
28 * ---------------------------------------------------------------------
29 * FORTRAN <-> C interface
30 * ---------------------------------------------------------------------
31 *
32 * These macros identifies how the PBLAS will be called as follows:
33 *
34 * _F2C_ADD_: the FORTRAN compiler expects the name of C functions to be
35 * in all lower case and to have an underscore postfixed it (Suns, Intel
36 * compilers expect this).
37 *
38 * _F2C_NOCHANGE: the FORTRAN compiler expects the name of C functions
39 * to be in all lower case (IBM RS6K compilers do this).
40 *
41 * _F2C_UPCASE: the FORTRAN compiler expects the name of C functions
42 * to be in all upcase. (Cray compilers expect this).
43 *
44 * _F2C_F77ISF2C: the FORTRAN compiler in use is f2c, a FORTRAN to C
45 * converter.
46 */
47 #if (_F2C_CALL_ == _F2C_ADD_ )
48 #define PB_NoAbort pb_noabort_
49 #endif
50 #if (_F2C_CALL_ == _F2C_UPCASE )
51 #define PB_NoAbort PB_NOABORT
52 #endif
53 #if (_F2C_CALL_ == _F2C_NOCHANGE )
54 #define PB_NoAbort pb_noabort
55 #endif
56 #if (_F2C_CALL_ == _F2C_F77ISF2C )
57 #define PB_NoAbort pb_noabort__
58 #endif
59 
60 #ifdef __STDC__
61 void PB_Cabort( int ICTXT, char * ROUT, int INFO )
62 #else
63 void PB_Cabort( ICTXT, ROUT, INFO )
64 /*
65 * .. Scalar Arguments ..
66 */
67  int ICTXT, INFO;
68 /*
69 * .. Array Arguments ..
70 */
71  char * ROUT;
72 #endif
73 {
74 /*
75 * Purpose
76 * =======
77 *
78 * PB_Cabort is an error handler for the PBLAS routines. This routine
79 * displays an error message on stderr by calling PB_Cwarn, and halts
80 * execution by calling Cblacs_abort().
81 *
82 * Arguments
83 * =========
84 *
85 * ICTXT (local input) INTEGER
86 * On entry, ICTXT specifies the BLACS context handle, indica-
87 * ting the global context of the operation. The context itself
88 * is global, but the value of ICTXT is local.
89 *
90 * ROUT (global input) pointer to CHAR
91 * On entry, ROUT specifies the name of the routine calling this
92 * error handler.
93 *
94 * INFO (local input) INTEGER
95 * The error code computed by the calling PBLAS routine.
96 * = 0: no error found
97 * < 0: If the i-th argument is an array and the j-entry had
98 * an illegal value, then INFO = -(i*100+j), if the i-th
99 * argument is a scalar and had an illegal value, then
100 * INFO = -i.
101 *
102 * -- Written on April 1, 1998 by
103 * R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
104 *
105 * ---------------------------------------------------------------------
106 */
107 /*
108 * .. Local Scalars ..
109 */
110  int mycol, myrow, npcol, nprow;
111 /* ..
112 * .. External Functions ..
113 */
114 #ifdef TestingPblas
115 #ifdef __STDC__
116  int PB_NoAbort( int * );
117 #else
118  int PB_NoAbort();
119 #endif
120 #endif
121 /* ..
122 * .. Executable Statements ..
123 *
124 */
125  Cblacs_gridinfo( ICTXT, &nprow, &npcol, &myrow, &mycol );
126 #ifdef TestingPblas
127 /*
128 * For testing purpose only, the error is reported, but the program execution
129 * is not terminated
130 */
131  if( PB_NoAbort( &INFO ) ) return;
132 #endif
133  if( INFO < 0 )
134  {
135 /*
136 * Display an error message
137 */
138  if( INFO < DESCMULT )
139  PB_Cwarn( ICTXT, -1, ROUT,
140  "Parameter number %d had an illegal value", -INFO );
141  else
142  PB_Cwarn( ICTXT, -1, ROUT,
143  "Parameter number %d, entry number %d had an illegal value",
144  (-INFO) / DESCMULT, (-INFO) % DESCMULT );
145  }
146  else
147  {
148 /*
149 * Error code is incorrect, it should be negative
150 */
151  PB_Cwarn( ICTXT, -1, ROUT,
152  "Positive error code %d returned by %s!!!", INFO );
153  }
154  Cblacs_abort( ICTXT, INFO );
155 /*
156 * End of PB_Cabort
157 */
158 }
PB_Cwarn
void PB_Cwarn()
PB_NoAbort
#define PB_NoAbort
Definition: PB_Cabort.c:48
Cblacs_abort
void Cblacs_abort()
Cblacs_gridinfo
void Cblacs_gridinfo()
DESCMULT
#define DESCMULT
Definition: PBtools.h:68
PB_Cabort
void PB_Cabort(int ICTXT, char *ROUT, int INFO)
Definition: PB_Cabort.c:63