1 SUBROUTINE pdlaread( FILNAM, A, DESCA, IRREAD, ICREAD, WORK )
11 INTEGER ICREAD, IRREAD
16 DOUBLE PRECISION A( * ), WORK( * )
34 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DT_,
35 $ LLD_, MB_, M_, NB_, N_, RSRC_
36 parameter( block_cyclic_2d = 1, dlen_ = 9, dt_ = 1,
37 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
38 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
41 INTEGER H, I, IB, ICTXT, ICURCOL, ICURROW, II, J, JB,
42 $ JJ, K, LDA, M, MYCOL, MYROW, N, NPCOL, NPROW
48 EXTERNAL blacs_gridinfo,
infog2l, dgerv2d, dgesd2d,
62 ictxt = desca( ctxt_ )
63 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
65 IF( myrow.EQ.irread .AND. mycol.EQ.icread )
THEN
66 OPEN( nin, file=filnam, status=
'OLD' )
67 READ( nin, fmt = * ) ( iwork( i ), i = 1, 2 )
68 CALL igebs2d( ictxt,
'All',
' ', 2, 1, iwork, 2 )
70 CALL igebr2d( ictxt,
'All',
' ', 2, 1, iwork, 2, irread,
76 IF( m.LE.0 .OR. n.LE.0 )
79 IF( m.GT.desca( m_ ).OR. n.GT.desca( n_ ) )
THEN
80 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
81 WRITE( *, fmt = * )
'PDLAREAD: Matrix too big to fit in'
82 WRITE( *, fmt = * )
'Abort ...'
84 CALL blacs_abort( ictxt, 0 )
89 icurrow = desca( rsrc_ )
90 icurcol = desca( csrc_ )
95 DO 50 j = 1, n, desca( nb_ )
96 jb =
min( desca( nb_ ), n-j+1 )
101 DO 30 i = 1, m, desca( mb_ )
102 ib =
min( desca( mb_ ), m-i+1 )
103 IF( icurrow.EQ.irread .AND. icurcol.EQ.icread )
THEN
104 IF( myrow.EQ.irread .AND. mycol.EQ.icread )
THEN
106 READ( nin, fmt = * ) a( ii+k+(jj+h-1)*lda )
110 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
111 CALL dgerv2d( ictxt, ib, 1, a( ii+(jj+h-1)*lda ),
112 $ lda, irread, icread )
113 ELSE IF( myrow.EQ.irread .AND. mycol.EQ.icread )
THEN
115 READ( nin, fmt = * ) work( k )
117 CALL dgesd2d( ictxt, ib, 1, work, desca( mb_ ),
121 IF( myrow.EQ.icurrow )
123 icurrow = mod( icurrow+1, nprow )
127 icurrow = desca( rsrc_ )
130 IF( mycol.EQ.icurcol )
132 icurcol = mod( icurcol+1, npcol )
136 IF( myrow.EQ.irread .AND. mycol.EQ.icread )
THEN