Skip to content

Should we remove haskey(ENV, "PMI_RANK") || haskey(ENV, "OMPI_COMM_WORLD_RANK") check in context_type? #94

@charleskawczynski

Description

@charleskawczynski

This seems to be causing issues for people when they don't explicitly request MPI (and it automatically gets scooped up). I think it might be less surprising if we change

function context_type()
    name = get(ENV, "CLIMACOMMS_CONTEXT", nothing)
    if !isnothing(name)
        if name == "MPI"
            return :MPICommsContext
        elseif name == "SINGLETON"
            return :SingletonCommsContext
        else
            error("Invalid context: $name")
        end
    end
    # detect common environment variables used by MPI launchers
    #   PMI_RANK appears to be used by MPICH and srun
    #   OMPI_COMM_WORLD_RANK appears to be used by OpenMPI
    if haskey(ENV, "PMI_RANK") || haskey(ENV, "OMPI_COMM_WORLD_RANK")
        return :MPICommsContext
    else
        return :SingletonCommsContext
    end
end

to

function context_type()
    name = get(ENV, "CLIMACOMMS_CONTEXT", nothing)
    if !isnothing(name)
        if name == "MPI"
            return :MPICommsContext
        elseif name == "SINGLETON"
            return :SingletonCommsContext
        else
            error("Invalid context: $name")
        end
    else
      return :SingletonCommsContext
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions