Newsgroups: comp.parallel.mpi
From: eddemain@neumann.uwaterloo.ca (Erik Demaine)
Subject: Re: [Q]: How to terminate MPI for all processors?
Organization: University of Waterloo
Date: Fri, 29 Sep 1995 14:47:18 GMT
Message-ID: <DFo92u.nzJ@undergrad.math.uwaterloo.ca>

Chang-Hyeon Song (song@express.cs.purdue.edu) wrote:
: I am coding for hostless model.  I have to do some testing for a certain
: condition for rank 0, then if the condition is not met, I want to terminate
: MPI gracefully.  If I want to broadcast a certain message to call MPI_Finalize,
: but other host doesn't wait for it.

They should...  Something like

	if (myrank == 0 && should_die ())
	   flag = 1;
	else
	   flag = 0;
        MPI_Bcast (... flag ...);
	if (flag)
	   MPI_Finalize ();

Note that all processors must execute this code at the same time.

Erik
--
Erik Demaine                 \/  Masters student in Computer Science
Dept. of Computer Science    \/  e-mail: eddemain@neumann.uwaterloo.ca
University of Waterloo       \/  URL   : http://barrow.uwaterloo.ca/~eddemain/
Waterloo, ON Canada N2L 3G1  \/  <<< Space for sale >>>

