Skip to content

Commit

Permalink
Merge pull request #414 from KhiopsML/383-bis-khiops-command-return-e…
Browse files Browse the repository at this point in the history
…rror-1-without-any-message

383 bis khiops command return error 1 without any message
  • Loading branch information
bruno-at-orange authored Oct 18, 2024
2 parents 3a9e8e4 + c29250e commit 521217d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/actions/test-khiops-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ runs:
#
# The env var OMPI_MCA_rmaps_base_oversubscribe is for openmpi it corresponds to
# the flag --oversubscribe (Nodes are allowed to be oversubscribed)
# KHIOPS_MPI_VERBOSE is set to true to detect errors from MPI
if: runner.os != 'Windows'
shell: bash
env:
OMPI_MCA_rmaps_base_oversubscribe: true
KHIOPS_MPI_VERBOSE: true
run: |
echo
echo --- Khiops environment with KHIOPS_PROC_NUMBER not set
Expand Down Expand Up @@ -92,6 +94,7 @@ runs:
env:
KHIOPS_PROC_NUMBER: 4
OMPI_MCA_rmaps_base_oversubscribe: true
KHIOPS_MPI_VERBOSE: true
run: |
khiops -s
khiops -v &> output
Expand Down
1 change: 1 addition & 0 deletions .github/actions/test-khiops-on-iris/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ runs:
env:
KHIOPS_PROC_NUMBER: 4
OMPI_MCA_rmaps_base_oversubscribe: true
KHIOPS_MPI_VERBOSE: true
run: |
cd test/LearningTest/TestKhiops/Standard/Iris/
"$KHIOPS_SCRIPT" -b -i test.prm -e results/err.txt
Expand Down
9 changes: 7 additions & 2 deletions packaging/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if(UNIX)
set(KHIOPS_COCLUSTERING_PATH "$(get_script_dir)")
set(GET_PROC_NUMBER_PATH "$(get_script_dir)")
set(IS_CONDA_VAR "\n# Inside conda environment\nexport _IS_CONDA=true")
set(SET_KHIOPS_DRIVERS_PATH"\n# Drivers search path\nexport KHIOPS_DRIVERS_PATH=$(get_script_dir)../lib")
set(SET_KHIOPS_DRIVERS_PATH "\n# Drivers search path\nexport KHIOPS_DRIVERS_PATH=$(dirname $(get_script_dir))/lib")
else()
if(IS_FEDORA_LIKE)
set(KHIOPS_PATH "${MPI_BIN}/khiops/")
Expand All @@ -92,10 +92,14 @@ if(UNIX)

# replace MPIEXEC MPIEXEC_NUMPROC_FLAG and MPI_IMPL KHIOPS_MPI_EXTRA_FLAG ADDITIONAL_ENV_VAR
if("${MPI_IMPL}" STREQUAL "openmpi")
set(KHIOPS_MPI_EXTRA_FLAG "--allow-run-as-root --quiet")
set(KHIOPS_MPI_EXTRA_FLAG "--allow-run-as-root")
set(KHIOPS_MPI_QUIET "--quiet")
set(ADDITIONAL_ENV_VAR "export OMPI_MCA_btl_vader_single_copy_mechanism=none # issue on docker")
set(ADDITIONAL_ENV_VAR_DISPLAY
" echo OMPI_MCA_btl_vader_single_copy_mechanism \"$OMPI_MCA_btl_vader_single_copy_mechanism\"")
if(IS_FEDORA_LIKE)
set(ADDITIONAL_ENV_VAR "${ADDITIONAL_ENV_VAR}\nexport PSM3_DEVICES=self # issue on rocky linux")
set(ADDITIONAL_ENV_VAR_DISPLAY "${ADDITIONAL_ENV_VAR_DISPLAY}\n echo PSM3_DEVICES \"$PSM3_DEVICES\"")
endif()
set(MPIEXEC_HOSTFILE_FLAG "--hostfile")
file(READ ${PROJECT_SOURCE_DIR}/packaging/linux/common/khiops_env/export_env_variables.sh EXPORT_ENV_VARIABLES)
Expand All @@ -110,6 +114,7 @@ if(UNIX)
# Add header comment to the variable definition (if any variable is defined)
if(ADDITIONAL_ENV_VAR)
set(ADDITIONAL_ENV_VAR "\n# Additional variables for MPI\n${ADDITIONAL_ENV_VAR}")
set(ADDITIONAL_ENV_VAR_DISPLAY "\n # Additional variables for MPI\n${ADDITIONAL_ENV_VAR_DISPLAY}")
endif()

