ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
pichekpad.f
Go to the documentation of this file.
00001       SUBROUTINE PICHEKPAD( ICTXT, MESS, M, N, A, LDA, IPRE, IPOST,
00002      $                     CHKVAL )
00003 *
00004 *  -- ScaLAPACK tools routine (version 1.7) --
00005 *     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
00006 *     and University of California, Berkeley.
00007 *     May 1, 1997
00008 *
00009 *     .. Scalar Arguments ..
00010       INTEGER            ICTXT, IPOST, IPRE, LDA, M, N
00011       INTEGER            CHKVAL
00012 *     ..
00013 *     .. Array Arguments ..
00014       CHARACTER          MESS*(*)
00015       INTEGER            A( * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  PICHEKPAD checks that the padding around a local array has not
00022 *  been overwritten since the call to PIFILLPAD.  3 types of errors
00023 *  are reported:
00024 *
00025 *  1) Overwrite in pre-guardzone. This indicates a memory overwrite has
00026 *  occurred in the first IPRE elements which form a buffer before the
00027 *  beginning of A.  Therefore, the error message:
00028 *     'Overwrite in  pre-guardzone: loc(  5) =         18.00000'
00029 *  tells you that the 5th element of the IPRE long buffer has been
00030 *  overwritten with the value 18, where it should still have the value
00031 *  of CHKVAL.
00032 *
00033 *  2) Overwrite in post-guardzone. This indicates a memory overwrite has
00034 *  occurred in the last IPOST elements which form a buffer after the end
00035 *  of A. Error reports are refered from the end of A.  Therefore,
00036 *     'Overwrite in post-guardzone: loc( 19) =         24.00000'
00037 *  tells you that the 19th element after the end of A was overwritten
00038 *  with the value 24, where it should still have the value of CHKVAL.
00039 *
00040 *  3) Overwrite in lda-m gap.  Tells you elements between M and LDA were
00041 *  overwritten.  So,
00042 *     'Overwrite in lda-m gap: A( 12,  3) =         22.00000'
00043 *  tells you that the element at the 12th row and 3rd column of A was
00044 *  overwritten with the value of 22, where it should still have the
00045 *  value of CHKVAL.
00046 *
00047 *  Arguments
00048 *  =========
00049 *
00050 *  ICTXT   (global input) INTEGER
00051 *          The BLACS context handle, indicating the global context of
00052 *          the operation. The context itself is global.
00053 *
00054 *  MESS    (local input) CHARACTER*(*)
00055 *          String containing a user-defined message.
00056 *
00057 *  M       (local input) INTEGER
00058 *          The number of rows in the local array A.
00059 *
00060 *  N       (input) INTEGER
00061 *          The number of columns in the local array A.
00062 *
00063 *  A       (local input) @(typec) array of dimension (LDA,N).
00064 *          A location IPRE elements in front of the array to be checked.
00065 *
00066 *  LDA     (local input) INTEGER
00067 *          The leading Dimension of the local array to be checked.
00068 *
00069 *  IPRE    (local input) INTEGER
00070 *          The size of the guard zone before the start of padded array.
00071 *
00072 *  IPOST   (local input) INTEGER
00073 *          The size of guard zone after the padded array.
00074 *
00075 *  CHKVAL  (local input) @(typec)
00076 *          The value the local array was padded with.
00077 *
00078 *  =====================================================================
00079 *
00080 *     .. Local Scalars ..
00081       INTEGER            I, IAM, IDUMM, INFO, J, K, MYCOL, MYROW,
00082      $                   NPCOL, NPROW
00083 *     ..
00084 *     .. External Subroutines ..
00085       EXTERNAL           BLACS_GRIDINFO, IGAMX2D
00086 *     ..
00087 *     .. Executable Statements ..
00088 *
00089 *     Get grid parameters
00090 *
00091       CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
00092       IAM = MYROW*NPCOL + MYCOL
00093       INFO = -1
00094 *
00095 *     Check buffer in front of A
00096 *
00097       IF( IPRE.GT.0 ) THEN
00098          DO 10 I = 1, IPRE
00099             IF( A( I ).NE.CHKVAL ) THEN
00100                WRITE( *, FMT = 9998 ) MYROW, MYCOL, MESS, ' pre', I,
00101      $                                A( I )
00102                INFO = IAM
00103             END IF
00104    10    CONTINUE
00105       ELSE
00106          WRITE( *, FMT = * ) 'WARNING no pre-guardzone in PICHEKPAD'
00107       END IF
00108 *
00109 *     Check buffer after A
00110 *
00111       IF( IPOST.GT.0 ) THEN
00112          J = IPRE+LDA*N+1
00113          DO 20 I = J, J+IPOST-1
00114             IF( A( I ).NE.CHKVAL ) THEN
00115                WRITE( *, FMT = 9998 ) MYROW, MYCOL, MESS, 'post',
00116      $                                I-J+1, A( I )
00117                INFO = IAM
00118             END IF
00119    20    CONTINUE
00120       ELSE
00121          WRITE( *, FMT = * )
00122      $          'WARNING no post-guardzone buffer in PICHEKPAD'
00123       END IF
00124 *
00125 *     Check all (LDA-M) gaps
00126 *
00127       IF( LDA.GT.M ) THEN
00128          K = IPRE + M + 1
00129          DO 40 J = 1, N
00130             DO 30 I = K, K + (LDA-M) - 1
00131                IF( A( I ).NE.CHKVAL ) THEN
00132                   WRITE( *, FMT = 9997 ) MYROW, MYCOL, MESS,
00133      $               I-IPRE-LDA*(J-1), J, A( I )
00134                   INFO = IAM
00135                END IF
00136    30       CONTINUE
00137             K = K + LDA
00138    40    CONTINUE
00139       END IF
00140 *
00141       CALL IGAMX2D( ICTXT, 'All', ' ', 1, 1, INFO, 1, IDUMM, IDUMM, -1,
00142      $              0, 0 )
00143       IF( IAM.EQ.0 .AND. INFO.GE.0 ) THEN
00144          WRITE( *, FMT = 9999 ) INFO / NPCOL, MOD( INFO, NPCOL ), MESS
00145       END IF
00146 *
00147  9999 FORMAT( '{', I5, ',', I5, '}:  Memory overwrite in ', A )
00148  9998 FORMAT( '{', I5, ',', I5, '}:  ', A, ' memory overwrite in ',
00149      $        A4, '-guardzone: loc(', I3, ') = ', I8 )
00150  9997 FORMAT( '{', I5, ',', I5, '}: ', A, ' memory overwrite in ',
00151      $        'lda-m gap: loc(', I3, ',', I3, ') = ', I8 )
00152 *
00153       RETURN
00154 *
00155 *     End of PICHEKPAD
00156 *
00157       END