ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
choices.m
Go to the documentation of this file.
1%> \brief
2%> Return the ParaMonte-preferred MPI library vendor name(s)
3%> as used in naming the ParaMonte MATLAB shared libraries
4%> in the order of preference on the current platform.
5%>
6%> \return
7%> ``names`` : The output vector of MATLAB strings containing the
8%> the ParaMonte-preferred MPI library vendor names as
9%> used in naming the ParaMonte MATLAB shared libraries.<br>
10%>
11%> \interface{choices}
12%> \code{.m}
13%>
14%> names = pm.lib.mpi.choices()
15%>
16%> \endcode
17%>
18%> \warning
19%> Beware that this function only verifies the existence of the
20%> relevant MPI-parallel ParaMonte libraries on the system.<br>
21%> It does not detect the existence of the relevant MPI
22%> runtime library installations on the system.<br>
23%>
24%> \example{choices}
25%> \include{lineno} example/lib/mpi/choices/main.m
26%> \output{choices}
27%> \include{lineno} example/lib/mpi/choices/main.out.m
28%>
29%> \final{choices}
30%>
31%> \author
32%> \JoshuaOsborne, May 21 2024, 7:18 PM, University of Texas at Arlington<br>
33%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
34%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
35function names = choices()
36 bindirs = pm.sys.path.glob(pm.lib.path.lib() + "**pm_sampling*");
37 mpinames = ["mpi", "impi", "mpich", "openmpi"];
38 names = strings(numel(bindirs), 1);
39 iname = 0;
40 for ibin = 1 : numel(bindirs)
41 [basedir, ~, ~] = fileparts(bindirs(ibin));
42 [basedir, ~, ~] = fileparts(basedir);
43 [~, dirname, ~] = fileparts(string(basedir)); % This is the library checking mode.
44 [~, dirname, ~] = fileparts(string(dirname)); % This is the parallelism name used in the folder naming.
45 if any(strcmp(["mpi", "impi", "mpich", "openmpi"], dirname))
46 iname = iname + 1;
47 names(iname) = string(dirname);
48 elseif ~strcmp(["serial", "openmp"], dirname)
49 warning ( newline ...
50 + "Unrecognized MPI library name detected among the ParaMonte library paths:" + newline ...
51 + newline ...
52 + pm.io.tab + string(names(iname)) + newline ...
53 + newline ...
54 + "The corresponding ParaMonte library path is: " + newline ...
55 + newline ...
56 + pm.io.tab + bindirs(ibin) + newline ...
57 + newline ...
58 + "The expected MPI library names are: " + newline ...
59 + newline ...
60 + pm.io.tab + strjoin(mpinames, ", ") + newline ...
61 + newline ...
62 );
63 end
64 end
65 names = unique(names(1 : iname));
66 %if ispc()
67 % names = "impi";
68 %elseif pm.os.is.lin()
69 % names = ["impi", "mpich", "openmpi"];
70 %elseif ismac()
71 % names = ["openmpi", "mpich"];
72 %end
73end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function vendor(in name)
Return the MPI library vendor name from the input MPI name based on the internal ParaMonte shared lib...
function choices()
Return the ParaMonte-preferred MPI library vendor name(s) as used in naming the ParaMonte MATLAB shar...
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 glob(in pattern, in anycase)
Find all files and directory names matching the input pattern by expanding wildcards.
function impi()
Return the MPI image count and the current image ID (e.g., MPI rank + 1) if the application has been ...
function lib()
Return a scalar MATLAB string containing the path to the lib directory of the ParaMonte library packa...
function lin()
Return true if the current OS is Linux.
function parallel()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function tab()
Return a scalar MATLAB string containing 4 blank characters equivalent to a tab character.