Intel® MPI Library

Developer Guide for Linux* OS

ID 768728
Date 10/31/2024
Public
Document Table of Contents

Threading Runtimes Support

The MPI thread-split programming model has special support of the OpenMP* runtime, but you may use any other threading runtime. The support differs in the way you communicate with the MPI runtime to set up thread_id for a thread and the way you set up the number of threads to be run concurrently. If you choose the OpenMP runtime support, make sure you have the OpenMP runtime library, which comes with the recent Intel® compilers and GNU* gcc compilers, and link the application against it.

The support is controlled with the I_MPI_THREAD_RUNTIME environment variable. Since the threading runtime support is a non-standard functionality, you must enable it explicitly using the generic or openmp argument for the OpenMP* runtime support.

You can set the maximum number of threads to be used in each process concurrently with the I_MPI_THREAD_MAX environment variable. This helps the MPI implementation allocate the hardware resources efficiently. By default, the maximum number of threads per rank is 1.

OpenMP* Threading Runtime

The OpenMP runtime supports the both implicit and explicit submodels. By default, the Intel MPI Library assumes that thread_id is set with the omp_get_thread_num() function call defined in the OpenMP standard. This scenario corresponds to the implicit submodel. You can use the explicit submodel by setting the thread_id info key for a communicator, which is particularly useful for OpenMP tasks.

By default, the maximum number of threads is set with the omp_get_max_threads() function. To override this function, set either I_MPI_THREAD_MAX or  OMP_NUM_THREADS environment variable.