<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=561544021-13072006><FONT face=Arial
color=#0000ff size=2>The displs array should be 0, 2, 4. Then you will get the
correct answer. Displacement means the displacement from the starting address of
the buffer in units of the extent of the datatype, as described by the
MPI_Recv(recvbuf + disp[i]*extent(recvtype), ...) in the definition of
MPI_Gatherv.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=561544021-13072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=561544021-13072006><FONT face=Arial
color=#0000ff size=2>Rajeev</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=561544021-13072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> owner-mpich-discuss@mcs.anl.gov
[mailto:owner-mpich-discuss@mcs.anl.gov] <B>On Behalf Of </B>Andrew
Hakman<BR><B>Sent:</B> Thursday, July 13, 2006 3:58 PM<BR><B>To:</B>
mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> [MPICH] mpiallgatherv in
fortran<BR></FONT><BR></DIV>
<DIV></DIV>Hi<BR><BR>I'm using MPICH <A href="http://1.2.5.2">1.2.5.2</A>, and
the portland group fortran compiler.<BR><BR>I'm having some issues with
mpiallgatherv.<BR><BR>The first issue, is I can't seem to find any
documentation about the details of the displacement array - in fortran, should
the first displacement be 1 or 0 (I suspect it should be 1 from testing, but I
can't get the results I'm expecting from either 1 or 0 - see
below).<BR><BR>The second bigger issue, is I'm expecting the parts that are
gathered from the various processes should be assembled in process order -
this does not seem to happen. Probably the best way to illustrate what I'm
really getting at is with a small test program I wrote and it's output, and
what I'm expecting as output.<BR><BR>Here's the testprogram and header
file<BR>//////mpicoms.h///////<BR>include 'mpif.h'<BR>integer m_rank,
m_size,status(MPI_STATUS_SIZE),mpi_err<BR>common/MPIBLK/m_rank,m_size,mpi_err<BR><BR>/////mpitestallgatherv.for/////<BR>
PROGRAM mpitest<BR> implicit
none<BR> include
'mpicoms.h'<BR><BR> integer mydata(2,1),
alldata(2,3)<BR> integer
recvcnts(3)<BR> integer
displs(3)<BR>
recvcnts(1)=2<BR>
recvcnts(2)=2<BR>
recvcnts(3)=2<BR>
displs(1)=1<BR>
displs(2)=3<BR>
displs(3)=5<BR> CALL
MPI_INIT(mpi_err)<BR> call
MPI_COMM_SIZE(MPI_COMM_WORLD, m_size,
mpi_err)<BR> call MPI_COMM_RANK(MPI_COMM_WORLD,
m_rank, mpi_err)<BR>
mydata(1,1)=m_rank+5<BR>
mydata(2,1)=m_rank+6<BR>
<BR> call MPI_ALLGATHERV(mydata, 2, MPI_INTEGER,
alldata, recvcnts, displs,<BR> *MPI_INTEGER,
MPI_COMM_WORLD, mpi_err)<BR> call
MPI_FINALIZE(mpi_err)<BR> write(*,*) "this is
node ", m_rank<BR> write(*,*) "mydata
="<BR> write(*,*)
mydata(1,1)<BR> write(*,*)
mydata(2,1)<BR> write(*,*)
"alldata="<BR> write(*,*) mydata(1,1),'
',mydata(1,2),' ',mydata(1,3)<BR> write(*,*)
mydata(2,1),' ',mydata(2,2),' ',mydata(2,3)<BR>
stop<BR> end<BR><BR>The output I receive from
running this on 3 processors (of which this little test is rather hardcoded
for) is the following (with some rearrangement and adjusted spacing for
readability):<BR><BR> this is node 0<BR> mydata
=<BR>
5<BR>
6<BR> alldata=<BR>
5
5
6<BR>
6
6
7<BR><BR> this is node 1<BR> mydata
=<BR>
6<BR>
7<BR> alldata=<BR>
6
5
6<BR>
7
6
7<BR><BR> this is node 2<BR> mydata
=<BR>
7<BR>
8<BR> alldata=<BR>
7
5
6<BR>
8
6
7<BR><BR><BR>What I'm expecting is alldata on all 3 processes should look like
this<BR> alldata=<BR>
5 6
7<BR> 6
7
8<BR><BR>i.e. be in process order (of course keeping in mind that arrays are
column major in fortran), and not duplicated.<BR><BR>Am I doing something
wrong? Is this not the output I should be expecting from allgatherv?<BR><BR>I
also know that allgatherv isn't necessary with this example because all of the
processes send the same number of entries, but the real program I'm working
on, that isn't the case and the vector version of the call is
needed.<BR><BR>Thanks<BR>Andrew Hakman<BR></BLOCKQUOTE></BODY></HTML>