ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
Go to the source code of this file.
Functions | |
function | mmpi () |
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been launched via the MPICH MPI mpiexec launcher.More... | |
function mmpi | ( | ) |
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been launched via the MPICH MPI mpiexec
launcher.
This function attempts to detect the invocation of the current MATLAB session via an MPICH MPI mpiexec
binary MPI launcher instance.
The runtime detection is achieved by checking for runtime environment variables that the MPICH MPI mpiexec
binary executable defines upon launch.
Specifically, MPICH 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.
mpiexec
binary executable with the printenv
Unix command.mpiexec
binary executable with the set
Windows batch command.The most persistent environment variables for MPICH mpiexec
binary appear to be the following:
PMI_RANK
: The rank of the current process in the current MPI communication world.PMI_SIZE
: The size (i.e., number of images/processes) of the current MPI communication world.MPI_LOCALRANKID
: The local rank of the current process relative to the local host.MPI_LOCALNRANKS
: The size (i.e., number of images/processes) of the current MPI communication on the local host.Therefore, this function first attempts to detect the Hydra process manager.
If identified, the function will then attempt to identify the MPICH mpiexec
runtime variables.
nproc
: The output scalar MATLAB non-negative whole number containing the number of MPI images in the current invocation of the MPICH MPI mpiexec
binary MPI launcher.0
implies the algorithm failed to detect a ParaMonte-compatible MPICH MPI library or failed to infer the image count.rankp1
: The output scalar MATLAB non-negative whole number containing the image ID (e.g., MPI rank + 1) of the current MPI image in the current invocation of the MPICH MPI mpiexec
binary MPI launcher.0
implies the algorithm failed to detect a ParaMonte-compatible MPI library or failed to infer the image count.1
, unlike the MPI rank.rankp1
stands for rank + 1
.0
implies the algorithm failed to detect a ParaMonte-compatible MPICH MPI library or failed to infer the image count.
Possible calling interfaces ⛓
Example usage ⛓
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.
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.