Check your arguments to the Send and Recv calls; I think you'll be
enlightened...
(and use consistent indenting; it will make your code *much* easier
to read)
:-)
On Jun 19, 2007, at 4:58 AM, Chandan Shikhar Dua wrote:
> if (rank==0) {
> for(unsigned j=1; j<p; j++){
> cout<<endl<<"Hi I am inside send
> "<<j<<"
> of rank 0"<<endl;
> unsigned nblks=1;unsigned begin2=2;
> unsigned l2=3;
> // unsigned nblks = partition[j
> +1]-partition[j];
> // blcluster* bllist1 = bllist
> +partition[j];
> //dimx(bllist1, nblks, begin2,
> l2); // starting index and length of vector x to be sent
> unsigned index1[] = {l2, nblks, begin2};
> MPI::COMM_WORLD.Send(index1, 3,
> MPI::UNSIGNED, 4, j);
> }
> }
> else {
> cout<<endl<<"Hi I am inside receive of rank
> "<<rank<<endl;
> unsigned index1[3];
> MPI::COMM_WORLD.Recv(index1, 3, MPI::UNSIGNED,4 , 0);
> cout<<endl<<"I a mou t<<"<<endl;
> }
> MPI::Finalize();
>
>
>
> I have written this simple code and it gets stuck or held
> giving the response as below
>
> Please help me out wat could be the problem
>
>
>
>
>
>
> Hi this is my rank: 1
>
> Hi I am 1
>
> Hi I am inside receive of rank 1
> Hi this is my rank: 0
>
> Hi I am inside send 1 of rank 0
>
> Hi I am inside send 2 of rank 0
>
> Hi I am inside send 3 of rank 0
>
> Hi I am inside send 4 of rank 0
>
> Hi I am inside send 5 of rank 0
>
> Hi I am inside send 6 of rank 0
>
> Hi I am inside send 7 of rank 0
> Hi this is my rank: 4
>
> Hi I am 4
>
> Hi I am inside receive of rank 4
> Hi this is my rank: 7
>
> Hi I am 7
>
> Hi I am inside receive of rank 7
> Hi this is my rank: 5
>
> Hi I am 5
>
> Hi I am inside receive of rank 5
> Hi this is my rank: 6
>
> Hi I am 6
>
> Hi I am inside receive of rank 6
> Hi this is my rank: 2
>
> Hi I am 2
>
> Hi I am inside receive of rank 2
> Hi this is my rank: 3
>
> Hi I am 3
>
> Hi I am inside receive of rank 3
>
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
--
Jeff Squyres
Cisco Systems
|