Consider this Fortran program snippet: program test
! everybody except rank=0 exits. call mpi_init(ierr) call mpi_comm_rank(MPI_COMM_WORLD,irank,ierr) if (irank /= 0) then call mpi_finalize(ierr) stop endif ! rank 0 tries to set number of OpenMP threads to 4 call omp_set_num_threads(4) nthreads = omp_get_max_threads() print*, "nthreads = ", nthreads call mpi_finalize(ierr) end program test It is compiled like this: 'mpif90 -o test -O2 -openmp test.f90' (Intel 11.x) 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? Thanks, Ed