Skip to content

Commit

Permalink
Add the --allow-run-as-root option to the OpenMPI executable
Browse files Browse the repository at this point in the history
Thus, OpenMPI is instructed to allow to be run as root in a portable
way.

The `OMPI_ALLOW_RUN_AS_ROOT` and `OMPI_ALLOW_RUN_AS_ROOT_CONFIRM`
environment variables are not taken into account by `mpiexec` on Debian
10, because they were not supported at the time Debian 10 was released.

closes #429
  • Loading branch information
popescu-v committed Nov 6, 2024
1 parent f0f7e67 commit 4047aec
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/LearningTestTool/py/kht_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ def evaluate_tool_on_test_dir(
# permet de lancer plus de processus qu'il n'y a de coeurs. Option --oversubscribe
os.environ["OMPI_MCA_rmaps_base_oversubscribe"] = "true"

# permet de lancer en tant que root. Option --allow-run-as-root
os.environ["OMPI_ALLOW_RUN_AS_ROOT"] = "1"
os.environ["OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"] = "1"
# Construction des parametres
khiops_params = []
if tool_process_number > 1:
Expand All @@ -353,6 +350,19 @@ def evaluate_tool_on_test_dir(
if platform.system() == "Darwin":
khiops_params.append("-host")
khiops_params.append("localhost")

# Option --allow-run-as-root, specifique a OpenMPI,
# permet de lancer OpenMPI en tant que root de maniere portable sur
# tous les OS supportes : sous Debian 10, OpenMPI ne prend pas en
# compte les variables d'environnement OMPI_ALLOW_RUN_AS_ROOT et
# OMPI_ALLOW_RUN_AS_ROOT_CONFIRM
if platform.system() == "Linux":
# En iterant sur TOOL_MPI_SUFFIXES, on s'assure que "_openmpi"
# fait toujours partie des back-ends MPI supportes
for suffix in kht.TOOL_MPI_SUFFIXES:
if tool_exe_path.endswith(suffix) and suffix == "_openmpi":
khiops_params.append("--allow-run-as-root")
break
khiops_params.append("-n")
khiops_params.append(str(tool_process_number))
khiops_params.append(tool_exe_path)
Expand Down

0 comments on commit 4047aec

Please sign in to comment.