ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
getImageCountMPI.F90 File Reference

Go to the source code of this file.

Functions/Subroutines

program xgetImageCountMPI
 This program contains instructions to determine the number of MPI-parallel processes and MPI image ranks used in MPI-parallelized programs.
More...
 

Function/Subroutine Documentation

◆ xgetImageCountMPI()

program xgetImageCountMPI

This program contains instructions to determine the number of MPI-parallel processes and MPI image ranks used in MPI-parallelized programs.

A primary goal for the design of this program is to allow automatic invocation of the MPI-parallel versions of the ParaMonte library from within dynamic programming language environments (e.g., MATLAB, Python, R, ...) without the use having to explicitly specify the MPI-parallelism or the specific MPI vendor used.
The goal is to allow to write scripts in dynamic languages that are parallelism-agnostic.

Corresponding to each MPI-parallelized ParaMonte library, a binary for this program will also be generated that can be called from within dynamic languages using system-level applications to check if and which MPI library is being used on the command line.

Multiple execution scenarios are possible:

  1. If program executes successfully, each MPI process will output the following information:
    imageCount=<imageCount>. imageRank=<imageRank>.
    where <imageCount> and <imageRank> are replaced with the actual inferred positive integer values at runtime.
    A value of 1 for imageCount implies that either:
    1. the program has been called serially (without invoking the mpiexec launcher), or,
    2. the number of images (processes) specified with the MPI launcher mpiexec is 1.
    In either case, it is more sensible to simply call the serial version of the ParaMonte library, if available, which is always true for the final releases of the ParaMonte library for dynamic languages.
  2. If program executes but an MPI-specific error occurs at runtime, the output message pattern will be the same as above.
    However, the values are 0 for both the <imageCount> and <imageRank>, as in the following:
    imageCount=0. imageRank=0.
  3. If the execution fails (e.g., when the corresponding MPI library is missing on the system), the process will most likely exist with a platform/process-dependent error message.
    Parsing the output of the error message and searching for the keyword imageCount can determine whether a runtime error has occurred or not.
Note
The prefix xget in the program name stands for execute and get.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, 1:01 PM Sunday, November 10, 2024, Dallas, TX

Definition at line 47 of file getImageCountMPI.F90.