Skip to content

Commit 202b73e

Browse files
committed
Fall back to looking for the MPI command in the putative Conda binary 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
1 parent 28e0d54 commit 202b73e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packaging/linux/common/khiops_env/khiops_env.in

+11-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,17 @@ if command -v mpiexec &>/dev/null; then
8484
KHIOPS_MPI_ERROR=""
8585
KHIOPS_MPI_COMMAND="$(type -P mpiexec) $MPI_EXTRA_FLAGS @KHIOPS_MPI_EXTRA_FLAG@ @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER"
8686
else
87-
KHIOPS_MPI_ERROR="We didn't find mpiexec in the regular path. Parallel computation is unavailable: Khiops is launched in serial"
88-
KHIOPS_MPI_COMMAND=""
87+
# Fallback for Conda-based environments where `mpiexec` is not in PATH,
88+
# because $CONDA_PREFIX/bin is not in PATH
89+
_MPIEXEC=@KHIOPS_PATH@mpiexec
90+
if command -v $_MPIEXEC &>/dev/null; then
91+
KHIOPS_MPI_ERROR=""
92+
KHIOPS_MPI_COMMAND="$_MPIEXEC $MPI_EXTRA_FLAGS @KHIOPS_MPI_EXTRA_FLAG@ @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER"
93+
else
94+
KHIOPS_MPI_ERROR="We didn't find mpiexec in the expected paths. Parallel computation is unavailable: Khiops is launched in serial"
95+
KHIOPS_MPI_COMMAND=""
96+
fi
97+
unset _MPIEXEC
8998
fi
9099

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

0 commit comments

Comments
 (0)