Am 22.10.2008 um 10:30 schrieb Jed Brown:
> On Wed 2008-10-22 00:40, Reuti wrote:
>> Okay, now I see. Why not just call MPI_Comm_size(MPI_COMM_WORLD,
>> &nprocs) When nprocs is 1, it's a serial run. It can also be executed
>> when not running within mpirun AFAICS.
> This is absolutely NOT okay. You cannot call any MPI functions before
> MPI_Init (and at least OMPI 1.2+ and MPICH2 1.1a will throw an
> error if
> you try).
Sorry for being not precise. Of course you have to call MPI_Init
(which will also return successful when called while not being
started with mpirun), then check the number of cores you got with the
mentioned call, and if it's just one you can call MPI_Finalize
immediately and continue with a serial run.
> I'm slightly confused about the original problem. Is the program
> against an MPI when running in serial? You have to recompile
> anyway if
> you change MPI implementation, so if it's not linked against a real
> then you know at compile time. But what is the problem with calling
> MPI_Init for a serial job? All implementations I've used allow you to
> call MPI_Init when the program is run as ./foo (no mpirun).
> users mailing list