Sun MPI 4.0 User's Guide: With CRE

Controlling Process Spawning

Specify the Number of Processes

Use the -np option to specify the number of processes you want to start; the default is 1. This option is typically used with a Sun MPI program.

For example,

% mprun -p part2 -np 4 a.out

specifies that you want four copies of a.out to start on the nodes of the partition named part2.

You can also specify 0 as the -np value. The CRE will start one process per CPU on each available CPU. Thus, if the partition part2 has six available CPUs, the command

% mprun -p part2 -np 0 a.out

will start six copies of a.out.

Limit to One Process Per Node

Use the -Ns option to limit the number of processes to one per node. This prevents nodes from spawning more processes regardless of the number of CPUs they have.

When Number of Processes Exceeds Number of CPUs

When you request multiple processes (via the -np option), the CRE attempts to start one process per CPU. If you request more processes than the number of available CPUs, you must include either the -W or -S option. Otherwise, mprun will fail.

Use the -W option if you want the processes to wrap--that is, to allocate multiple processes to each CPU, which will execute their respective sets of processes one by one. For example, if the partition part2 has six available CPUs and you specify

% mprun -p part2 -np 10 -W a.out

the CRE will start 10 processes on the six CPUs.


Note -

When the CRE wraps processes, it distributes them according to load-balancing rules. Therefore, you will not be able to predict where they will execute.


If you prefer to have a certain number of processes started, but are willing to settle for however many CPUs are available, use the -S option. The CRE will start one process on each available CPU. Thus, if you issue the same command as above, but substitute -S for -W:

% mprun -p part2 -np 10 -S a.out

and six CPUs are available on part2, then six copies of a.out will start, one per CPU.


Note -

If you specify -np number, but not -np 0, -S, or -W, and there are not enough nodes within the partition, the CRE will look for nodes outside the partition to make up the difference. To be elegible, an external node must be both enabled and independent. That is, the node must not be a member of another partition that is enabled. If you specify -np 0, -S, or -W, the search will be restricted to the partition you are in.