[mpich-discuss] Sending a pointer from one processor to other processor:
Francisco Javier García Blas
fjblas at arcos.inf.uc3m.es
Wed May 12 01:16:53 CDT 2010
HI,
Given, MPI_Irecv(profit,n/nprocs,MPI_DOUBLE,0,tag,MPI_COMM_WORLD,&status);
I wonder if you allocated memory in order to receive "profit".
profit = malloc (n/nprocs * sizeof(double));
El 11/05/2010, a las 19:33, Pavan Balaji escribió:
>
> MPI_Irecv needs to have a corresponding MPI_Wait. In your application, it might be easier to just replace it with MPI_Recv(), instead of MPI_Irecv().
>
> -- Pavan
>
> On 05/11/2010 11:58 AM, sankar s wrote:
>> 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
>> ------------------------------------------------------------------------
>> _______________________________________________
>> mpich-discuss mailing list
>> mpich-discuss at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
> --
> Pavan Balaji
> http://www.mcs.anl.gov/~balaji
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
--------------------------------------------------
Francisco Javier García Blas
Computer Architecture, Communications and Systems Area.
Computer Science Department. UNIVERSIDAD CARLOS III DE MADRID
Avda. de la Universidad, 30
28911 Leganés (Madrid), SPAIN
e-mail: fjblas at arcos.inf.uc3m.es
fjblas at inf.uc3m.es
Phone:(+34) 916249118
FAX: (+34) 916249129
--------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20100512/0d9fa7c7/attachment-0001.htm>
More information about the mpich-discuss
mailing list