ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cabort.c
Go to the documentation of this file.
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 #ifdef TestingPblas
00014 #include "../SRC/pblas.h"
00015 #include "../SRC/PBpblas.h"
00016 #include "../SRC/PBtools.h"
00017 #include "../SRC/PBblacs.h"
00018 #include "../SRC/PBblas.h"
00019 #else
00020 #include "../pblas.h"
00021 #include "../PBpblas.h"
00022 #include "../PBtools.h"
00023 #include "../PBblacs.h"
00024 #include "../PBblas.h"
00025 #endif
00026 
00027 /*
00028 *  ---------------------------------------------------------------------
00029 *  FORTRAN <-> C interface
00030 *  ---------------------------------------------------------------------
00031 *
00032 *  These macros identifies how the PBLAS will be called as follows:
00033 *
00034 *  _F2C_ADD_: the FORTRAN compiler expects the name of C functions to be
00035 *  in all lower case and to have an underscore postfixed it (Suns, Intel
00036 *  compilers expect this).
00037 *
00038 *  _F2C_NOCHANGE: the FORTRAN compiler expects the name of  C  functions
00039 *  to be in all lower case (IBM RS6K compilers do this).
00040 *
00041 *  _F2C_UPCASE: the  FORTRAN  compiler expects the name of  C  functions
00042 *  to be in all upcase. (Cray compilers expect this).
00043 *
00044 *  _F2C_F77ISF2C: the  FORTRAN  compiler in use is f2c, a  FORTRAN  to C
00045 *  converter.
00046 */
00047 #if (_F2C_CALL_ == _F2C_ADD_ )
00048 #define PB_NoAbort pb_noabort_
00049 #endif
00050 #if (_F2C_CALL_ == _F2C_UPCASE )
00051 #define PB_NoAbort PB_NOABORT
00052 #endif
00053 #if (_F2C_CALL_ == _F2C_NOCHANGE )
00054 #define PB_NoAbort pb_noabort
00055 #endif
00056 #if (_F2C_CALL_ == _F2C_F77ISF2C )
00057 #define PB_NoAbort pb_noabort__
00058 #endif
00059 
00060 #ifdef __STDC__
00061 void PB_Cabort( int ICTXT, char * ROUT, int INFO )
00062 #else
00063 void PB_Cabort( ICTXT, ROUT, INFO )
00064 /*
00065 *  .. Scalar Arguments ..
00066 */
00067    int            ICTXT, INFO;
00068 /*
00069 *  .. Array Arguments ..
00070 */
00071    char           * ROUT;
00072 #endif
00073 {
00074 /*
00075 *  Purpose
00076 *  =======
00077 *
00078 *  PB_Cabort is an error handler for the PBLAS  routines.  This  routine
00079 *  displays an error message on  stderr  by calling  PB_Cwarn, and halts
00080 *  execution by calling Cblacs_abort().
00081 *
00082 *  Arguments
00083 *  =========
00084 *
00085 *  ICTXT   (local input) INTEGER
00086 *          On entry,  ICTXT  specifies the BLACS context handle, indica-
00087 *          ting the global  context of the operation. The context itself
00088 *          is global, but the value of ICTXT is local.
00089 *
00090 *  ROUT    (global input) pointer to CHAR
00091 *          On entry, ROUT specifies the name of the routine calling this
00092 *          error handler.
00093 *
00094 *  INFO    (local input) INTEGER
00095 *          The error code computed by the calling PBLAS routine.
00096 *          = 0:  no error found
00097 *          < 0:  If the  i-th  argument is an array and the j-entry  had
00098 *                an illegal value, then  INFO = -(i*100+j),  if the i-th
00099 *                argument  is  a  scalar  and had an illegal value, then
00100 *                INFO = -i.
00101 *
00102 *  -- Written on April 1, 1998 by
00103 *     R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
00104 *
00105 *  ---------------------------------------------------------------------
00106 */
00107 /*
00108 *  .. Local Scalars ..
00109 */
00110    int            mycol, myrow, npcol, nprow;
00111 /* ..
00112 *  .. External Functions ..
00113 */
00114 #ifdef TestingPblas
00115 #ifdef __STDC__
00116    int            PB_NoAbort( int * );
00117 #else
00118    int            PB_NoAbort();
00119 #endif
00120 #endif
00121 /* ..
00122 *  .. Executable Statements ..
00123 *
00124 */
00125    Cblacs_gridinfo( ICTXT, &nprow, &npcol, &myrow, &mycol );
00126 #ifdef TestingPblas
00127 /*
00128 *  For testing purpose only, the error is reported, but the program execution
00129 *  is not terminated
00130 */
00131    if( PB_NoAbort( &INFO ) ) return;
00132 #endif
00133    if( INFO < 0 )
00134    {
00135 /*
00136 *  Display an error message
00137 */
00138       if( INFO < DESCMULT )
00139          PB_Cwarn( ICTXT, -1, ROUT,
00140                    "Parameter number %d had an illegal value", -INFO );
00141       else
00142          PB_Cwarn( ICTXT, -1, ROUT,
00143                    "Parameter number %d, entry number %d had an illegal value",
00144                    (-INFO) / DESCMULT, (-INFO) % DESCMULT );
00145    }
00146    else
00147    {
00148 /*
00149 *  Error code is incorrect, it should be negative
00150 */
00151       PB_Cwarn( ICTXT, -1, ROUT,
00152                 "Positive error code %d returned by %s!!!", INFO );
00153    }
00154    Cblacs_abort( ICTXT, INFO );
00155 /*
00156 *  End of PB_Cabort
00157 */
00158 }