Consider this Fortran program snippet:
! everybody except rank=0 exits.
if (irank /= 0) then
! rank 0 tries to set number of OpenMP threads to 4
nthreads = omp_get_max_threads()
print*, "nthreads = ", nthreads
end program test
It is compiled like this: 'mpif90 -o test -O2 -openmp test.f90' (Intel
When I run it like this: mpirun -np 2 ./test
The output is: "nthreads = 0"
Does that make sense? I was expecting 4.
If I comment out the MPI lines and run the program serially (but still
compiled with mpif90), then I get the expected output value 4.
I'm sure I must be overlooking something basic here. Please enlighten me.
Does this have anything to do with how I've configured OpenMPI?