From 7aea7b0aaa3d59a53bba5323bceebe0c5ddfe1b2 Mon Sep 17 00:00:00 2001 From: bruno Date: Tue, 9 Apr 2024 15:26:40 +0200 Subject: [PATCH] update by pre-commit --- .github/workflows/pack-debian.yml | 11 +++++++++++ .github/workflows/pack-rpm.yml | 10 ++++++++++ packaging/install.cmake | 2 ++ packaging/linux/common/khiops-env.in | 4 +--- packaging/linux/debian/khiops-core/postinst | 7 ------- packaging/linux/redhat/khiops-core.post | 4 ---- packaging/packaging.cmake | 7 ++----- src/Learning/DTForest/DTDecisionTreeCost.cpp | 5 ++--- .../DTDecisionTreeCreationTaskSequential.cpp | 14 ++++++-------- src/Learning/DTForest/DTDecisionTreeGlobalCost.cpp | 5 ++--- src/Norm/base/MemoryManager.cpp | 7 ++++--- src/Norm/base/SystemResource.cpp | 4 ++-- 12 files changed, 42 insertions(+), 38 deletions(-) delete mode 100644 packaging/linux/debian/khiops-core/postinst delete mode 100644 packaging/linux/redhat/khiops-core.post diff --git a/.github/workflows/pack-debian.yml b/.github/workflows/pack-debian.yml index ccef716bf..aff7e69a2 100644 --- a/.github/workflows/pack-debian.yml +++ b/.github/workflows/pack-debian.yml @@ -99,6 +99,17 @@ jobs: source /etc/os-release echo "ID=$ID" >> "$GITHUB_ENV" echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV" + if [ -z "${{ github.event.inputs.mpi_implementation }}" ] ; + then + echo "MPI_IMPLEMENTATION=openmpi" >> "$GITHUB_ENV" + else + echo "MPI_IMPLEMENTATION=${{ github.event.inputs.mpi_implementation }}" >> "$GITHUB_ENV" + fi + if [ "${{ env.MPI_IMPLEMENTATION }}" = "openmpi" ] + then + export KHIOPS_MPI_EXTRA_FLAG="--allow-run-as-root" + fi + - name: Download artifacts uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/pack-rpm.yml b/.github/workflows/pack-rpm.yml index 45c1ff46f..131fe02c9 100644 --- a/.github/workflows/pack-rpm.yml +++ b/.github/workflows/pack-rpm.yml @@ -99,6 +99,16 @@ jobs: echo "ID=$ID" >> "$GITHUB_ENV" VERSION=$(echo $PLATFORM_ID | cut -d":" -f2) echo "VERSION=$VERSION" >> "$GITHUB_ENV" + if [ -z "${{ github.event.inputs.mpi_implementation }}" ] ; + then + echo "MPI_IMPLEMENTATION=openmpi" >> "$GITHUB_ENV" + else + echo "MPI_IMPLEMENTATION=${{ github.event.inputs.mpi_implementation }}" >> "$GITHUB_ENV" + fi + if [ "${{ env.MPI_IMPLEMENTATION }}" = "openmpi" ] + then + export KHIOPS_MPI_EXTRA_FLAG="--allow-run-as-root" + fi - name: Download artifacts uses: actions/download-artifact@v4 with: diff --git a/packaging/install.cmake b/packaging/install.cmake index 71ab8d3da..2371762a3 100644 --- a/packaging/install.cmake +++ b/packaging/install.cmake @@ -62,6 +62,8 @@ configure_file(${PROJECT_SOURCE_DIR}/packaging/common/KNI/template-README.md ${T # replace MPIEXEC MPIEXEC_NUMPROC_FLAG and MPI_IMPL configure_file(${PROJECT_SOURCE_DIR}/packaging/linux/common/khiops-env.in ${TMP_DIR}/khiops-env @ONLY NEWLINE_STYLE UNIX) +configure_file(${PROJECT_SOURCE_DIR}/packaging/linux/debian/khiops-core/postinst.in ${TMP_DIR}/postinst @ONLY + NEWLINE_STYLE UNIX) if(NOT IS_FEDORA_LIKE) install(TARGETS MODL MODL_Coclustering RUNTIME DESTINATION usr/bin COMPONENT KHIOPS_CORE) diff --git a/packaging/linux/common/khiops-env.in b/packaging/linux/common/khiops-env.in index 5d52efe67..256145f7e 100644 --- a/packaging/linux/common/khiops-env.in +++ b/packaging/linux/common/khiops-env.in @@ -72,12 +72,10 @@ if [[ -z $KHIOPS_PROC_NUMBER ]]; then KHIOPS_PROC_NUMBER=$(( $(lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l) + 1 )) fi -${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} - if command -v @MPIEXEC@ &> /dev/null then MPIEXEC_PATH=$(command -v @MPIEXEC@) - KHIOPS_MPI_COMMAND="${MPIEXEC_PATH} -bind-to hwthread -map-by core @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER" + KHIOPS_MPI_COMMAND="${MPIEXEC_PATH} -bind-to hwthread -map-by core ${KHIOPS_MPI_EXTRA_FLAG} @MPIEXEC_NUMPROC_FLAG@ $KHIOPS_PROC_NUMBER" else echo "We didn't find @MPIEXEC@ in the regular path. Parallel computation is unavailable: Khiops is launched in serial" KHIOPS_MPI_COMMAND="" diff --git a/packaging/linux/debian/khiops-core/postinst b/packaging/linux/debian/khiops-core/postinst deleted file mode 100644 index 5ef25bdfc..000000000 --- a/packaging/linux/debian/khiops-core/postinst +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e - -# set openmpi for default mpi -#update-alternatives --set mpirun /usr/bin/mpirun.openmpi - - diff --git a/packaging/linux/redhat/khiops-core.post b/packaging/linux/redhat/khiops-core.post deleted file mode 100644 index e680fa5df..000000000 --- a/packaging/linux/redhat/khiops-core.post +++ /dev/null @@ -1,4 +0,0 @@ -#module unload mpi -#source /etc/profile.d/modules.sh -#openmpi_module=$(module avail |& sed -E -e 's/[[:blank:]]+/\n/g' | grep mpich | tail -n 1) -#module load "$openmpi_module" \ No newline at end of file diff --git a/packaging/packaging.cmake b/packaging/packaging.cmake index f6762c1c4..cb079b15a 100644 --- a/packaging/packaging.cmake +++ b/packaging/packaging.cmake @@ -121,9 +121,8 @@ set(CPACK_DEBIAN_KHIOPS_KNI_RECOMMENDS kni-doc) # packages posinst and triggers -# set(CPACK_DEBIAN_KHIOPS_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/packaging/linux/debian/khiops/postinst") - -set(CPACK_DEBIAN_KHIOPS_CORE_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/packaging/linux/debian/khiops-core/postinst") +set(CPACK_DEBIAN_KHIOPS_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/packaging/linux/debian/khiops/postinst") +set(CPACK_DEBIAN_KHIOPS_CORE_PACKAGE_CONTROL_EXTRA "${TMP_DIR}/postinst") set(CPACK_DEBIAN_KNI_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/packaging/linux/debian/kni/triggers") # set(CPACK_DEBIAN_PACKAGE_DEBUG ON) @@ -163,8 +162,6 @@ set(CPACK_RPM_KHIOPS_CORE_PACKAGE_REQUIRES "util-linux") # packages post/postun install scripts -# set(CPACK_RPM_KHIOPS_CORE_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/packaging/linux/redhat/khiops-core.post") - set(CPACK_RPM_KHIOPS_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/packaging/linux/redhat/khiops.post") set(CPACK_RPM_KNI_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/packaging/linux/redhat/kni.post") set(CPACK_RPM_KNI_POSTUN_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/packaging/linux/redhat/kni.postun") diff --git a/src/Learning/DTForest/DTDecisionTreeCost.cpp b/src/Learning/DTForest/DTDecisionTreeCost.cpp index 8af09c693..12bc77c6d 100644 --- a/src/Learning/DTForest/DTDecisionTreeCost.cpp +++ b/src/Learning/DTForest/DTDecisionTreeCost.cpp @@ -223,9 +223,8 @@ double DTDecisionTreeCost::ComputeNodeCost(DTDecisionTreeNode* node, DTDecisionT // Extraction du nombre d'intervalles de la regle de discretisation Is // nPartNumber = oaGroups->GetSize(); - attributeStats = - NULL; // NV9 cast(KWAttributeStats*, - // node->GetNodeAttributeStats()->Lookup(->LookupAttributeStats(sAttributeName)); + attributeStats = NULL; // NV9 cast(KWAttributeStats*, + // node->GetNodeAttributeStats()->Lookup(->LookupAttributeStats(sAttributeName)); // cout << "sAttributeName = " << sAttributeName << endl; diff --git a/src/Learning/DTForest/DTDecisionTreeCreationTaskSequential.cpp b/src/Learning/DTForest/DTDecisionTreeCreationTaskSequential.cpp index f00330ad0..5d9ec5b4f 100644 --- a/src/Learning/DTForest/DTDecisionTreeCreationTaskSequential.cpp +++ b/src/Learning/DTForest/DTDecisionTreeCreationTaskSequential.cpp @@ -525,14 +525,12 @@ boolean DTDecisionTreeCreationTaskSequential::CreatePreparedAttributes(KWLearnin AddSimpleMessage(sTmp + " ComputeTree time: \t" + DoubleToString(DTTimer_ComputeTree.GetElapsedTime())); AddSimpleMessage(sTmp + " prepa attribut de CreatePreparedAttributes time: \t" + DoubleToString(DTTimer_CreateAttribute.GetElapsedTime())); - AddSimpleMessage( - sTmp + " DiscretizeGFT time: \t" + - DoubleToString(DTTimerDiscretizeGFT.GetElapsedTime())); // a ajouter dasn la V10 + "\t" + - // IntToString(DTTimerDiscretizeGFT.GetLoop())); - AddSimpleMessage( - sTmp + " Discretize time: \t" + - DoubleToString(DTTimerDiscretize.GetElapsedTime())); // a ajouter dasn la V10 + "\t" + - // IntToString(DTTimerDiscretize.GetLoop())); + AddSimpleMessage(sTmp + " DiscretizeGFT time: \t" + + DoubleToString(DTTimerDiscretizeGFT.GetElapsedTime())); // a ajouter dasn la V10 + "\t" + + // IntToString(DTTimerDiscretizeGFT.GetLoop())); + AddSimpleMessage(sTmp + " Discretize time: \t" + + DoubleToString(DTTimerDiscretize.GetElapsedTime())); // a ajouter dasn la V10 + "\t" + + // IntToString(DTTimerDiscretize.GetLoop())); AddSimpleMessage(sTmp + " BuildRootAttributeStats time: \t" + DoubleToString(DTTimer_BuildRootAttributeStats.GetElapsedTime())); AddSimpleMessage(sTmp + " SetUpInternalNode : \t" + DoubleToString(DTTimerTree1.GetElapsedTime())); diff --git a/src/Learning/DTForest/DTDecisionTreeGlobalCost.cpp b/src/Learning/DTForest/DTDecisionTreeGlobalCost.cpp index d083eec86..b78ee7d40 100644 --- a/src/Learning/DTForest/DTDecisionTreeGlobalCost.cpp +++ b/src/Learning/DTForest/DTDecisionTreeGlobalCost.cpp @@ -417,9 +417,8 @@ void DTDecisionTreeGlobalCost::ComputeHypotheticalAugmentedTreeCost(DTDecisionTr else { // Nombre de valeurs distinctes pour l'attribut - nVariableValueNumber = - 0; // NV9 cast(KWAttributeStats*, - // sourceNode->GetNodeClassStats()->LookupAttributeStats(sAttributeName))->GetDescriptiveStats()->GetValueNumber(); + nVariableValueNumber = 0; // NV9 cast(KWAttributeStats*, + // sourceNode->GetNodeClassStats()->LookupAttributeStats(sAttributeName))->GetDescriptiveStats()->GetValueNumber(); } assert(nVariableValueNumber > 0); diff --git a/src/Norm/base/MemoryManager.cpp b/src/Norm/base/MemoryManager.cpp index b503adca8..05a0b9e99 100644 --- a/src/Norm/base/MemoryManager.cpp +++ b/src/Norm/base/MemoryManager.cpp @@ -1288,9 +1288,10 @@ void HeapClose() // Visual C++: supression des Warning #ifdef __MSC__ -#pragma warning(disable : 6385) // disable C6385 warning (pour un controle excessif sur pHeap->fixedSizeHeapHeadSegments - // dans HeapCheckFixedSizeHeapLecture) -#endif // __MSC__ +#pragma warning( \ + disable : 6385) // disable C6385 warning (pour un controle excessif sur pHeap->fixedSizeHeapHeadSegments \ + // dans HeapCheckFixedSizeHeapLecture) +#endif // __MSC__ // Verification d'un segment d'un FixedSizeHeap int HeapCheckFixedSizeHeap(MemSegment* psegSearched) diff --git a/src/Norm/base/SystemResource.cpp b/src/Norm/base/SystemResource.cpp index 03e1524c1..2076a926d 100644 --- a/src/Norm/base/SystemResource.cpp +++ b/src/Norm/base/SystemResource.cpp @@ -861,8 +861,8 @@ longint MemGetFreePhysicalMemory() if (pagesize == -1 or pagepurge == -1 or pagefree == -1) return 0; return pagesize * (pagepurge + pagefree); -#else // __APPLE_ - // Lecture du fichier /proc/meminfo pour extraire la memoire dispoible et la memoire en cache +#else // __APPLE_ \ + // Lecture du fichier /proc/meminfo pour extraire la memoire dispoible et la memoire en cache \ // On additionne la memoire disponible et 80% de la memoire cache (borne a 2Go) FILE* file; const int nLineSize = 4096;