<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>RE: [mpich-discuss] Problem sometimes when running on winxp on &gt;=2 processes and MPE_IBCAST</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>&nbsp;Hi,<BR>
&nbsp; Please find my observations below,<BR>
<BR>
1) As Anthony pointed out you don't have to call MPI_Barrier() in a loop for all processes (see usage of MPI collectives).<BR>
2) When running the program with more than 4 procs, some array accesses are out of bounds (Try re-compiling your program with Run time checking for &quot;Array and String bounds&quot; --&gt; If you are using VS check out &quot;Configuration Properties&quot; --&gt; Fortran --&gt; Runtime --&gt; * for setting the runtime checking)<BR>
<BR>
Regards,<BR>
Jayesh<BR>
<BR>
-----Original Message-----<BR>
From: owner-mpich-discuss@mcs.anl.gov [<A HREF="mailto:owner-mpich-discuss@mcs.anl.gov">mailto:owner-mpich-discuss@mcs.anl.gov</A>] On Behalf Of Anthony Chan<BR>
Sent: Wednesday, May 07, 2008 11:13 AM<BR>
To: mpich-discuss@mcs.anl.gov<BR>
Subject: Re: [mpich-discuss] Problem sometimes when running on winxp on &gt;=2 processes and MPE_IBCAST<BR>
<BR>
<BR>
May not be related to the error that you saw.&nbsp; You shouldn't call MPI_Barrier and MPI_Bcast with a do loop over processes.<BR>
<BR>
A.Chan<BR>
----- &quot;Ben Tay&quot; &lt;zonexo@gmail.com&gt; wrote:<BR>
<BR>
&gt; Hi Rajeev,<BR>
&gt;<BR>
&gt; I've attached the code. Thank you very much.<BR>
&gt;<BR>
&gt; Regards.<BR>
&gt;<BR>
&gt; Rajeev Thakur wrote:<BR>
&gt; &gt; Can you send us the code?<BR>
&gt; &gt;<BR>
&gt; &gt; MPE_IBCAST is not a part of the MPI standard. There is no equivalent<BR>
&gt; for it<BR>
&gt; &gt; in MPICH2. You could spawn a thread that calls MPI_Bcast though<BR>
&gt; (after<BR>
&gt; &gt; following all the caveats of MPI and threads as defined in the<BR>
&gt; standard).<BR>
&gt; &gt;<BR>
&gt; &gt; Rajeev<BR>
&gt; &gt;<BR>
&gt; &gt;&nbsp;&nbsp;<BR>
&gt; &gt;&gt; -----Original Message-----<BR>
&gt; &gt;&gt; From: owner-mpich-discuss@mcs.anl.gov<BR>
&gt; &gt;&gt; [<A HREF="mailto:owner-mpich-discuss@mcs.anl.gov">mailto:owner-mpich-discuss@mcs.anl.gov</A>] On Behalf Of Ben Tay<BR>
&gt; &gt;&gt; Sent: Wednesday, May 07, 2008 10:25 AM<BR>
&gt; &gt;&gt; To: mpich-discuss@mcs.anl.gov<BR>
&gt; &gt;&gt; Subject: [mpich-discuss] Problem sometimes when running on winxp on<BR>
&gt; &gt;&gt; &gt;=2 processes and MPE_IBCAST<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Hi,<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; I tried to run a mpi code which is copied from an example by the RS<BR>
&gt; &gt;&gt; 6000 book. It is supposed to broadcast and synchronize all values.<BR>
&gt; &gt;&gt; When I ran it on my school's linux servers, there is no problem.<BR>
&gt; &gt;&gt; However, if I run it on my own winxp, on &gt;=2 processes, sometimes<BR>
&gt; &gt;&gt; it work, other times I get the error:<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; [01:3216].....ERROR:result command received but the wait_list is<BR>
&gt; &gt;&gt; empty.<BR>
&gt; &gt;&gt; [01:3216]...ERROR:unable to handle the command: &quot;cmd=result<BR>
&gt; &gt;&gt; src=1 dest=1<BR>
&gt; &gt;&gt; tag=7 c<BR>
&gt; &gt;&gt; md_tag=3 cmd_orig=dbget ctx_key=1 value=&quot;port=1518<BR>
&gt; &gt;&gt; description=gotchama-16e5ed i<BR>
&gt; &gt;&gt; fname=192.168.1.105 &quot; result=DBS_SUCCESS &quot;<BR>
&gt; &gt;&gt; [01:3216].ERROR:error closing the unknown context socket:<BR>
&gt; &gt;&gt; generic socket failure , error stack:<BR>
&gt; &gt;&gt; MPIDU_Sock_wait(2603): The I/O operation has been aborted because<BR>
&gt; &gt;&gt; of either a th read exit or an application request.<BR>
&gt; &gt;&gt; (errno 995) [01:3216]..ERROR:sock_op_close returned while unknown<BR>
&gt; &gt;&gt; context is in<BR>
&gt; &gt;&gt; state: SMPD_<BR>
&gt; &gt;&gt; IDLE<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Or<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; [01:3308].....ERROR:result command received but the wait_list is<BR>
&gt; &gt;&gt; empty.<BR>
&gt; &gt;&gt; [01:3308]...ERROR:unable to handle the command: &quot;cmd=result<BR>
&gt; &gt;&gt; src=1 dest=1<BR>
&gt; &gt;&gt; tag=15<BR>
&gt; &gt;&gt; cmd_tag=5 cmd_orig=barrier ctx_key=0 result=DBS_SUCCESS &quot;<BR>
&gt; &gt;&gt; [01:3308]..ERROR:sock_op_close returned while unknown context is<BR>
&gt; in<BR>
&gt; &gt;&gt; state: SMPD_<BR>
&gt; &gt;&gt; IDLE<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; There is no problem if I run on 1 process. If it's &gt;=4, then the<BR>
&gt; &gt;&gt; error happens all the time. Moreover, it's a rather simple code and<BR>
&gt; &gt;&gt; so there shouldn't be anything wrong with it.<BR>
&gt; &gt;&gt; Why is this so?<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Btw, the RS 6000 book also mention a routine called MPE_IBCAST,<BR>
&gt; &gt;&gt; which is a non-blocking version of MPI_BCAST. Is there a similar<BR>
&gt; &gt;&gt; routine in MPICH2?<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Thank you very much<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Regards.<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt; &gt;<BR>
&gt; &gt;<BR>
&gt; &gt;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt;<BR>
&gt; program mpi_test2<BR>
&gt;<BR>
&gt; !&nbsp;&nbsp;&nbsp;&nbsp; test to show updating for i,j double loop (partial continuous data)<BR>
&gt; for specific req data only<BR>
&gt;<BR>
&gt; !&nbsp;&nbsp;&nbsp;&nbsp; ie update u(2:6,2:6) values instead of all u values, also for struct<BR>
&gt; data<BR>
&gt;<BR>
&gt; !&nbsp;&nbsp;&nbsp;&nbsp; FVM use<BR>
&gt;<BR>
&gt; implicit none<BR>
&gt;<BR>
&gt; include &quot;mpif.h&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; integer, parameter :: size_x=8,size_y=8<BR>
&gt;<BR>
&gt; integer :: i,j,k,ierr,rank,nprocs,u(size_x,size_y)<BR>
&gt;<BR>
&gt; integer :: jsta,jend,jsta2,jend1,inext,iprev,isend1,irecv1,isend2<BR>
&gt;<BR>
&gt; integer :: irecv2,is,ie,js,je<BR>
&gt;<BR>
&gt; integer, allocatable :: jjsta(:), jjlen(:),jjreq(:),u_tmp(:,:)<BR>
&gt;<BR>
&gt; INTEGER istatus(MPI_STATUS_SIZE)<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; call MPI_Init(ierr)<BR>
&gt;<BR>
&gt; call MPI_Comm_rank(MPI_COMM_WORLD,rank,ierr)<BR>
&gt;&nbsp;&nbsp;<BR>
&gt; call MPI_Comm_size(MPI_COMM_WORLD,nprocs,ierr)<BR>
&gt;<BR>
&gt; allocate (jjsta(0:nprocs-1),jjlen(0:nprocs-1),jjreq(0:nprocs-1))<BR>
&gt;<BR>
&gt; is=3; ie=6;&nbsp;&nbsp; js=3;&nbsp;&nbsp; je=6<BR>
&gt;<BR>
&gt; allocate (u_tmp(is:ie,js:je))<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; do k = 0, nprocs - 1<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call para_range(js,je, nprocs, k, jsta, jend)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jjsta(k) = jsta<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jjlen(k) = (ie-is+1) * (jend - jsta + 1)<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt; call para_range(js, je, nprocs, rank , jsta, jend)<BR>
&gt;<BR>
&gt; do j=jsta,jend<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do i=is,ie<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u(i,j)=(j-1)*size_x+i<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end do<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt; do j=jsta,jend<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do i=is,ie<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u_tmp(i,j)=u(i,j)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end do<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt; do k=0,nprocs-1<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call MPI_Barrier(MPI_COMM_WORLD,ierr)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (k==rank) then<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print *, rank<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write (*,'(8i5)') u<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt; do k = 0, nprocs - 1<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call MPI_BCAST(u_tmp(is,jjsta(k)), jjlen(k), MPI_Integer,k,<BR>
&gt; MPI_COMM_WORLD, ierr)<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; deallocate (jjsta, jjlen, jjreq)<BR>
&gt;<BR>
&gt; u(is:ie,js:je)=u_tmp(is:ie,js:je)<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; do k=0,nprocs-1<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call MPI_Barrier(MPI_COMM_WORLD,ierr)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (k==rank) then<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print *, rank<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write (*,'(8i5)') u<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>
&gt;<BR>
&gt; end do<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; call MPI_Finalize(ierr)<BR>
&gt;<BR>
&gt; contains<BR>
&gt;<BR>
&gt; subroutine para_range(n1, n2, nprocs, irank, ista, iend)<BR>
&gt; !&nbsp;&nbsp;&nbsp;&nbsp; block distribution<BR>
&gt;<BR>
&gt; integer n1 !The lowest value of the iteration variable (IN)<BR>
&gt;<BR>
&gt; integer n2 !The highest value of the iteration variable (IN)<BR>
&gt;<BR>
&gt; integer nprocs !The number of processes (IN)<BR>
&gt;<BR>
&gt; integer irank !The rank for which you want to know the range of<BR>
&gt; iterations(IN)<BR>
&gt;<BR>
&gt; integer ista !The lowest value of the iteration variable that process<BR>
&gt; irank executes (OUT)<BR>
&gt;<BR>
&gt; integer iend !The highest value of the iteration variable that process<BR>
&gt; irank executes (OUT)<BR>
&gt;<BR>
&gt; integer iwork1,iwork2<BR>
&gt;<BR>
&gt; iwork1 = (n2 - n1 + 1) / nprocs<BR>
&gt;<BR>
&gt; iwork2 = mod(n2 - n1 + 1, nprocs)<BR>
&gt;<BR>
&gt; ista = irank * iwork1 + n1 + min(irank, iwork2)<BR>
&gt;<BR>
&gt; iend = ista + iwork1 - 1<BR>
&gt;<BR>
&gt; if (iwork2 &gt; irank) iend = iend + 1<BR>
&gt;<BR>
&gt; end subroutine para_range<BR>
&gt;<BR>
&gt; end program mpi_test2<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>