<div>Hi,</div><div> Thank you for immediate reply.</div><div>Now I used malloc for creating space for pointer profit and also used MPI_Recv instead of MPI_Irecv.Now its not giving any error.</div><div>But instead of passing profit1 (MPI_DOUBLE), its passing only zeros. pls don't mind for asking some easy questions like this. am very new to this.</div>
<div><br></div><div>/*CODE*/</div><div><div>int main(int argc, char*argv[]){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>double *simulateRuns(int, int, int, int);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>double simulateOneRun(int,int,int);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>void stat(double *,int);</div><div><br></div><div> int nprocs;<span class="Apple-tab-span" style="white-space:pre">                        </span> /* number of processes */</div>
<div> int rank,tag=1,i;<span class="Apple-tab-span" style="white-space:pre">                        </span> /* the unique identification of this process */</div><div> long int before,after;</div><div> double * profit1,* profit2,* profit;</div>
<div> int n=10,m=20000,s=80,S=200;</div><div> MPI_Status status;</div><div> before=GetTickCount();</div><div><br></div><div> MPI_Init (&argc, &argv);</div><div> MPI_Comm_rank (MPI_COMM_WORLD, &rank);</div>
<div> MPI_Comm_size (MPI_COMM_WORLD, &nprocs);</div><div> printf("rank=%d nproc=%d\n",rank,nprocs);</div><div> if (rank==0){</div><div> profit1=simulateRuns(n/nprocs,m,s,S);</div><div> stat(profit1,n/2);</div>
<div> MPI_Send(profit1,n/nprocs,MPI_DOUBLE,1,tag,MPI_COMM_WORLD);</div><div> }</div><div> if(rank==1){</div><div> profit2=simulateRuns(n/nprocs,m,s,S);</div><div> stat(profit2,n/2);</div><div> profit1 = malloc (n/nprocs * sizeof(double));</div>
<div> MPI_Recv(profit,n/nprocs,MPI_DOUBLE,0,tag,MPI_COMM_WORLD,&status);</div><div> stat(profit,n/2);</div><div> }</div><div> MPI_Finalize ();</div><div> after=GetTickCount();</div><div> printf("time elapsed=%ld\n",(after-before));</div>
<div>}</div><div>/*OUTPUT*/</div></div><div><br></div><div>C:\Users\Sankar\My Documents\visual studio 2008\Projects\Inventorympi\Debug>mpie</div><div>xec -n 2 Inventorympi.exe</div><div>rank=1 nproc=2</div><div>65.145380</div>
<div>64.170140</div><div>64.402515</div><div>65.238190</div><div>64.651180</div><div>stats on profit</div><div>num.obs min max average std.dev</div><div> 5 64.170140 65.238190 64.721481 0.231481</div>
<div>0.000000</div><div>0.000000</div><div>0.000000</div><div>0.000000</div><div>0.000000</div><div>stats on profit</div><div>num.obs min max average std.dev</div><div> 5 0.000000 0.000000 0.000000 0.000000</div>
<div>time elapsed=266</div><div>rank=0 nproc=2</div><div>65.145380</div><div>64.170140</div><div>64.402515</div><div>65.238190</div><div>64.651180</div><div>stats on profit</div><div>num.obs min max average std.dev</div>
<div> 5 64.170140 65.238190 64.721481 0.231481</div><div>time elapsed=188</div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thank you
</blockquote></div><br>