From b0d4bb10518c89f15e9e2d29b2aef41c7d806b6d Mon Sep 17 00:00:00 2001 From: Felipe Olmos <92923444+folmos-at-orange@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:30:36 +0200 Subject: [PATCH] WIP openmpi conda --- .github/workflows/conda.yml | 4 ++-- packaging/conda/build.sh | 24 ++++++++++++++++++------ packaging/conda/conda_build_config.yaml | 3 +++ packaging/conda/meta.yaml | 24 ++---------------------- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index e6e2fb379..bea2541b0 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -68,11 +68,11 @@ jobs: # The conda version cannot have '-' as a character so we eliminate it echo "KHIOPS_VERSION=$(echo $KHIOPS_RAW_VERSION | sed 's/-//')" >> "$GITHUB_ENV" - - name: Build conda packages (Windows) + - name: Build Conda Package (Windows) if: runner.os == 'Windows' run: conda build --output-folder ./build/conda ./packaging/conda # In Linux/macOS we need the conda-forge channel to install their pinned versions - - name: Build conda packages (Linux/macOS) + - name: Build Conda Package (Linux/macOS) if: runner.os != 'Windows' run: conda build --channel conda-forge --output-folder ./build/conda ./packaging/conda - name: Upload conda packages artifact diff --git a/packaging/conda/build.sh b/packaging/conda/build.sh index 85a4d1174..dedb5a0ee 100644 --- a/packaging/conda/build.sh +++ b/packaging/conda/build.sh @@ -4,20 +4,32 @@ set -euo pipefail # Choose the build preset for macOS/Linux -if [[ "$(uname)" == "Darwin" ]] +if [[ "$(uname)" == "Linux" ]] then - CMAKE_PRESET="macos-clang-release" -else CMAKE_PRESET="linux-gcc-release" + cmake --fresh --preset $CMAKE_PRESET -DBUILD_JARS=OFF -DTESTING=OFF -DMPI_SUFFIX=_openmpi +else + CMAKE_PRESET="macos-clang-release" + cmake --fresh --preset $CMAKE_PRESET -DBUILD_JARS=OFF -DTESTING=OFF fi # Build MODL and MODL_Coclustering -cmake --fresh --preset $CMAKE_PRESET -DBUILD_JARS=OFF -DTESTING=OFF cmake --build --preset $CMAKE_PRESET --parallel --target MODL MODL_Coclustering # Copy the MODL binaries to the Conda PREFIX path -cp "./build/$CMAKE_PRESET/bin/MODL" "$PREFIX/bin" -cp "./build/$CMAKE_PRESET/bin/MODL_Coclustering" "$PREFIX/bin" +ls -ltr "./build/$CMAKE_PRESET/bin" +mv ./build/$CMAKE_PRESET/bin/MODL* "$PREFIX/bin" + +# Rename MODL in Linux since it has a prefix depending of the MPI version +if [[ "$(uname)" == "Linux" ]] +then + if [[ -f "$PREFIX/bin/MODL_mpich" ]] + then + mv "$PREFIX/bin/MODL_mpich" "$PREFIX/bin/MODL" + else + mv "$PREFIX/bin/MODL_openmpi" "$PREFIX/bin/MODL" + fi +fi # Custom rpath relocation and signing executables for macOS in arm64 # diff --git a/packaging/conda/conda_build_config.yaml b/packaging/conda/conda_build_config.yaml index 03d8c9e6a..6eab5c0b3 100644 --- a/packaging/conda/conda_build_config.yaml +++ b/packaging/conda/conda_build_config.yaml @@ -1,4 +1,7 @@ --- +mpi: + - openmpi=4.1.6 # [not win] + - msmpi # [win] # We need MacOS SDK 10.10 to be able to build on macOS Intel # Download: https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.10.sdk.tar.xz # Decompress then to /opt: tar -zxvf MacOSX10.10.sdk.tar.xz -C /opt diff --git a/packaging/conda/meta.yaml b/packaging/conda/meta.yaml index 662716986..0cc60d079 100644 --- a/packaging/conda/meta.yaml +++ b/packaging/conda/meta.yaml @@ -26,35 +26,15 @@ build: detect_binary_files_with_prefix: false # [osx] {% endif %} -# Note on version pinning: -# OSX: -# - mpich=3.4.3 because 4.* is still unstable -# - requires conda-forge -# Linux: -# - mpich=4.0.3 because of bugs of the 3.* series -# - requires conda-forge requirements: build: - - mpich 4.0.3 # [linux] - - mpich-mpicc 4.0.3 # [linux] - - mpich-mpicxx 4.0.3 # [linux] - - mpich 3.4.3 # [osx] - - mpich-mpicc 3.4.3 # [osx] - - mpich-mpicxx 3.4.3 # [osx] - - msmpi # [win] - cmake - ninja - {{ compiler('cxx') }} host: - - mpich 4.0.3 # [linux] - - mpich-mpicxx 4.0.3 # [linux] - - mpich 3.4.3 # [osx] - - mpich-mpicxx 3.4.3 # [osx] - - msmpi # [win] + - {{ mpi }} run: - - mpich 4.0.3 # [linux] - - mpich 3.4.3 # [osx] - - msmpi # [win] + - {{ mpi }} outputs: - name: khiops-core