zahoor ullah
zahoor ullah

Reputation: 45

Changing number of processors during execution of the code in MPIs based parallel programming.

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.

Upvotes: 1

Views: 1509

Answers (1)

High Performance Mark
High Performance Mark

Reputation: 78316

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.

Upvotes: 8

Related Questions