On 9/12/2014 6:14 AM, JR Cary wrote:
This must be a very old topic.
I would like to run mpi with one process per node, e.g., using
-cpus-per-rank=1. Then I want to use openmp inside of that.
But other times I will run with a rank on each physical core.
Inside my code I would like to detect which situation I am in.
Is there an openmpi api call to determine that?
omp_get_num_threads() should work. Unless you want to choose a
different non-parallel algorithm for this case, a single thread omp
parallel region works fine.
You should soon encounter cases where you want intermediate choices,
such as 1 rank per CPU package and 1 thread per core, even if you stay
away from platforms with more than 12 cores per CPU.