List Info

Thread: LAM: question




LAM: question
country flaguser name
Germany
2007-06-19 03:58:13
 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.l
am-mpi.org/MailArchives/lam/

Re: LAM: question
country flaguser name
United States
2007-06-19 05:39:59
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.l
am-mpi.org/MailArchives/lam/


-- 
Jeff Squyres
Cisco Systems

_______________________________________________
This list is archived at http://www.l
am-mpi.org/MailArchives/lam/

Re: LAM: question
user name
2007-06-19 08:54:15

hi there

thanx
yes just after sending the mail i had seen the error


also can suggest me some online material for handling send for "structures " in c++ .

Regards

chandan shikhar dua

On 6/19/07, Jeff Squyres < jsquyrescisco.com">jsquyrescisco.com> wrote:
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:

> &nbsp;if (rank==0) {
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; for(unsigned j=1; j<p; j++){
>  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; cout<&lt;endl<&lt;"Hi I am inside send
> "<<j<&lt;"
&gt; of rank 0"<;<endl;
; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  unsigned nblks=1;unsigned begin2=2;
> unsigned l2=3;
>  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; // &nbsp;unsigned nblks = partition[j
> +1]-partition[j];
>; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; // &nbsp;blcluster* bllist1 = bllist
&gt; +partition[j];
>&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; //dimx(bllist1, nblks, begin2,
&gt; l2);   ; &nbsp; &nbsp; &nbsp; &nbsp; // starting index and length of vector x to be sent
>&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; unsigned index1[] = {l2, nblks, begin2};
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  MPI::COMM_WORLD.Send(index1, 3,
> MPI::UNSIGNED, 4, j);
>&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  }
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; }
>&nbsp; &nbsp; &nbsp; &nbsp;   ;else {
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; cout<&lt;endl<&lt;"Hi I am inside receive of rank
>; "<<rank<;<endl;
> &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; unsigned index1[3];
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; MPI::COMM_WORLD.Recv(index1, 3, MPI::UNSIGNED,4 , 0);
>&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   cout<&lt;endl<&lt;"I a mou t<<&quot;<&lt;endl;
&gt; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  }
>&nbsp; &nbsp; &nbsp; &nbsp;  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
>
>
&gt;
>
&gt;
>
>; 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   ; &nbsp; &nbsp; 1&nbsp;   ; &nbsp; &nbsp; of rank 0
>
&gt; Hi I am inside send   ; &nbsp; &nbsp; 2&nbsp;   ; &nbsp; &nbsp; of rank 0
>
>; Hi I am inside send   ; &nbsp; &nbsp; 3&nbsp;   ; &nbsp; &nbsp; of rank 0
>
>; Hi I am inside send   ; &nbsp; &nbsp; 4&nbsp;   ; &nbsp; &nbsp; of rank 0
>
>; Hi I am inside send   ; &nbsp; &nbsp; 5&nbsp;   ; &nbsp; &nbsp; of rank 0
>
&gt; Hi I am inside send   ; &nbsp; &nbsp; 6&nbsp;   ; &nbsp; &nbsp; of rank 0
>
>; Hi I am inside send   ; &nbsp; &nbsp; 7&nbsp;   ; &nbsp; &nbsp; 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
>
&gt; 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
>
&gt; 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

_______________________________________________
This list is archived at http://www.lam-mpi.org/MailArchives/lam/

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )