Skip to content

Commit

Permalink
Fall back to looking for the MPI command in the putative Conda binary…
Browse files Browse the repository at this point in the history
… directory

If `$CONDA_PREFIX/bin` is not in the `PATH`, then the putative Conda binary
directory is the same as the directory the Khiops `MODL[_openmpi|mpich]` binary
is situated in.

Note: `KHIOPS_MPI_COMMAND` might still contain the incorrect `mpiexec`,
in the following (rather unlikely) scenario:
- `khiops_env` is run in a "Conda-based" environment
- there is a preexisting system-wide MPI installation which contains
  `mpiexec`.
This should be mitigated following the Khiops Python issue
KhiopsML/khiops-python#301.

closes #476
  • Loading branch information
popescu-v committed Dec 5, 2024
1 parent 28e0d54 commit 202b73e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packaging/linux/common/khiops_env/khiops_env.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ if command -v mpiexec &>/dev/null; then
KHIOPS_MPI_ERROR=""
KHIOPS_MPI_COMMAND="$(type -P mpiexec) $MPI_EXTRA_FLAGS @KHIOPS_MPI_EXTRA_FLAG@ @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER"
else
KHIOPS_MPI_ERROR="We didn't find mpiexec in the regular path. Parallel computation is unavailable: Khiops is launched in serial"
KHIOPS_MPI_COMMAND=""
# Fallback for Conda-based environments where `mpiexec` is not in PATH,
# because $CONDA_PREFIX/bin is not in PATH
_MPIEXEC=@KHIOPS_PATH@mpiexec
if command -v $_MPIEXEC &>/dev/null; then
KHIOPS_MPI_ERROR=""
KHIOPS_MPI_COMMAND="$_MPIEXEC $MPI_EXTRA_FLAGS @KHIOPS_MPI_EXTRA_FLAG@ @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER"
else
KHIOPS_MPI_ERROR="We didn't find mpiexec in the expected paths. Parallel computation is unavailable: Khiops is launched in serial"
KHIOPS_MPI_COMMAND=""
fi
unset _MPIEXEC
fi

# without more than 2 procs, we use the serial khiops
Expand Down

0 comments on commit 202b73e

Please sign in to comment.