Edit this page
See for example, the illustrations in the documentation of the ParaMonte MATLAB ParaDRAM sampler.
Building and running examples from the pre-built library releases
The prebuilt ParaMonte MATLAB library releases ship with all available examples for the MATLAB programming language environment.
To run a specific example in the prebuilt library,
-
Download your target prebuilt library of your interest.
-
Navigate to the example folder of your interest in the prebuilt library containing the
main
example file. -
Either,
- open a MATLAB session and run the supplied MATLAB script
main.m
, or, - call the MATLAB application from within a relevant terminal
(e.g.,
CMD
in Windows,Bash
in Linux, andBash
orzsh
in macOS).- For examples that are meant to be run in serial mode, try,
matlab -batch main
- For MPI-parallel example runs (e.g., for MPI-parallel ParaMonte samplers), try,
mpiexec -n 3 matlab -batch main
The above command will launch
3
MATLAB sessions in parallel to run the specified MATLAB example in parallel. You can change3
to any other positive integer to adjust the number of parallel processes. The ParaMonte library will automatically infer and invoke the appropriate MPI-parallel ParaMonte library build to run the example in parallel.Tip: On Windows platforms using the Intel MPI library, you need to specify an additional flag `-localonly` for the `mpiexec` launcher to limit the parallelism to the local machine.mpiexec -localonly -n 3 matlab -batch main
Note: The MATLAB-batch
flag prevents a MATLAB GUI session from opening and instead runs the MATLAB engine in the background. You should always use this flag when using MATLAB on the command line. - For examples that are meant to be run in serial mode, try,
- open a MATLAB session and run the supplied MATLAB script
Building and running examples from the library source
If you are building the ParaMonte library from the source code,
you can also instruct the build scripts to build, run and postprocess
the examples after the ParaMonte build is complete.
To build and run the examples, you must specify the name of the
example you want to run along with the ParaMonte build configuration
flag --exam
.
For example,
- In a Windows Batch command line (e.g., CMD),
try in the root directory of the ParaMonte GitHub repository,
install.bat --lang matlab --exam sampling
- In a Unix Bash or ZSH command line,
try in the root directory of the ParaMonte GitHub repository,
./install.sh --lang matlab --exam sampling
The above installation commands will be build the ParaMonte MATLAB library
and subsequently run all ParaMonte MATLAB examples whose name or path, as appearing in the
example directory of the ParaMonte GitHub repository,
partially matches the specified pattern sampling
.
--exam "sampling;himmelblau"
.