# Get the real file name of MODL e.g MODL_openmpi
Expand Down
5 changes: 5 additions & 0 deletions packaging/linux/common/khiops
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ if [[ ! -f "$(get_script_dir)"/khiops_env ]]; then
exit 1
fi

# Does not print messages from mpi
if [ -z "$KHIOPS_MPI_VERBOSE" ]; then
KHIOPS_MPI_VERBOSE="false"
fi

# Initialize Khiops env variables
source $(get_script_dir)/khiops_env ""

Expand Down
15 changes: 14 additions & 1 deletion packaging/linux/common/khiops_env/khiops_env.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ help() {
echo " . set to 'true' to allow file name selection with uri schemas"
echo " . set to 'false' to allow local file name selection only with a file selection dialog"
echo "KHIOPS_MPI_HOST_FILE: provide hostfile to mpi."
echo "KHIOPS_MPI_VERBOSE: true (default) or false, print messages from mpi (OpenMPI only)."
echo
echo "In case of configuration problems, the variables KHIOPS_JAVA_ERROR and KHIOPS_MPI_ERROR contain error messages."
}

Expand All @@ -55,9 +57,18 @@ get_script_dir() {
@IS_CONDA_VAR@
@SET_KHIOPS_DRIVERS_PATH@

if [ -z "$KHIOPS_MPI_VERBOSE" ]; then
KHIOPS_MPI_VERBOSE="true"
fi

if ! [ "$KHIOPS_MPI_VERBOSE" == "true" ]; then
# Mute mpi by adding flags (OpenMPI only)
MPI_EXTRA_FLAGS="@KHIOPS_MPI_QUIET@"
fi

# Setting up mpi for multiple machines
if [[ -n $KHIOPS_MPI_HOST_FILE ]]; then
MPI_EXTRA_FLAGS="@MPIEXEC_HOSTFILE_FLAG@ $KHIOPS_MPI_HOST_FILE"
MPI_EXTRA_FLAGS="$MPI_EXTRA_FLAGS @MPIEXEC_HOSTFILE_FLAG@ $KHIOPS_MPI_HOST_FILE"
@EXPORT_ENV_VARIABLES@
fi

Expand Down Expand Up @@ -97,4 +108,6 @@ if [ "$1" = "--env" ]; then
echo KHIOPS_DRIVERS_PATH "$KHIOPS_DRIVERS_PATH"
echo KHIOPS_JAVA_ERROR "$KHIOPS_JAVA_ERROR"
echo KHIOPS_MPI_ERROR "$KHIOPS_MPI_ERROR"
echo KHIOPS_MPI_VERBOSE "$KHIOPS_MPI_VERBOSE"
@ADDITIONAL_ENV_VAR_DISPLAY@
fi
11 changes: 4 additions & 7 deletions packaging/linux/common/khiops_env/use_environment_module.sh.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

# Try to use environment modules to locate mpiexec if needed
if ! command -v mpiexec &> /dev/null
# Load @MPI_IMPL@ with environment modules
if source /etc/profile.d/modules.sh &> /dev/null
then
if source /etc/profile.d/modules.sh &> /dev/null
then
module unload mpi
module load mpi/@MPI_IMPL@-@CMAKE_SYSTEM_PROCESSOR@
fi
module unload mpi
module load mpi/@MPI_IMPL@-@CMAKE_SYSTEM_PROCESSOR@
fi

0 comments on commit 521217d

Please sign in to comment.