Hi,

Am 04.04.2013 um 04:35 schrieb Ed Blosch:

> Consider this Fortran program snippet:
> 
> program test

use omp_lib
include 'mpif.h'

might be missing.


>  ! 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.

Nope, for me it's still 0 then.

-- Reuti


> 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
> 
> 
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users

Reply via email to