Package: paramonte
Overview|Installation|Dependencies|Parallelism|Examples|Acknowledgments|License|AuthorsParaMonte: Plain Powerful Parallel Monte Carlo LibraryParaMonte is a serial/parallel library of Monte Carlo routines for sampling mathematical objective functions
of arbitrary-dimensions, in particular, the posterior distributions of Bayesian models in data science, Machine Learning,
and scientific inference, with the design goal of unifying theautomation(of Monte Carlo simulations),user-friendliness(of the library),accessibility(from multiple programming environments),high-performance(at runtime), andscalability(across many parallel processors).For more information on the installation, usage, and examples, visit:https://www.cdslab.org/paramonteParaMonte design goalsParaMonte has been developed while bearing the following design goals in mind:Full automationof all Monte Carlo simulations to the highest levels possible to ensure the highest level of user-friendliness
of the library and minimal time investment requirements for building, running, and post-processing of simulation models.Interoperabilityof the core library with as many programming languages as currently possible,
including C, C++, Fortran, MATLAB, Python, with ongoing efforts to support other popular programming languages.High-Performancemeticulously-low-level implementation of the library to ensure the fastest-possible Monte Carlo simulations.Parallelizabilityof all simulations via two-sided and one-sided MPI/Coarray
communications while requiring zero-parallel-coding efforts by the user.Zero-dependenceon external libraries to ensure hassle-free ParaMonte library builds and ParaMonte simulation runs.Fully-deterministic reproducibilityand automatically-enabled restart functionality
for all simulations up to 16 digits of precision as requested by the user.Comprehensive-reporting and post-processingof each simulation and its results, as well as their automatic storage in
external files to ensure the simulation results will be comprehensible and reproducible at any time in the distant future.Quick startFor a quick start with some Jupyter Notebook examples, visitthis ParaMonte documentation page.
The corresponding example source files (the*.ipynbfiles) can be downloaded from theparamonte.svg?branch=main GitHub repository,
which is a repository dedicated to the ParaMonte library examples.The following example code samples a 4-dimensional MultiVariate Normal (MNV) distribution via the ParaDRAM sampler in serial mode,importnumpyasnpimportparamonteaspmdefgetLogFunc(point):return-0.5*np.dot(point,point)pmpd=pm.ParaDRAM()pmpd.runSampler(ndim=4# assume 4-dimensional objective function,getLogFunc=getLogFunc# the objective function)To learn about the post-processing and visualization tools of theParaMonte::Pythonlibrary, visitthis this documentation page.InstallationThe latest release of ParaMonte can be installed from PyPI usingpip:pip3 install --user --upgrade paramonteor,pip install --user --upgrade paramonteAlternatively, you can build the library from the source in the GitHub repository of the project (https://github.com/cdslaborg/paramonte).
For instructions, please visit:cdslab.org/pmDependenciesThe Python interface of ParaMonte depends on a very few third-party libraries.
These includenumpy,scipy,pandas,matplotlib, andseaborn.
The last two (plotting) libraries are only used for the post-processing of simulation
results and are therefore not needed if you do not plan to use the post-processing
features of the ParaMonte library. If you have a recent version of Anaconda Python
distribution installed on your system, then all of the dependencies already
exist and are automatically installed on your system.ParallelismThe ParaMonte library relies on the Message Passing Interface (MPI) standard for inter-processor communications.
To run a parallel simulation, you will have to have a compatible MPI runtime library installed on your system.
In most cases, ParaMonte will automatically install the required missing libraries on your system (with your permission).
These automatic checks and installations happen when you download and install or use the library on your system, for the first time.
If the automatic installation is unsuccessful, you can also install the libraries manually on your system:OnWindowsandLinuxoperating systems, we highly recommend downloading and installing theIntel MPI runtime libraries,
which is available to the public free of charge, also available in the latest release of the
ParaMonte library on theGitHub release page(For Windows, look for the executable file that ends with.exe. For Linux, look for the file
that ends with.tgz, likel_mpi-rt_2018.2.199.tgz).OnmacOS, the Intel MPI library is not available. Therefore, we recommend installing eitherOpen-MPIorMPICHMPI runtime libraries
depending the prebuilt version of the ParaMonte library that you have downloaded or
the configuration with which you intend to build the library.For more information, visithttps://www.cdslab.org/paramonte/.Example usage instructionsInstall a Python 3 distribution, preferably, the Anaconda distribution of Python.
The Anaconda distribution of Python automatically ships with all of the
ParaMonte Python package dependencies when installed on your system.Optionally install a compatible MPI library(or let the ParaMonte library take care of the installation
when you import the package into your Python session for the first time). For parallel simulations (via MPI),
you will need an MPI library already installed on your system. If you choose to install the library by yourself,
we recommend the Intel MPI library which is available for free from the Intel website. On macOS, the OpenMPI
library can be used in place of the Intel MPI library which currently does not support macOS.Running the ParaMonte simulationsOpen an Anaconda command-line interface orjupyternotebook.Suppose your mathematical objective function is a multivariate Normal distribution as implemented in thislogfunc.pyfile.Forserialsimulations, download this example generic serialmain.pyPython main file and save it in the same folder containing thelogfunc.pyfile that you downloaded in the above.
Then, simply type the name of the Python main script,python main.pyon the Bash terminal or the Anaconda command line.Forparallelsimulations, download this example generic parallelmain_mpi.pyPython main file and save it in the same folder containing thelogfunc.pyfile that you downloaded in the above. Then, simply invoke the MPI launcher followed by the name of the Python main script on the Bash terminal, similar to the following,on Windows (within the Anaconda command line or a terminal that recognizes bothmpiexecandpythonsoftware),mpiexec -localonly -n 3 python main_mpi.pywhere the-localonlyflag is needed only if you are using the Intel MPI runtime libraries (which is the default MPI library used to build the ParaMonte libraries on Windows).on macOS or Linux (within a Bash terminal),mpiexec -n 3 python main_mpi.pyHere, the parallel simulations are performed on 3 processes. Change the number 3 to any number of processes you wish to use,
but do not go beyond the maximum number of physical processes available on your system, otherwise, it will only degrade
the performance of your parallel simulations. For example, if you are running the parallel simulation on a personal
quad-cores laptop, set the number of processes to either 3 or 4 at most.Enjoy the unification of simplicity, efficiency, and parallelism in Monte Carlo simulations!The ParaMonte library samplers are extremely versatile with many adjustable input parameters.
To learn about the many advanced features of the ParaMonte routines, visit:https://www.cdslab.org/paramonteCiting ParaMonteThe ParaMonte library is an honor-ware and its currency is acknowledgment and citations.If you use ParaMonte, please acknowledge it by citing the ParaMonte library's main publications
as listed inACKNOWLEDGMENT.md.Visitthe ParaMonte library homepageto access the PDF version of these files free of charge.LicenseMIT LicenseWhat does this license mean?Essentially, all we are asking from the users or developers is toexplicitly acknowledge the use of this library or any concepts or parts of it in their education, research, or software (free or commercial).This is a free software, so help us keep it freely available to the public by redistributing the library and contributing to it.
If you have questions or concerns about the license, do not hesitate to contact us (shahmoradi@utexas.edu).Authors and contributorsAmir Shahmoradiastrophysicist/bioinformatician by training (and a science-lover in general),Ph.D. in computational physics/bioinformatics from the University of Texas at Austin,currently a faculty member of Physics and Data Science at The University of Texas at Arlington,with teaching/research experience/background in computational and data sciences, statistics,
data analysis, and modeling, stochastic processes, Monte Carlo Methods, Bayesian probability theory,
high energy physics, astronomy and astrophysics, computational physics, Molecular Dynamics simulations,
biomedical science and MRI data analysis, bioinformatics and evolutionary biology (viral evolution,
protein dynamics, and interactions),contact:shahmoradi@utexas.eduFatemeh Bagheriphysicist / cosmologist by training,currently a UTA Physics member,deep philosophical thinker,contact:Fatemeh.Bagheri@uta.eduJoshua Osbornephysicist / Computational Data Scientist by training,currently a UTA Physics member,contact:joshuaalexanderosborne@gmail.comFor more information, visitcdslab.org/pmor contact Amir Shahmoradi:shahmoradi@utexas.edu