def get_world_size():
    """Helper function to get the world size from the
    environment when `mpirun` is used to run this python program.

    Returns:
    --------
    integer :
        Numer of processes created by the executor that created this process.
    """
    env_variables = dict(os.environ)
    # mpich
    if "PMI_SIZE" in env_variables:
        return int(env_variables["PMI_SIZE"])
    # openmpi
    elif "OMPI_COMM_WORLD_SIZE" in env_variables:
        return int(env_variables["OMPI_COMM_WORLD_SIZE"])
    else:
        return 1
Helper function to get the world size from the
    environment when `mpirun` is used to run this python program.

    Returns:
    --------
    integer :
        Numer of processes created by the executor that created this process.
    
tools/distpartitioning/parmetis_preprocess.py