BLACS_GRIDINFO error, grid position not assigned

Posted:
Mon Feb 28, 2011 4:37 pm
by astroud
I'm getting an error while trying to create a distributed matrices in fortran. I'm only getting through these two lines:
CALL BLACS_GET( 0, 0, icontext )
CALL BLACS_GRIDINIT( icontext, 'R', NPROW, NPCOL)
then it stalls on this next line:
CALL BLACS_GRIDINFO( icontext, NPROW, NPCOL, MYROW, MYCOL)
As I understand it, the BLACS_GRIDINFO does not actually have a purpose other than a check step. I tried to run the program with that line commented out, and then printing NPROW, NPCOL, MYROW,MYCOL, and it returns this sixteen times "4 4 10935 1715184624". Its like the processors are not assigning a grid position. Or am I misunderstanding this error? Any ideas you have would be welcome and greatly appreciated!!!
Re: BLACS_GRIDINFO error, grid position not assigned

Posted:
Mon Feb 28, 2011 5:58 pm
by admin
Hi below is a BLACS example.
I believe some of your variables were not set correctly.
Hope it helps
Julie
- Code: Select all
PROGRAM HELLO
* -- BLACS example code --
* Written by Clint Whaley 7/26/94
* Performs a simple check-in type hello world
* ..
* .. External Functions ..
INTEGER BLACS_PNUM
EXTERNAL BLACS_PNUM
* ..
* .. Variable Declaration ..
INTEGER CONTXT, IAM, NPROCS, NPROW, NPCOL, MYPROW, MYPCOL
INTEGER ICALLER, I, J, HISROW, HISCOL
*
* Determine my process number and the number of processes in
* machine
*
CALL BLACS_PINFO(IAM, NPROCS)
*
* Set up process grid that is as close to square as possible
*
NPROW = INT( SQRT( REAL(NPROCS) ) )
NPCOL = NPROCS / NPROW
*
* Get default system context, and define grid
*
CALL BLACS_GET(0, 0, CONTXT)
CALL BLACS_GRIDINIT(CONTXT, 'Row', NPROW, NPCOL)
CALL BLACS_GRIDINFO(CONTXT, NPROW, NPCOL, MYPROW, MYPCOL)
*
* If I'm not in grid, go to end of program
*
IF ( (MYPROW.GE.NPROW) .OR. (MYPCOL.GE.NPCOL) ) GOTO 30
*
* Get my process ID from my grid coordinates
*
ICALLER = BLACS_PNUM(CONTXT, MYPROW, MYPCOL)
*
* If I am process {0,0}, receive check-in messages from
* all nodes
*
IF ( (MYPROW.EQ.0) .AND. (MYPCOL.EQ.0) ) THEN
WRITE(*,*) ' '
DO 20 I = 0, NPROW-1
DO 10 J = 0, NPCOL-1
IF ( (I.NE.0) .OR. (J.NE.0) ) THEN
CALL IGERV2D(CONTXT, 1, 1, ICALLER, 1, I, J)
ENDIF
*
* Make sure ICALLER is where we think in process grid
*
CALL BLACS_PCOORD(CONTXT, ICALLER, HISROW, HISCOL)
IF ( (HISROW.NE.I) .OR. (HISCOL.NE.J) ) THEN
WRITE(*,*) 'Grid error! Halting . . .'
STOP
END IF
WRITE(*, 3000) I, J, ICALLER
10 CONTINUE
20 CONTINUE
WRITE(*,*) ' '
WRITE(*,*) 'All processes checked in. Run finished.'
*
* All processes but {0,0} send process ID as a check-in
*
ELSE
CALL IGESD2D(CONTXT, 1, 1, ICALLER, 1, 0, 0)
END IF
30 CONTINUE
CALL BLACS_EXIT(0)
1000 FORMAT('How many processes in machine?')
2000 FORMAT(I2)
3000 FORMAT('Process {',i2,',',i2,'} (node number =',I2,
$ ') has checked in.')
STOP
END