2%> Return the runtime number of MPI cores
3%> with
which the `mpiexec` launcher may have been invoked.<br>
6%> Otherwise,
return `1`
if no use of `mpiexec` launcher is detected
7%> or it is invoked with only ``1`` MPI process.<br>
9%> An output value of ``1`` can be used as an indication of
10%> the ``mpiexec`` launcher in launching the ParaMonte library.<br>
13%> This routine can lead to a full MATLAB session crash
if the
14%> required MPI library dependencies are not detected on the system.<br>
15%> This issue severely limits the utility of
this routine.<br>
17%> \param[in] config : The input scalar (or array of) MATLAB string(s)
18%> containing the ParaMonte-preferred MPI library
vendor/
name
19%> or other configurations as used in naming the ParaMonte MATLAB shared libraries.<br>
20%> This argument is passed directly to the corresponding argument of [pm.lib.path.mexdir](@ref
mexdir).<br>
21%> Possible values of outmost interest to MPI applications are:<br>
23%> <li> the value ``
"Intel"`` or ``
"impi"``, representing the Intel MPI library.<br>
24%> <li> the value ``
"MPICH"`` or ``
"mmpi"``, representing the MPICH MPI library.<br>
25%> <li> the value ``
"OpenMPI"`` or ``
"ompi"``, representing the OpenMPI library.<br>
27%> Note that **all values are
case-insensitive**.<br>
28%> (**optional**. If missing, all possibilities are considered and the largest inferred ``count`` is returned.)
31%> ``count`` : The output MATLAB scalar integer containing the number of
32%> MPI processes launched by the ``mpiexec`` command or ``1``
33%>
if no ``mpiexec`` invocation has occurred or the routine
34%> fails to load any MPI-enabled ParaMonte library.<br>
39%> count = pm.lib.mpi.nproc()
40%> count = pm.lib.mpi.nproc([])
41%> count = pm.lib.mpi.nproc(config)
48%> \JoshuaOsborne, May 21 2024, 7:14 PM, University of Texas at Arlington<br>
49%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
50%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
55 configList = string(config);
57 if pm.array.len(configList) == 0
58 configList = pm.lib.mpi.choices();
61 mexname =
"pm_parallelism";
62 for iname = 1 : length(configList)
63 mexdirs = pm.lib.path.mexdir(mexname, configList(iname));
64 for ipath = 1 : length(mexdirs)
68 path(matpath, mexdirs{ipath});
70 %
if ~isa(mh,
'matlab.mex.MexHost') || ~isvalid(mh)
73 %temp = feval(mh, mexname,
'getImageCountMPI');
74 %count = max(count, temp);
75 mexcall = string(mexname +
"('getImageCountMPI');");
78 count = max(count, temp);
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared libraries.
function mexdir(in mexname, in config)
Return the vector of MATLAB strings containing the directory path(s) containing the specified ParaMon...
function nproc(in config)
Return the runtime number of MPI cores with which the mpiexec launcher may have been invoked.
function vendor(in path)
Return the a MATLAB string containing the MPI library vendor name corresponding to the input mpiexec ...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...