Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

OpenMP and MPI hybrid thread numbers

Programming


Tags
fortran, mpi, openmp

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-31-2015   -   Original Discussion by armando_2011
armando_2011's Unix or Linux Image
armando_2011 armando_2011 is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 31 August 2015, 11:22 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
OpenMP and MPI hybrid thread numbers

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


Code:
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:


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.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Undefined reference to omp_get_thread_num using OpenMP? larry burns Programming 0 04-24-2015 11:36 PM
Gcc openmp programming problem pigeon151 Programming 2 08-02-2014 04:26 AM
Grep username and get all the lines with thread numbers nes Shell Programming and Scripting 3 03-04-2014 02:13 AM



All times are GMT -4. The time now is 07:39 AM.