Edit this page


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,

  1. Download your target prebuilt library of your interest.

  2. Navigate to the example folder of your interest in the prebuilt library containing the main example file.

  3. Either,

    1. open a MATLAB session and run the supplied MATLAB script main.m, or,
    2. call the MATLAB application from within a relevant terminal (e.g., CMD in Windows, Bash in Linux, and Bash or zsh in macOS).
      1. For examples that are meant to be run in serial mode, try,
        matlab -batch main
        
      2. 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 change 3 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.

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.


If you have any questions about the topics discussed on this page, feel free to ask in the comment section below, or raise an issue on the GitHub page of the library, or reach out to the ParaMonte library authors.