ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
isimpi.m
Go to the documentation of this file.
1%> \brief
2%> Return ``true`` if and only if the application has been invoked via
3%> an Intel MPI ``mpiexec`` launcher, otherwise, return ``false``.<br>
4%>
5%> \details
6%> This function attempts to detect the invocation of the current MATLAB
7%> session via an Intel MPI ``mpiexec`` binary MPI launcher instance.<br>
8%> The runtime detection is achieved by checking for runtime environment
9%> variables that the Intel MPI ``mpiexec`` binary executable defines upon launch.<br>
10%>
11%> Specifically, Intel MPI provides a long informal list of
12%> environment variables that are defined on every MPI process.<br>
13%> These variables may not be defined on all platforms.<br>
14%> Some are only defined at runtime, while others are defined at compile-time.<br>
15%>
16%> <ol>
17%> <li> On **Unix systems**, the best approach to investigate the Intel-specific runtime variables
18%> is to launch the Intel ``mpiexec`` binary executable with the ``printenv`` Unix command.<br>
19%> \code{.sh}
20%> mpiexec -np 1 printenv
21%> \endcode
22%> To see the compile-time variables and compare them with the runtime list from the above, try:<br>
23%> \code{.sh}
24%> printenv
25%> \endcode
26%> <li> On **Windows systems**, the best approach to investigate the Intel-specific runtime variables
27%> is to launch the Intel ``mpiexec`` binary executable with the ``set`` Windows batch command.<br>
28%> \code{.bat}
29%> mpiexec -localonly -n 1 cmd /k set
30%> \endcode
31%> To see the compile-time variables and compare them with the runtime list from the above, try:<br>
32%> \code{.bat}
33%> set
34%> \endcode
35%> </ol>
36%>
37%> Note that all Intel-MPI-specific environment variables are prefixed with ``I_MPI_``.<br>
38%> The most persistent environment variables for Intel ``mpiexec`` binary appear to be the following:<br>
39%>
40%> <ol>
41%> <li> ``I_MPI_INFO_STATE`` : The status code for the Intel MPI runtime (e.g., ``0``).<br>
42%> <li> ``I_MPI_INFO_BRAND`` : The processor brand (e.g., ``12th Gen Intel(R) Core(TM) i9-12950HX``).<br>
43%> </ol>
44%>
45%> Therefore, this function attempts to detect the above runtime environment variables.<br>
46%>
47%> \return
48%> ``itis`` : The output scalar MATLAB ``logical`` that is ``true``
49%> if and only if the application has been invoked via an
50%> Intel MPI ``mpiexec`` launcher, otherwise, return ``false``.<br>
51%>
52%> \interface{isimpi}
53%> \code{.m}
54%>
55%> itis = pm.lib.mpi.runtime.isimpi()
56%>
57%> \endcode
58%>
59%> \see
60%> [pm.lib.mpi.runtime.mmpi()](@ref mmpi)<br>
61%> [pm.lib.mpi.runtime.impi()](@ref impi)<br>
62%> [pm.lib.mpi.runtime.ompi()](@ref ompi)<br>
63%> [pm.lib.mpi.runtime.hydra()](@ref hydra)<br>
64%> [pm.lib.mpi.runtime.nproc()](@ref nproc)<br>
65%> [pm.lib.mpi.runtime.rankp1()](@ref rankp1)<br>
66%> [pm.lib.mpi.runtime.isimpi()](@ref isimpi)<br>
67%> [pm.lib.mpi.runtime.detect()](@ref detect)<br>
68%>
69%> \example{isimpi}
70%> \include{lineno} example/lib/mpi/runtime/isimpi/main.m
71%> \output{isimpi}
72%> \include{lineno} example/lib/mpi/runtime/isimpi/main.out.m
73%>
74%> \final{isimpi}
75%>
76%> \author
77%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
78%> \AmirShahmoradi, 12:10 AM Wednesday, November 13, 2024, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
79function itis = isimpi()
80
81 brand = getenv("I_MPI_INFO_BRAND");
82 state = getenv("I_MPI_INFO_STATE");
83 itis = ~isempty(brand) || ~isempty(state);
84
85end
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function detect(in vendor)
Return the MPI image count and current image ID (e.g., MPI rank + 1) and the MPI library name as it a...
function hydra()
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been ...
function impi()
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been ...
function isimpi()
Return true if and only if the application has been invoked via an Intel MPI mpiexec launcher,...
function lib()
Return a scalar MATLAB string containing the path to the lib directory of the ParaMonte library packa...
function mmpi()
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been ...
function nproc(in vendor)
Return the runtime number of MPI processes with which the mpiexec launcher may have been invoked.
function ompi()
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been ...
function rankp1(in vendor)
Return the ID (MPI rank + 1) of the current MPI image (process), starting from the number one.