[mpich-discuss] Sending a pointer from one processor to other processor:

sankar s keanesankar at gmail.com
Tue May 11 11:58:36 CDT 2010


Hi,
In the below code am trying to send an array from one processor to other
processor.But  Its giving error. I don't understand why its coming! pls help
me in this.
(This code is working well without MPI_Send and MPI_Irecv statements).

int main(int argc, char*argv[]){
double *simulateRuns(int, int, int, int);
double simulateOneRun(int,int,int);
void stat(double *,int);

   int nprocs;             /* number of processes */
   int rank,tag=1;    /* the unique identification of this process */
   long int before,after;
   double * profit1,* profit2,* profit;
   int n=500,m=20000,s=80,S=200;
   MPI_Status status;
   before=GetTickCount();

  MPI_Init (&argc, &argv);
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);
  MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
  printf("rank=%d  nproc=%d\n",rank,nprocs);

  if (rank==0){
   profit1=simulateRuns(n/nprocs,m,s,S);
   stat(profit1,n/2);
  MPI_Send(profit1,n/nprocs,MPI_DOUBLE,1,tag,MPI_COMM_WORLD);
  }

  if(rank==1){
   profit2=simulateRuns(n/nprocs,m,s,S);
   stat(profit2,n/2);
   MPI_Irecv(profit,n/nprocs,MPI_DOUBLE,0,tag,MPI_COMM_WORLD,&status);
  }

   MPI_Finalize ();
   after=GetTickCount();
   printf("time elapsed=%ld\n",(after-before));
}


/* OUTPUT*/

C:\Users\Sankar\My Documents\visual studio
2008\Projects\Inventorympi\Debug>mpie
xec -n 2 Inventorympi.exe
Fatal error in MPI_Finalize: Other MPI error, error stack:
MPI_Finalize(318).........................: MPI_Finalize failed
MPI_Finalize(211).........................:
MPID_Finalize(92).........................:
PMPI_Barrier(476).........................: MPI_Barrier(comm=0x44000002)
failed
MPIR_Barrier(82)..........................:
MPIC_Sendrecv(164)........................:
MPIC_Wait(513)............................:
MPIDI_CH3i_Progress_wait(215).............: an error occurred while handling
an
event returned by MPIDU_Sock_Wait()
MPIDI_CH3I_Progress_handle_sock_event(420):
MPIDU_Sock_wait(2606).....................: The specified network name is no
lon
ger available. (errno 64)
Fatal error in MPI_Recv: Other MPI error, error stack:
MPI_Recv(187).............................: MPI_Recv(buf=CCCCCCCC,
count=250, MP
I_DOUBLE, src=0, tag=1, MPI_COMM_WORLD, status=0023F920) failed
MPIDI_CH3i_Progress_wait(215).............: an error occurred while handling
an
event returned by MPIDU_Sock_Wait()
MPIDI_CH3I_Progress_handle_sock_event(455):
adjust_iov(825)...........................: ch3|sock|immedread 00566358
008B0FE8
 00FC0048
MPIDU_Sock_readv(2750)....................: An established connection was
aborte
d by the software in your host machine. (errno 10053)


Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20100511/ccbe9592/attachment.htm>


More information about the mpich-discuss mailing list