ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cwarn.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_Cwarn( int ICTXT, int LINE, char * ROUT, char * FORM, ... )
62 #else
63 void PB_Cwarn( va_alist )
64 va_dcl
65 #endif
66 {
67 /*
68 * Purpose
69 * =======
70 *
71 * PB_Cwarn is an error handler for the PBLAS routines. This routine
72 * displays an error message on stderr.
73 *
74 * Arguments
75 * =========
76 *
77 * ICTXT (local input) INTEGER
78 * On entry, ICTXT specifies the BLACS context handle, indica-
79 * ting the global context of the operation. The context itself
80 * is global, but the value of ICTXT is local.
81 *
82 * LINE (local input) INTEGER
83 * On entry, LINE specifies the line number in the file where
84 * the error has occured. When LINE is not a valid line number,
85 *
86 * ROUT (global input) pointer to CHAR
87 * On entry, ROUT specifies the name of the routine calling this
88 * error handler.
89 *
90 * FORM (local input) pointer to CHAR
91 * On entry, FORM is a control string specifying the format
92 * conversion of its following arguments.
93 *
94 * ... (local input)
95 * On entry, FORM is a control string specifying the format
96 * On entry, the expressions that are to be evaluated and con-
97 * verted according to the formats in the control string FORM
98 * and then placed in the output stream.
99 *
100 * -- Written on April 1, 1998 by
101 * R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
102 *
103 * ---------------------------------------------------------------------
104 */
105  va_list argptr;
106  int iam, mycol, myrow, npcol, nprow;
107  char cline[100];
108 /* ..
109 * .. External Functions ..
110 */
111 #ifdef TestingPblas
112 #ifdef __STDC__
113  int PB_NoAbort( int * );
114 #else
115  int PB_NoAbort();
116 #endif
117 #endif
118 
119 #ifdef __STDC__
120  va_start( argptr, FORM );
121 #else
122  char * ROUT, * FORM;
123  int ICTXT, LINE;
124 /* ..
125 * .. Executable Statements ..
126 *
127 */
128  va_start( argptr );
129  ICTXT = va_arg( argptr, int );
130  LINE = va_arg( argptr, int );
131  ROUT = va_arg( argptr, char * );
132  FORM = va_arg( argptr, char * );
133 #endif
134 
135 #ifdef TestingPblas
136 /*
137 * For testing purpose only, the error is reported, but the program execution
138 * is not terminated
139 */
140  if( PB_NoAbort( &ICTXT ) ) return;
141 #endif
142  vsprintf( cline, FORM, argptr );
143  va_end( argptr );
144 
145  Cblacs_gridinfo( ICTXT, &nprow, &npcol, &myrow, &mycol );
146 
147  if( nprow != -1 ) iam = Cblacs_pnum( ICTXT, myrow, mycol );
148  else iam = -1;
149 /*
150 * Display an error message
151 */
152  if( LINE <= 0 )
153  (void) fprintf( stderr, "%s'%s'\n%s{%d,%d}, %s%d, %s%d%s'%s'.\n\n",
154  "PBLAS ERROR ", cline, "from ", myrow, mycol, "pnum=",
155  iam, "Contxt=", ICTXT, ", in routine ", ROUT );
156  else
157  (void) fprintf( stderr, "%s'%s'\n%s{%d,%d}, %s%d, %s%d%s%d%s'%s'.\n\n",
158  "PBLAS ERROR ", cline, "from ", myrow, mycol, "pnum=",
159  iam, "Contxt=", ICTXT, ", on line ", LINE,
160  " of routine ", ROUT );
161 /*
162 * End of PB_Cwarn
163 */
164 }
PB_NoAbort
#define PB_NoAbort
Definition: PB_Cwarn.c:48
Cblacs_pnum
int Cblacs_pnum()
PB_Cwarn
void PB_Cwarn(va_alist)
Definition: PB_Cwarn.c:63
Cblacs_gridinfo
void Cblacs_gridinfo()