LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: David Singleton (David.Singleton_at_[hidden])
Date: 2005-09-23 18:21:37


Collectives like MPI_Allreduce must be called by ALL processes within
the communicator used. You are calling it from within a conditional.
Will that conditional be true for all processes eventually? If not,
those processes that do call MPI_Allreduce() it will hang.

Maybe you want something like:

   for(i=1; i=Nx; x++)
   {
      if(condition met) CONDITION = 1;
      MPI_Allreduce(&CONDITION,&CONDITION,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
      if(CONDITION == 1) break;
   }

Ravi R. Kumar wrote:
> Hello Everyone,
>
> I am having problem in implementing loop break condition in my C++/MPI code.
> Here is the code I want to implement:
>
> CONDITION = 0;
> for(n=1; n<=Nt; n++)
> {
>
> for(i=1; i=Nx; x++)
> if(condition met)
> {
> CONDITION = 1;
> MPI_Allreduc(&CONDITION,&CONDITION,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
> }
>
> if(CONDITION == 1) break;
>
> }
>
> When I execute my code with this implementation, it hangs and terminates with
> error. The error I got is:
>
> srun: interrupt (one more within 1 sec to abort)
> srun: task0: running
> srun: interrupt (one more within 1 sec to abort)
> srun: task[0-5]: running
> srun: error: node1: task0: Exited with exit code 130
> srun: sending Ctrl-C to job
>
> Could anyone please point out mistake in my implementation? I would appericate
> any help.
>
> Thanks a lot,
> Ravi Kumar
> Looking forward to hearing from you.
>
> Thanks,
>

-- 
--------------------------------------------------------------------------
    Dr David Singleton               ANU Supercomputer Facility
    HPC Systems Manager              and APAC National Facility
    David.Singleton_at_[hidden]       Leonard Huxley Bldg (No. 56)
    Phone: +61 2 6125 4389           Australian National University
    Fax:   +61 2 6125 8199           Canberra, ACT, 0200, Australia
--------------------------------------------------------------------------