Skip to content

OMPI_MPI_THREAD_LEVEL cannot override 'required' in MPI_Init_thread #13210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abouteiller opened this issue Apr 25, 2025 · 0 comments · May be fixed by #13211
Open

OMPI_MPI_THREAD_LEVEL cannot override 'required' in MPI_Init_thread #13210

abouteiller opened this issue Apr 25, 2025 · 0 comments · May be fixed by #13211
Assignees

Comments

@abouteiller
Copy link
Member

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant