终止与MPI的所有进程 [英] Terminating all processes with MPI

查看:168
本文介绍了终止与MPI的所有进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MPI来搜索我划分不同的线程之间的问题空间这样的解决方案。每个线程正在经历一个循环,每次迭代是一个解决方案的候选者。

I'm using MPI to search for a solution in such a way that I divide the problem space between the different threads. Each thread is going through a for loop, and each iteration is a candidate for a solution.

的问题是,当一个线程发现该溶液中,我希望它通知其它线程和他们都应该(在他们的当前迭代的结尾,或至少 - 或下一个的开始)立即终止。

The problem is, when one thread finds the solution, I want it to notify the other threads and they should all terminate immediately (or at least at the end of their current iteration - or the beginning of the next one).

我怎么能做到这一点与MPI?

How can I do this with MPI?

推荐答案

您可以使用 MPI_Abort(MPI_COMM_WORLD)完全关闭一切,然后有。更可控的解决方案将是一个过程来发布非阻塞与指定的标签发送到所有其它进程当它找到一个解决方案,并在一个非阻塞的迭代结束每个过程检查收到这样的消息是否已经被张贴任何人。

You can use MPI_Abort(MPI_COMM_WORLD) to completely shut down everything then and there. A more controlled solution would be for a process to post a nonblocking send with a designated tag to every other process when it finds a solution, and each process checks at the end of an iteration with a nonblocking receive whether such a message has been posted by anyone.

这篇关于终止与MPI的所有进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