hi,
I have two basic questions, I will be really grateful if I receive any
comment from you,
I have an MPI code where I am trying to implement OpenMP directives.
The machine where I run the code has 16 cores. I run the code with
export OMP_NUM_THREADS=2
mpirun -np 4 ./exec
If I used mpi alone, I understand that the program "exec" would run on
4 cores. But what does the program do when I use MPI combined with
OpenMP, does it mean that I will be using 8 cores (4 MPI processes x
2 threads) for the entire work? Or that I will use only 4 cores and
each core will be doubly occupied?
The second thing is related to the use of OpenMP directives inside subroutines.
If I have the following code:
program main
....
!$omp parallel
!$omp sections
!$omp section
print*, "hello"
!$omp section
call func()
!$omp end sections
!$omp end parallel
end program
subroutine func()
...
!$omp parallel do
do i=1,100
...
enddo
!$omp end parallel do
end subroutine
how many threads would there be in the parallel section of func() if
I set export OMP_NUM_THREADS=2? According to my code there
will be 1 thread available for func() because it is inside a "section"
but I don't know how the threads work when the function is nested
as in this case,
Thanks.