2%> Return a
list of scalar MATLAB strings containing the paths to
3%> all detected ``mpiexec`` binaries installed on the system and
4%> available in the environment path variable.<br>
7%> The search strategy is to parse and search the paths in the environmental
8%> ``PATH`` variable of the runtime processor shell and
return all ``mpiexec`` paths.<br>
9%> Also, all ``mpiexec`` paths found via [pm.sys.path.mpiexec.which(
vendor)](@ref
which) are returned.<br>
10%> Additionally,
if ``
vendor`` is missing or is set to ``
"Intel"``, also search the
default
11%> installation directories of Intel MPI libraries on all operating systems.<br>
12%> Think of
this functionality [pm.sys.path.mpiexec.find(
vendor)](@ref
find) as a
13%> more comprehensive of what [pm.sys.path.mpiexec.which(
vendor)](@ref
which) does.<br>
16%> In Microsoft Windows Subsystem
for Linux (WSL) environments,
this function
17%> may freeze MATLAB indefinitely,
if Windows paths containing MPI installations
18%> exist within the environmental variable ``PATH``.<br>
19%> Such paths typically begin with ``/mnt/`` and are automatically
20%> prepended by WSL to the contents of the ``PATH`` variable.<br>
21%> This problem happens because Windows applications cannot be executed
22%> from within a WSL terminal, freezing the terminal indefinitely.<br>
23%> The best solution is to remove Windows paths from the contents of the
24%> environment variable ``PATH`` of the WSL terminals.<br>
25%> See [
this StackOverflow question](https:
26%>
for possible solutions.<br>
28%> \param[in]
vendor : The input scalar MATLAB string, containing the MPI
29%> library
vendor that should match the ``mpiexec`` binary.<br>
30%> Possible values are:<br>
32%> <li> ``Intel``, representing the Intel MPI library.
33%> <li> ``MPICH``, representing the MPICH MPI library.
34%> <li> ``OpenMPI``, representing the OpenMPI library.
36%> (**optional**,
default = ``
""``)
39%> ``pathList`` : A
list of scalar MATLAB strings containing the paths to
40%> all detected ``mpiexec`` binaries installed on the system.<br>
41%> If the ``mpiexec`` is not found or does not match the specified ``
vendor``,
42%> the output will be an empty
list ``[]``.<br>
47%> pathList = pm.sys.path.mpiexec.find()
48%> pathList = pm.sys.path.mpiexec.find(
vendor)
53%> \include{lineno} example/sys/path/mpiexec/
find/main.m
55%> \include{lineno} example/sys/path/mpiexec/
find/main.out.m
60%> \JoshuaOsborne, May 21 2024, 5:03 AM, University of Texas at Arlington<br>
61%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
62%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
67 vendorLower = lower(
vendor);
68 if vendorLower ==
"impi"
69 vendorLower =
"intel";
70 elseif vendorLower ==
"open-mpi" || vendorLower ==
"openrte"
71 vendorLower =
"openmpi";
73 vendorList = vendorLower;
75 vendorList = [
"Intel",
"MPICH",
"OpenMPI"];
80 %%%% The strategy is to search
for any executable in the
81 %%%% environmental paths whose
name contains `mpiexec`.
84 paths = getenv(
"PATH");
85 paths = string(strsplit(paths, pathsep));
87 apps = pm.sys.path.list(path);
88 for icell = 1 : length(apps)
90 if contains(app,
"mpiexec") && isfile(app)
92 name = lower(pm.sys.path.mpiexec.vendor(app));
94 if contains(
name, vendorLower)
95 pathList = [pathList, app];
99 pathList = [pathList, app];
106 %%%% Try more via `
which()` and
default installation paths.
109 for name = vendorList
110 path = pm.sys.path.mpiexec.which(
name);
113 pathList = [pathList, path];
114 elseif sum(strcmp(pathList, path)) == 0
115 pathList = [pathList, path];
120 if nargin == 0 || contains(vendorLower,
"intel")
121 possibilities = [ "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\mpiexec.exe" ...
122 , "C:\Program Files\Intel\oneAPI\mpi\latest\bin\mpiexec.exe" ...
123 , "/opt/intel/oneapi/mpi/latest/bin/mpiexec" ...
125 for path = possibilities
128 pathList = [pathList, path];
129 elseif sum(contains(pathList, path)) == 0
130 pathList = [pathList, path];
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared libraries.
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function find(in vendor)
Return a list of scalar MATLAB strings containing the paths to all detected mpiexec binaries installe...
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...