ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
isimpi.m File Reference

Go to the source code of this file.

Functions

function isimpi ()
 Return true if and only if the application has been invoked via an Intel MPI mpiexec launcher, otherwise, return false.
More...
 

Function Documentation

◆ isimpi()

function isimpi ( )

Return true if and only if the application has been invoked via an Intel MPI mpiexec launcher, otherwise, return false.

This function attempts to detect the invocation of the current MATLAB session via an Intel MPI mpiexec binary MPI launcher instance.
The runtime detection is achieved by checking for runtime environment variables that the Intel MPI mpiexec binary executable defines upon launch.

Specifically, Intel MPI provides a long informal list of environment variables that are defined on every MPI process.
These variables may not be defined on all platforms.
Some are only defined at runtime, while others are defined at compile-time.

  1. On Unix systems, the best approach to investigate the Intel-specific runtime variables is to launch the Intel mpiexec binary executable with the printenv Unix command.
    mpiexec -np 1 printenv
    To see the compile-time variables and compare them with the runtime list from the above, try:
    printenv
  2. On Windows systems, the best approach to investigate the Intel-specific runtime variables is to launch the Intel mpiexec binary executable with the set Windows batch command.
    mpiexec -localonly -n 1 cmd /k set
    To see the compile-time variables and compare them with the runtime list from the above, try:
    set

Note that all Intel-MPI-specific environment variables are prefixed with I_MPI_.
The most persistent environment variables for Intel mpiexec binary appear to be the following:

  1. I_MPI_INFO_STATE : The status code for the Intel MPI runtime (e.g., 0).
  2. I_MPI_INFO_BRAND : The processor brand (e.g., 12th Gen Intel(R) Core(TM) i9-12950HX).

Therefore, this function attempts to detect the above runtime environment variables.

Returns
itis : The output scalar MATLAB logical that is true if and only if the application has been invoked via an Intel MPI mpiexec launcher, otherwise, return false.


Possible calling interfaces

itis = pm.lib.mpi.runtime.isimpi()
See also
pm.lib.mpi.runtime.mmpi()
pm.lib.mpi.runtime.impi()
pm.lib.mpi.runtime.ompi()
pm.lib.mpi.runtime.hydra()
pm.lib.mpi.runtime.nproc()
pm.lib.mpi.runtime.rankp1()
pm.lib.mpi.runtime.isimpi()
pm.lib.mpi.runtime.detect()


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../../../'); % Add the ParaMonte library root directory to the search path.
3
4disp('itis = pm.lib.mpi.runtime.isimpi()')
5 itis = pm.lib.mpi.runtime.isimpi()
6disp("")
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Example output
1itis = pm.lib.mpi.runtime.isimpi()
2itis =
3 logical
4 0


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, 12:10 AM Wednesday, November 13, 2024, NASA Goddard Space Flight Center (GSFC), Washington, D.C.