File: pberror_.c

package info (click to toggle)
scalapack 1.6-13
  • links: PTS
  • area: main
  • in suites: potato
  • size: 30,476 kB
  • ctags: 25,789
  • sloc: fortran: 296,718; ansic: 51,265; makefile: 1,541; sh: 4
file content (128 lines) | stat: -rw-r--r-- 3,311 bytes parent folder | download | duplicates (2)
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
/* ---------------------------------------------------------------------
*
*  -- ScaLAPACK routine (version 1.0) --
*     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
*     and University of California, Berkeley.
*     November 17, 1996
*
*  ---------------------------------------------------------------------
*/
/*
*  Include files
*/
#include "../SRC/pblas.h"

#if( _F2C_CALL_ == _F2C_ADD_ )
/*
* These defines set up the naming scheme required to have a FORTRAN
* routine call a C routine (which is what the PBLAS are written in).
* No redefinition necessary to have following FORTRAN to C interface:
*           FORTRAN CALL               C DECLARATION
*           call pdgemm(...)           void pdgemm_(...)
*
* This is the default.
*/

#endif

#if( _F2C_CALL_ == _F2C_UPCASE )
/*
* These defines set up the naming scheme required to have a FORTRAN
* routine call a C routine (which is what the PBLAS are written in)
* following FORTRAN to C interface:
*           FORTRAN CALL               C DECLARATION
*           call pdgemm(...)           void PDGEMM(...)
*/

#define geterr_           GETERR

#endif

#if( _F2C_CALL_ == _F2C_NOCHANGE )
/*
* These defines set up the naming scheme required to have a FORTRAN
* routine call a C routine (which is what the PBLAS are written in)
* for following FORTRAN to C interface:
*           FORTRAN CALL               C DECLARATION
*           call pdgemm(...)           void pdgemm(...)
*/

#define geterr_           geterr

#endif

void pberror_( ctxt, mess, einfo )
/*
*  .. Scalar Arguments ..
*/
   int         * ctxt, * einfo;
/* ..
*  .. Array Arguments ..
*/
   char        * mess;
{
/*
*  Purpose
*  =======
*
*  pberror_ is an error handler of the PBLAS routines, displays an error
*  message on stderr, and stops the running program. This is the tester
*  version.
*
* ======================================================================
*
*  .. Parameters ..
*/
#define DESCMULT      100
#define BIGNUM      10000
/* ..
*  .. Local Scalars ..
*/
   int         abrtflg, iinfo, mycol, myrow, npcol, nprow;
/* ..
*  .. External Functions ..
*/
   void        blacs_abort_();
   void        blacs_gridinfo_();
   F_VOID_FCT  geterr_();
/* ..
*  .. Executable Statements ..
*/ 

   geterr_( einfo, &abrtflg );

   if( abrtflg )
   {

      blacs_gridinfo_( ctxt, &nprow, &npcol, &myrow, &mycol );

      iinfo = *einfo;
      if( iinfo < 0 )
      {
         iinfo = -iinfo;
         if( iinfo < DESCMULT )
         {
            fprintf( stderr, "{%5d,%5d}: On entry to %s ", myrow, mycol,
                     mess );
            fprintf( stderr, "parameter number %2d had an illegal value\n",
                     iinfo );
         }
         else
         {
            fprintf( stderr, "{%5d,%5d}: On entry to %s ", myrow, mycol,
                     mess );
            fprintf( stderr, "parameter number %2d had an illegal value\n",
                     iinfo / DESCMULT );
            fprintf( stderr, "entry # %2d had an illegal value\n",
                     iinfo % DESCMULT );
         }
      }
      else
      {
         fprintf( stderr,
                  "{%5d,%5d}: Positive error code %2d returned by %s !!!\n",
                  myrow, mycol, iinfo, mess );
      }
      blacs_abort_( ctxt, &iinfo );
   }
}