[mpich-discuss] first exit problems

Gideon Simpson gideon.simpson at gmail.com
Mon Jul 8 11:02:48 CDT 2013

Hi, I was wondering if someone had a good MPI solution to the following first passage problem.  Suppose I have N workers, each using a Monte Carlo method to solve a problem.  An example would be if I wanted to find the exit distribution in time and space of a stochastic differential equation from some compact set in space.  

Assuming that each worker is properly receiving an independent stream of pseudo random numbers, and they are computing asynchronously, when one worker finds a solution, he must notify the others that they can cease working, and the program can continue.  I have in mind something like:

while (!local_exit & !global_exit){

	/*Check if a message has been received*/

	/*If no one else finished, continue the algorithm */
		/* Step algorithm */
		local_exit = exit_test(...);

	/* Alert all other workers */

	/* Receive the message that was sent from the other worker */


However, I believe this leads to a race condition because if processor 0 finds and exit, processor 1 might also find one before processor 0 has a chance to do an MPI_Isend() to 1.  Assuming that, for the moment, I am not too concerned about tie breaking, I would really like to find a robust solution to this problem, as I have a lot of first exit/first passage type problems that could be solved asynchronously. 

Thanks for any suggestions,


More information about the discuss mailing list