2%> This is the base
class for the ParaMonte sampler routines.
5%> See below
for information on the attributes (properties).
8%> See below
for information on the methods.
11%> Given the basic primitive nature of
this class, it does not have a custom constructor.<br>
12%> Users should always use the subclasses of
this base
class.<br>
17%> \JoshuaOsborne, May 21 2024, 12:43 AM, University of Texas at Arlington<br>
18%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
19%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 properties(Access =
public)
28 %> The ``
public`` scalar MATLAB
string representing the path to an external
29 %> input file that contains the simulation specification namelist(s).<br>
32 %> <b>Use
this optional argument only
if you know what you are doing</b>.<br>
33 %> Specifying an input simulation file will force the ParaMonte sampler
34 %> to ignore all other simulation specifications set by the user via
35 %> the ``spec`` component of the sampler instance.<br>
41 %> The ``
public`` scalar MATLAB logical.<br>
42 %> If set to ``
true``, then the checked (verified) versions of the
43 %> ParaMonte MATLAB shared libraries will be used
for simulations.<br>
44 %> This means that most function calls and computations will be
45 %> checked at runtime to ensure correctness, at the cost of
46 %> noticeably slower runtime simulation speeds.<br>
47 %> Set
this option to ``
true`` only
for diagnostics, testing, and development.<br>
48 %> If set to empty, the sampler will first search
for the non-checked
version
49 %> and
if none found, will search
for a checked
version of the library.<br>
55 %> The ``
public`` scalar MATLAB
string representing the (
vendor)
name of the
56 %> MPI runtime library. The following three library names are supported:<br>
58 %> <li> ``
"impi"`` : The Intel MPI runtime library (Windows/Linux).<br>
59 %> <li> ``
"mpich"`` : The MPICH MPI runtime library (Linux/macOS).<br>
60 %> <li> ``
"openmpi"`` : The OpenMPI runtime library (Linux/macOS).<br>
62 %> These names are normally one of the possible
63 %> values returned by [pm.lib.mpi.choices()](@ref
choices).<br>
64 %> By
default, the ParaMonte samplers should be capable of detecting
65 %> the right MPI runtime libraries and the ParaMonte library files.<br>
66 %> If the automated MPI detection fails or
for any reason, or you want to use
67 %> a non-preferred non-
default MPI library, you can set
this argument explicitly
68 %> to one of the values returned by [pm.lib.mpi.choices()](@ref
choices) to enable
69 %> your preferred choice of MPI-enabled ParaMonte libraries.<br>
71 %> Beware that you must launch MATLAB with an ``mpiexec`` binary that
72 %> comes with the same MPI library
vendor string specified
for ``mpiname``.<br>
74 %> The simulation task will mostly likely fail
if the MPI-
parallel ParaMonte
75 %> shared libraries corresponding to the specified value
for ``mpiname``
76 %>
do not exist in the ParaMonte package.<br>
79 %> <li> On Windows, only ParaMonte library
80 %> builds with Intel MPI are generally supported.<br>
81 %> <li> On Linux, the ParaMonte library builds with
82 %> all MPI libraries listed above are supported,
83 %> but there is no guarantee of their availability in
84 %> the package. Only the MPI-
parallel ParaMonte library
85 %> names returned by [pm.lib.mpi.choices()](@ref
choices)
86 %> are guaranteed to exist.<br>
87 %> <li> On Darwin (macOS), the ParaMonte shared library builds
88 %> with MPICH and OpenMPI libraries are generally supported,
89 %> but there is no guarantee of the availability of all of them
90 %> in the ParaMonte package, unless the corresponding
name is among
91 %> the names returned by [pm.lib.mpi.choices()](@ref
choices).<br>
95 %> <b>Use
this optional argument only
if you know its ramifications</b>.<br>
96 %> This option should rarely be needed in any normal MPI simulation.<br>
97 %> The
default value
for ``mpiname`` is an empty
string, implying
98 %> no specific use of MPI-enabled ParaMonte library routines,
99 %> unless the ``mpiexec`` launcher with more than one process
100 %> is detected at runtime.<br>
106 %> The ``
public`` scalar MATLAB logical (Boolean) indicator
which is ``
false`` by
default.<br>
107 %> If it is set to ``
true``, it will silence all output postprocessing messages.<br>
110 %> Setting ``mpiname`` to a non-empty
string
111 %> will automatically set ``silent`` to ``
true``.<br>
117 %> The ``
public`` MATLAB structure containing all simulation specifications.<br>
118 %> All specifications are set to appropriate
default values at runtime.<br>
119 %> Set the `spec` attributes to the desired values of your choice
120 %> to
override the
default simulation specifications.<br>
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127 properties(Access =
public, Hidden)
131 %> A ``Hidden`` scalar MATLAB
string containing the
name of the MEX file containing all ParaMonte sampler interfaces.<br>
134 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
136 mexname =
"pm_sampling";
140 %> A ``Hidden`` scalar MATLAB
string containing the type of the ParaMonte Fortran library that is to be called.<br>
141 %> Although both ``
static`` and ``shared`` may be possible,
this value must always remain as ``shared``.<br>
144 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
150 %> A ``Hidden`` scalar MATLAB
string containing the parallelization type of the ParaMonte Fortran library that is to be called.<br>
151 %> Although the
default value is ``serial``, the
class methods will internally set this component to the right parallelization type at runtime.<br>
154 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
160 %> A ``Hidden`` scalar MATLAB
string containing the memory usage type of the ParaMonte Fortran library that is to be called.<br>
161 %> Although both ``heap`` and ``stack`` may be possible,
this value must always remain as ``heap``.<br>
164 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
170 %> A ``Hidden`` scalar MATLAB
string containing the build type of the ParaMonte Fortran library that is to be called.<br>
171 %> The value of
this component is determined at runtime depending on the availability of the ParaMonte Fortran library.<br>
172 %> The runtime value is among the values returned by the ParaMonte MATLAB library function [pm.lib.bldtypes()](@ref
bldtypes).<br>
175 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
177 bldtype =
""; % build type
181 %> A ``Hidden`` scalar MATLAB
string containing the type of the ParaMonte Fortran library parallelization that is to be called.<br>
182 %> Although the
default value is ``serial``, the
class methods will internally set
this component to the right parallelization type at runtime.<br>
185 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
187 clstype =
""; %
compiler/linker suite
191 %> A ``Hidden`` scalar MATLAB
string containing the
name of the user-created
object of superclass [pm.sampling.Sampler](@ref
Sampler).<br>
192 %> This
name is determined at runtime via the MATLAB intrinsic function ``inputname()``.<br>
195 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
201 %> A ``Hidden`` scalar MATLAB
object of
class [pm.lib.weblinks](@ref
weblinks) containing the relevant ParaMonte library web links.<br>
204 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
210 %> A ``Hidden`` scalar MATLAB
string containing the contents of the MATLAB ``path`` variable at runtime.<br>
213 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
215 matpath = []; % MATLAB paths.
219 %> A ``Hidden`` scalar MATLAB
string containing the
name of the ParaMonte sampler subclass that the user has instantiated at runtime.<br>
222 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
228 %> A ``Hidden`` scalar MATLAB whole-number containing the user-specified value
229 %>
for the number of dimensions of the mathematical density function to be sampled.<br>
232 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
238 %> A ``Hidden`` scalar MATLAB
string containing all the sampler specifications to be passed to the sampler as a Fortran namelist.<br>
241 %> This ``Hidden``
class component must not be accessed by the end users of the library.<br>
247 %> Optional scalar MATLAB
string containing a
list of colon-(:)-separated
248 %> configurations of the kernel shared library to be used
for the sampling task.<br>
249 %> The most important of all is the
compiler suite with
which the library is built.<br>
252 %> <b>Use
this optional argument only
if you know what you are doing</b>.<br>
253 %> The specified value
for ``libspec`` is parsed internally to match a
254 %> corresponding library path
name within the ParaMonte library.<br>
255 %> The simulations will fail
if no such directory can be found.<br>
260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
262 methods(Access =
public)
265 %> Return a scalar
object of
class [pm.sampling.Sampler``.<br>
268 %> This is the constructor of the
class [pm.sampling.Sampler](@ref
Sampler).<br>
269 %> This
class is not meant to be accessed by the end users.<br>
270 %> It merely serves as the blueprint
for the subclasses of [pm.sampling.Sampler](@ref
Sampler)
271 %> accessible to the end users.<br>
273 %> \param[in] method : The input scalar MATLAB
string containing
274 %> the
name of the target ParaMonte sampler.<br>
277 %> ``self`` : The output scalar
object of
class [pm.sampling.Sampler](@ref
Sampler).<br>
282 %> sampler = pm.sampling.
Sampler();
283 %> sampler = pm.sampling.Sampler([]);
284 %> sampler = pm.sampling.Sampler(method);
291 %> \JoshuaOsborne, May 21 2024, 12:52 AM, University of Texas at Arlington<br>
292 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
293 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
294 function self =
Sampler(method)
298 self.method = string(method);
300 self.weblinks = pm.lib.weblinks();
301 if self.method ==
"ParaDRAM"
302 self.spec = pm.sampling.SpecDRAM(self.method);
303 elseif self.method ==
"ParaNest"
304 self.spec = pm.sampling.SpecNest(self.method);
305 elseif self.method ==
"sampler"
306 self.spec = pm.sampling.SpecBase(self.method);
309 +
"Unrecognized or unsupported ParaMonte sampler: " + self.method + newline ...
313 %filePath = mfilename(
"fullpath"); addpath(genpath(filePath),
"-begin");
314 self.name = string(inputname(1));
319 chainList =
readChain(self, pattern, sep)
325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335 fileList = findfile(self, ftype, pattern);
337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function version(in silent)
Return a scalar MATLAB string containing the latest available ParaMonte MATLAB version newer than the...
function bldtypes()
Return a list of MATLAB strings containing the names of all currently possible builds of the ParaMont...
function choices()
Return the ParaMonte-preferred MPI library vendor name(s) as used in naming the ParaMonte MATLAB shar...
This is the base class for generating subclass of MATLAB handle superclass whose annoying methods are...
This is the base class for the ParaMonte sampler routines.
function readSample(in self, in pattern, in sep)
Return a list of objects of superclass pm.sampling.FileContentsSample containing the content(s) of th...
function run(in self, in getLogFunc, in ndim)
Perform the basic runtime checks for the sampler and return nothing.
function getLogFuncConcurrent(in state)
function Sampler(in method)
Return a scalar object of class [pm.sampling.Sampler``.
function readReport(in self, in pattern)
Return a list of objects of class pm.sampling.FileContentsReport containing the content(s) of the Par...
function readChain(in self, in pattern, in sep, in varargin)
Return a list of objects of superclass pm.sampling.FileContentsChain containing the content(s) of the...
function getppm(in self)
Generate and return the relevant Post-Processing Message (ppm) for the current ParaMonte sampler to b...
function getLogFuncWrapped(in state)
function findfile(in self, in ftype, in pattern)
Return a vector of MATLAB strings containing the fully-resolved paths matching the input pattern.
function readRestart(in self, in pattern)
Return a list of objects of class pm.sampling.FileContentsRestart containing the content(s) of the Pa...
function readProgress(in self, in pattern, in sep)
Return a list of objects of class pm.sampling.FileContentsProgress containing the content(s) of the P...
function finalize(in self)
Finalize the ParaMonte MATLAB sampler simulation run and return nothing.
function compiler()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function getLogFunc(in point)
function parallel()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function readChain(in sampler, in pattern, in sep, in varargin)
Return a list of objects of superclass pm.sampling.FileContentsChain containing the contents of a (se...
function readProgress(in sampler, in pattern, in sep)
Return a list of objects of superclass pm.sampling.FileContentsProgress containing the contents of a ...
function readReport(in sampler, in pattern)
Return a list of objects of superclass pm.sampling.FileContentsReport containing the contents of a (s...
function readRestart(in sampler, in pattern)
Return a list of objects of superclass pm.sampling.FileContentsRestart containing the contents of a (...
function readSample(in sampler, in pattern, in sep)
Return a list of objects of superclass pm.sampling.FileContentsSample containing the contents of a (s...
function weblinks()
Return a structure containing tree of weblinks for the ParaMonte MATLAB library source file and docum...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...