SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pb_schekpad()

subroutine pb_schekpad ( integer  ictxt,
character*(*)  mess,
integer  m,
integer  n,
real, dimension( * )  a,
integer  lda,
integer  ipre,
integer  ipost,
real  chkval 
)

Definition at line 9192 of file psblastst.f.

9194*
9195* -- PBLAS test routine (version 2.0) --
9196* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
9197* and University of California, Berkeley.
9198* April 1, 1998
9199*
9200* .. Scalar Arguments ..
9201 INTEGER ICTXT, IPOST, IPRE, LDA, M, N
9202 REAL CHKVAL
9203* ..
9204* .. Array Arguments ..
9205 CHARACTER*(*) MESS
9206 REAL A( * )
9207* ..
9208*
9209* Purpose
9210* =======
9211*
9212* PB_SCHEKPAD checks that the padding around a local array has not been
9213* overwritten since the call to PB_SFILLPAD. Three types of errors are
9214* reported:
9215*
9216* 1) Overwrite in pre-guardzone. This indicates a memory overwrite has
9217* occurred in the first IPRE elements which form a buffer before the
9218* beginning of A. Therefore, the error message:
9219* 'Overwrite in pre-guardzone: loc( 5) = 18.00000'
9220* tells that the 5th element of the IPRE long buffer has been overwrit-
9221* ten with the value 18, where it should still have the value CHKVAL.
9222*
9223* 2) Overwrite in post-guardzone. This indicates a memory overwrite has
9224* occurred in the last IPOST elements which form a buffer after the end
9225* of A. Error reports are refered from the end of A. Therefore,
9226* 'Overwrite in post-guardzone: loc( 19) = 24.00000'
9227* tells that the 19th element after the end of A was overwritten with
9228* the value 24, where it should still have the value of CHKVAL.
9229*
9230* 3) Overwrite in lda-m gap. Tells you elements between M and LDA were
9231* overwritten. So,
9232* 'Overwrite in lda-m gap: A( 12, 3) = 22.00000'
9233* tells that the element at the 12th row and 3rd column of A was over-
9234* written with the value of 22, where it should still have the value of
9235* CHKVAL.
9236*
9237* Arguments
9238* =========
9239*
9240* ICTXT (local input) INTEGER
9241* On entry, ICTXT specifies the BLACS context handle, indica-
9242* ting the global context of the operation. The context itself
9243* is global, but the value of ICTXT is local.
9244*
9245* MESS (local input) CHARACTER*(*)
9246* On entry, MESS is a ttring containing a user-defined message.
9247*
9248* M (local input) INTEGER
9249* On entry, M specifies the number of rows in the local array
9250* A. M must be at least zero.
9251*
9252* N (local input) INTEGER
9253* On entry, N specifies the number of columns in the local ar-
9254* ray A. N must be at least zero.
9255*
9256* A (local input) REAL array
9257* On entry, A is an array of dimension (LDA,N).
9258*
9259* LDA (local input) INTEGER
9260* On entry, LDA specifies the leading dimension of the local
9261* array to be padded. LDA must be at least MAX( 1, M ).
9262*
9263* IPRE (local input) INTEGER
9264* On entry, IPRE specifies the size of the guard zone to put
9265* before the start of the padded array.
9266*
9267* IPOST (local input) INTEGER
9268* On entry, IPOST specifies the size of the guard zone to put
9269* after the end of the padded array.
9270*
9271* CHKVAL (local input) REAL
9272* On entry, CHKVAL specifies the value to pad the array with.
9273*
9274*
9275* -- Written on April 1, 1998 by
9276* R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
9277*
9278* =====================================================================
9279*
9280* .. Local Scalars ..
9281 CHARACTER*1 TOP
9282 INTEGER I, IAM, IDUMM, INFO, J, K, MYCOL, MYROW, NPCOL,
9283 $ NPROW
9284* ..
9285* .. External Subroutines ..
9286 EXTERNAL blacs_gridinfo, igamx2d, pb_topget
9287* ..
9288* .. Executable Statements ..
9289*
9290* Get grid parameters
9291*
9292 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
9293 iam = myrow*npcol + mycol
9294 info = -1
9295*
9296* Check buffer in front of A
9297*
9298 IF( ipre.GT.0 ) THEN
9299 DO 10 i = 1, ipre
9300 IF( a( i ).NE.chkval ) THEN
9301 WRITE( *, fmt = 9998 ) myrow, mycol, mess, ' pre', i,
9302 $ a( i )
9303 info = iam
9304 END IF
9305 10 CONTINUE
9306 ELSE
9307 WRITE( *, fmt = * ) 'WARNING no pre-guardzone in PB_SCHEKPAD'
9308 END IF
9309*
9310* Check buffer after A
9311*
9312 IF( ipost.GT.0 ) THEN
9313 j = ipre+lda*n+1
9314 DO 20 i = j, j+ipost-1
9315 IF( a( i ).NE.chkval ) THEN
9316 WRITE( *, fmt = 9998 ) myrow, mycol, mess, 'post',
9317 $ i-j+1, a( i )
9318 info = iam
9319 END IF
9320 20 CONTINUE
9321 ELSE
9322 WRITE( *, fmt = * )
9323 $ 'WARNING no post-guardzone buffer in PB_SCHEKPAD'
9324 END IF
9325*
9326* Check all (LDA-M) gaps
9327*
9328 IF( lda.GT.m ) THEN
9329 k = ipre + m + 1
9330 DO 40 j = 1, n
9331 DO 30 i = k, k + (lda-m) - 1
9332 IF( a( i ).NE.chkval ) THEN
9333 WRITE( *, fmt = 9997 ) myrow, mycol, mess,
9334 $ i-ipre-lda*(j-1), j, a( i )
9335 info = iam
9336 END IF
9337 30 CONTINUE
9338 k = k + lda
9339 40 CONTINUE
9340 END IF
9341*
9342 CALL pb_topget( ictxt, 'Combine', 'All', top )
9343 CALL igamx2d( ictxt, 'All', top, 1, 1, info, 1, idumm, idumm, -1,
9344 $ 0, 0 )
9345 IF( iam.EQ.0 .AND. info.GE.0 ) THEN
9346 WRITE( *, fmt = 9999 ) info / npcol, mod( info, npcol ), mess
9347 END IF
9348*
9349 9999 FORMAT( '{', i5, ',', i5, '}: Memory overwrite in ', a )
9350 9998 FORMAT( '{', i5, ',', i5, '}: ', a, ' memory overwrite in ',
9351 $ a4, '-guardzone: loc(', i3, ') = ', g11.4 )
9352 9997 FORMAT( '{', i5, ',', i5, '}: ', a, ' memory overwrite in ',
9353 $ 'lda-m gap: loc(', i3, ',', i3, ') = ', g11.4 )
9354*
9355 RETURN
9356*
9357* End of PB_SCHEKPAD
9358*
Here is the caller graph for this function: