On Nov 22, 2007, at 5:48 PM, Loerenz Praeiji wrote:
> Is there a way to set the number of processors from within the source
> code in MPI? I want to develop an application that evaluates the
> number of processors needed depending on custom command line
> arguments. If this is impossible, is there a way to set the number of
> processors via an environment variable? Or is using "mpirun -np" the
> only way?
There's no way to set the number of processors that will be in a
process's MPI_COMM_WORLD once that process has started. In LAM/MPI in
particular, processes are either started with mpirun (where the -np
flag sets the number of processes to start) or are started as
"singletons" -- standalone MPI applications. It is possible to use
MPI_COMM_SPAWN to have one (or more) MPI processes start a new set of
MPI processes (in a different MPI_COMM_WORLD).
Hope this helps,
Brian
--
Brian Barrett
LAM/MPI Developer
Make today a LAM/MPI day!
|