There are two ways to use the ParaMonte library from C/C++/Fortran languages on Windows operating systems (OS):

  1. the fast way: using the prebuilt ParaMonte libraries for Windows, or,
  2. the long way: building ParaMonte from scratch on your system.

Using the prebuilt ParaMonte library

This is the fast way. Simply download the prebuilt ParaMonte libraries for Windows from the release page of the ParaMonte repository on GitHub for the configuration of your choice. If you are not familiar with the naming convention used for the ParaMonte library files, refer to the pre-installation notes before continuing.

Using the ParaMonte library prebuilt via the Intel compiler suite

If you still do not know which library configuration is the most appropriate for your needs, we recommend downloading and using the ParaMonte libraries prebuilt via the Intel compilers (even if you are using the GNU compilers to build your applications),

Building the ParaMonte library locally on your system

This is the long way. Despite the scary name, the entire build process is super-straightforward and fully-automated. Currently, building the ParaMonte library from scratch minimally requires the Intel Parallel Studio installed on your system.


Steps to build the ParaMonte library on Windows:

  1. Download and install the Intel Parallel Studio 2019 or newer on your system.

    Follow the instructions here for a proper installation.
    If the installation is done properly, you should be able to find and open the dedicated command-line interface of Intel Parallel Studio from the Windows startup menu, just as shown in the image below, with the only difference that the compiler version will be the version that you have downloaded.

  2. Download the latest release of the ParaMonte source code from GitHub and unzip it via the Windows Explorer.

  3. Open the command-line interface of the Intel Parallel Studio as shown in the above figure and change the directory to the folder containing the ParaMonte GitHub repository folder that you just downloaded and unzipped.
  4. Call the Batch installation script install.bat on the command-line interface with the desired flags:

    To speed up the build, you can specify the type of library you want to build by any of the following flags:

    install.bat --help
    
        
    Usage:
    
        install.bat --lang <languages> --build <build types> --lib <library types> --par <parallelism types> --mem <array memory allocation choices> --nproc <# of processes>
    
    Example:
    
        install.bat --lang C/C++/Fortran --build release --lib static/shared --mem heap --par none/mpi --nproc 3
    
    Flag definitions:
    
        --build         : the ParaMonte library build types. Possible values: release, testing, debug
        --lang          : the ParaMonte library language choices to build for. Possible values (case-insensitive): C/C++/Fortran/MATLAB/Python
        --lib           : the ParaMonte library type. Possible values: static, shared (or equivalently, dynamic)
        --par           : the ParaMonte library parallelism type. Possible values: none mpi cafsingle cafshared
        --mem           : the ParaMonte library memory type for array allocations. Possible values: stack heap
        --test          : the ParaMonte library test type: none, basic, sampler, all
                          If basic, only the auxiliary non-sampler routines will be tested.
                          If sampler, the ParaMonte sampler routines will be tested.
                          If all, then all tests will be performed.
                          The default is none.
        --exam_enabled  : the ParaMonte library example runs enabled? Possible values: true, false. If true, exmaples will be run where possible.
        --matdram       : enables the ParaMonte MatDRAM MATLAB library build. If specified, it will disable all other specified flags.
        --nproc         : the default number of processes on which the ParaMonte examples/tests (if any) will be run. Possible values: positive integers
        --clean         : clean the environmental variables upon exit. Possible values: true, false. Only one can be specified. The default is true.
        --matdram       : build the ParaMonte MatDRAM MATLAB library and do nothing else.
        --help          : help with the script usage
    
    NOTE: All flags are optional.
    NOTE: Use the forward-slash character / to separate multiple values for a single flag.
    NOTE: Use only one white-space character to separate flags and values from each other.
    NOTE: For any option that is not specified, the build will be done for all of the possible options of the flag.
    NOTE: Some values of some of the flags are inconsistent with each other. For example:
    NOTE:     Coarray Fortran parallelism "--par cafsingle/cafshared" cannot be specified along with shared library "--lib shared".
    NOTE:     Coarray Fortran parallelism "--par cafsingle/cafshared" cannot be specified along with C/MATLAB/Python languages "--lang C/MATLAB/Python".
    NOTE:     Heap memory allocation "--mem heap" cannot be specified along with static library "--lib static".
    
    
    

    For example, to build the ParaMonte Python library in release mode for both serial and parallel applications, try,

    install.bat --lang python --build release --par none/mpi
    

    or, to build the ParaMonte MATLAB library in release mode for both serial and parallel applications, try,

    install.bat --lang matlab --build release --par none/mpi
    

    or, to build shared ParaMonte C/C++ libraries in release mode for both serial and MPI-parallel applications, try,

    install.bat --lang C --lib shared --mem heap --par none/mpi --build release
    

    or, to build a static ParaMonte Fortran library in both release and debug modes, with Coarray shared-memory parallelism enabled, for both heap and stack memory allocations, try,

    install.bat --lang Fortran --lib static --par cafshared --mem stack/heap --build debug/release
    

    or, to build the ParaMonte MatDRAM MATLAB library, try,

    install.bat --matdram
    

    You can also simply try,

    install.bat
    

    to build the ParaMonte library for all possible configurations for all supported languages.

    The install.bat script initiates the build process and generates a folder named build in the root directory of the ParaMonte repository which will contain all build files. The final library files together with the example scripts will be installed in a separate folder named bin in the same root directory of the ParaMonte project that you have downloaded from GitHub.

  5. Congrats! You have now built and (locally) installed the ParaMonte library for the configuration and language(s) of your choice on your system. Check out the two new folders build and bin that have been automatically created by the install script in the root directory of the uncompressed ParaMonte repository that you have downloaded. Inside the bin directory, you will see all the different build subdirectories corresponding to the different ParaMonte library build configurations. For example,
    install.bat --lang C++ --build release --lib shared --mem heap --par mpi -s intel
    

    will generate the following subdirectory,

    ./bin/libparamonte_cpp_windows_x64_intel_release_shared_heap_impi
    

    or,

    install.bat --lang C++ --build release --lib shared --mem heap --par mpi -s gnu
    

    will generate either of the following subdirectories,

    ./bin/libparamonte_cpp_windows_x64_gnu_release_shared_heap_mpich
    ./bin/libparamonte_cpp_windows_x64_gnu_release_shared_heap_openmpi
    

    in the bin directory of the ParaMonte library, depending on the existing MPI library installed on the system (Intel MPI vs. MPICH vs. OpenMPI). Any of these subdirectories contains the ParaMonte library files along with an example simulation source file and a build-script that can build the example to generate the executable, as well as a README.md file explaining how to build the supplied example.


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.