ScaLAPACK Archives

[Scalapack] blacs_pcoord


Hello,

1- Just a remark, in theory, you should not call MPI_INIT from your main
    program in Fortran.
    For your code you should replace the 3 following lines by

         CALL MPI_INIT(INFO)
         CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPROCS, INFO)
         CALL MPI_COMM_RANK(MPI_COMM_WORLD, IPROC,  INFO)

    by

        CALL BLACS_PINFO(IPROC, NPROCS)

    now ... if you want to interoperability between MPI and BLACS and do
    some fancy stuff, this is possible. It is definetely easier in C. In
    Fortran there are some SYS2BLACS_HANDLE and BLACS2SYS_HANDLE routines.
    See:
      http://www.netlib.org/blacs/mpiblacs_issues.ps
    But the best is to avoid this kind of business if possible.

2- good point.
    seems like BLACS_PCOORD only work for Row major grid ...
    (see line 367 of BLACS--MPICH/SRC/MPI/Bdef.h)

    if you use
         CALL BLACS_GRIDINIT( ICNTXT, 'ROW', NPROW, NPCOL )
    instead of
         CALL BLACS_GRIDINIT( ICNTXT, 'COL', NPROW, NPCOL )
    everything will work fine

   if you use ORDER='COL' then you are right rows and columns are swapped.

   I am not sure this is what I would have expected from BLACS_PCOORD

So not very conclusive, I'll try to come back with more information.
Julien



On Tue, 14 Mar 2006, HuiZhong LU wrote:


Hello,

Here is the output of a simple program which
compare just the result of blacs_gridinfo and
blacs_pcoord, the simple code (fotran 90) is
following the output (running with 4 proc).
I have checked on several platforms:
the results of blacs_pcoord is not correct.

regards,

HuiZhong


---------------------------------------------------
iproc,myrow,mycol(gridinfo)=  0  0  0
iproc,myrow,mycol(gridinfo)=  1  1  0
iproc,myrow,mycol(gridinfo)=  3  1  1
iproc,myrow,mycol(gridinfo)=  2  0  1
iproc,RDEST,CDEST(pcoord)=  0  0  0
iproc,RDEST,CDEST(pcoord)=  1  0  1
iproc,RDEST,CDEST(pcoord)=  2  1  0
iproc,RDEST,CDEST(pcoord)=  3   1  1

==========================
program test_psamax
implicit none
include "mpif.h"
  INTEGER     :: iproc, nprocs, info
  INTEGER     :: nprow, npcol
  INTEGER     :: icntxt
  INTEGER     :: myrow, mycol
  integer :: i,j, rdest, cdest
!--------------------------------------
  call mpi_init(info)
  Call MPI_COMM_SIZE(mpi_comm_world, nprocs, info)
  Call MPI_COMM_RANK(mpi_comm_world, iproc,  info)
  !call blacs_pinfo(iproc, nprocs)

  NPCOL = INT( sqrt( float(nprocs) ) )
  NPROW = nprocs / NPCOL
  call blacs_get(0, 0, icntxt)
  CALL blacs_gridinit( icntxt, 'COL', NPROW, NPCOL )
  call blacs_gridinfo(icntxt, nprow, npcol, myrow, mycol)
  write(6,'(A,3I3)') 'iproc,myrow,mycol(gridinfo)=',iproc,myrow,mycol
  if( (myrow<0 .and. myrow>=nprow) .or.   &
      (mycol<0 .and. mycol>=npcol) ) goto 100

  do i = 0, nprocs-1
      CALL blacs_pcoord( icntxt, i, RDEST, CDEST ) !! error in blacs_pcoord
      if( iproc==0 ) write(6,'(A,3I3)') 
'iproc,RDEST,CDEST(pcoord)=',i,RDEST,CDEST
  enddo
100 continue
  CALL MPI_BARRIER( mpi_comm_world, info )

end program



Julien Langou wrote:


Hello,
no no

The documentation is correct. For blacs_pcoord:

PROW
    (output) INTEGER.
    On output, the row coordinate of process PNUM in the BLACS grid.
PCOL
    (output) INTEGER.
    On output, the column coordinate of process PNUM in the BLACS grid.

Maybe test out the program 'Hello World' at:
http://www.netlib.org/blacs/BLACS/Examples.html

It basically checks in a few lines blacs_pcoord

Julien


On Thu, 9 Mar 2006, HuiZhong LU wrote:


Hello,


I find an error in blacs_pcoord( icntxt, pnum, prow, pcol ).
The real result is:
   prow is the columns number of pnum in the grid
   pcol is the row number of pnum in the grid


Regards,


HuiZhong LU

Univ. of Sherbrooke
Quebec, Canada
_______________________________________________
Scalapack mailing list
Scalapack@Domain.Removed
http://lists.cs.utk.edu/listinfo/scalapack





<Prev in Thread] Current Thread [Next in Thread>


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or