Skip to content

OMPI_MPI_THREAD_LEVEL cannot override 'required' in MPI_Init_thread #13210

Open
@abouteiller

Description

@abouteiller

Due a bug in the way we sanitize user inputs on the 'requested' parameter in MPI_Init_thread the requested parameter cannot be overridden by OMPI_MPI_THREAD_LEVEL environment variable.

This feature is important when considering libraries that require a more thread-safe environment than what the legacy code of main expected.

Background information

This is related to #9332 where some of the rationale for why we want this feature is laid-out, but has additional concerns about adding MCA control parameters in addition to simple ENV. This is a more focused issue targeting only the fact that we can't override the requested param here.

What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)

Proposed resolution

Allow OMPI_MPI_THREAD_LEVEL to override the requested parameter to MPI_Init_thread.

Variant1: accept OMPI_MPI_THREAD_LEVEL (if valid), even if OMPI_MPI_THREAD_LEVEL < requested (this may cause a crash, but is what user requested)
Variant2: use max(OMPI_MPI_THREAD_LEVEL, requested) (assuming both valid)

both variants are valid based on MPI standard (11.2:MPI_INIT_THREAD pp486:25), so its our choice here.

Related questions

  • in MPI_INIT we silently promote to MPI_THREAD_MULTIPLE if the value of OMPI_MPI_THREAD_LEVEL is invalid (silently, no warning).
  • in MPI_INIT_THREAD we cause mpi_init to call the fatal errh if value requested is invalid
  • should invalid value in OMPI_MPI_THREAD_LEVEL also be promoted silently to MPI_THREAD_MULTIPLE in init_thread (like it is in MPI_INIT? or also cause error handling?

Metadata

Metadata

Assignees

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