Usage of all available threads for OMP inside Master MPI only part - hybrid parallel programming

158 Views Asked by At

Is it possible to use all available threads for OMP on a region where only master MPI is active?. I mean something like this:

         START 
           |
 MPI-I --------- MPI-II
(master)
   |               |
omp1-omp2       -skip-         REGION1 
omp3-omp4       -skip-
   |               |
omp1-omp2      omp3-omp4       REGION2
   |               |
   -----------------
          | 
         END 

Where nr. total threads available*** is 4 (2 are used for mpi, 4 used by MPI1 -master- on Region1, and 2 used by each MPI on Region2).

It looks like this is only working on Windows*, not on Linux**. On Linux, omp_get_num_procs() seems to detect that threads are being used by other mpi procs. and retrieves a different number -lower- than that Windows does (which gives all available*** ones, irrespective whether they are currently occupied by other mpi active procs.)

On Linux even using explicitly the following clause !$OMP &num_threads(Max_OMP_usage), with Max_OMP_usage equal to the total number of threads available***, within the OMP DO construct has no effect.

*Windows: Intel ifort, MSMPI

**Linux: Intel ifort, MPI OneApi2021.

***By total nr. of threads available I mean the ones "lscpu" retrieves for example, this is, the ones present physically (and not the one omp_get_num_procs() may retrieve).

1

There are 1 best solutions below

0
Varsha - Intel On

@Gilles Gouaillardet & @Costagol

Yes, you are correct. We need to set I_MPI_PIN=0 in order to stop process binding & thus only the master can use all the OMP threads.

You can also find the links below for the Interoperability with OpenMP and Environment Variables for Process Pinning:

https://www.intel.com/content/www/us/en/develop/documentation/mpi-developer-reference-linux/top/environment-variable-reference/process-pinning/interoperability-with-openmp-api.html

https://www.intel.com/content/www/us/en/develop/documentation/mpi-developer-reference-linux/top/environment-variable-reference/process-pinning/environment-variables-for-process-pinning.html