在基于MPI的并行编程中执行代码期间更改处理器的数量。 [英] Changing number of processors during execution of the code in MPIs based parallel programming.

查看:424
本文介绍了在基于MPI的并行编程中执行代码期间更改处理器的数量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在FORTRAN中使用基于MPI的并行编程。在例如运行程序时10个处理器我使用的是标准MPIs命令

mpirun -n 10 prog_name

所以程序将执行10个处理器从开始到结束,即在执行代码期间处理器的数量是恒定的。



我的问题是可以在程序执行过程中改变处理器的数量,例如,从2个处理器开始,然后在一些标准之后,我想将处理器的数量更改为4,然后将其更改为6至10至20,依此类推。

预先感谢。

解决方案

MPI-2支持(近似)这种操作,Google支持 mpi_comm_spawn 和相关例程。我大致写了 ,因为严格地说MPI只关心进程而不是处理器。还要研究例程 mpi_comm_get_attr 和预定义常量 mpi_universe_size 的文档,这些文档可以在程序和运行时环境之间进行通信以找出可用的进程数量等。

您可能会发现并行计算机上的作业管理系统不允许程序获取更多处理器而它正在运行。



在我开始执行工作时,您希望避免的是10个进程的10个处理器,然后再产生20个进程进程在这些相同的10个处理器上运行。

I am using MPIs based parallel programming in FORTRAN. To run the program on e.g. 10 processors I am using the standard MPIs command

mpirun –n 10 prog_name

So the program will execute on 10 processors from start to end, i.e. the number of processors are constant during execution of the code.

My question is that is it possible to change the number of processors during the execution of program, e.g. to start with 2 processors then after some criteria I want to change the number of processors to 4 then to 6 to 10 to 20 and so on.

Thanks in advance.

解决方案

MPI-2 supports (approximately) this sort of operation, Google the documentation for mpi_comm_spawn and related routines. I write approximately because strictly speaking MPI only concerns itself with processes rather than processors. Study also the documentation for the routine mpi_comm_get_attr and the predefined constant mpi_universe_size which enable communication between your program and the run time environment to figure out such things as the number of processes which are available.

You might find that the job management system on your parallel computer does not allow a program to grab more processors while it is running.

What you will want to avoid, I expect, is grabbing, say, 10 processors for 10 processes at the start of the execution of your job, then later spawning another 20 processes to run on those same 10 processors.

这篇关于在基于MPI的并行编程中执行代码期间更改处理器的数量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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