Skip to content

Commit

Permalink
WIP openmpi conda
Browse files Browse the repository at this point in the history
  • Loading branch information
folmos-at-orange committed Apr 24, 2024
1 parent 67ee28b commit 18fb122
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 45 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
# We use the oldest ubuntu available to have forward compatibility of the libc
- os: ubuntu-20.04
os-family: linux-64
- os: windows-2022
os-family: win-64
- os: macos-13
os-family: osx-64
- os: macos-14
os-family: osx-arm64
runs-on: ${{ matrix.os }}
env:
# Linux: We use the Khiops dev debian:10 container to build with glibc 2.28
# It ensures compatibility with glibc >= 2.28 (in particular Rocky 8)
- {os: ubuntu-22.04, os-family: linux-64, json-image: '{"image": "ghcr.io/khiopsml/khiops/khiopsdev-debian10:latest"}'}
- {os: windows-2022, os-family: win-64, json-image: '{"image": null}'}
- {os: macos-13, os-family: osx-64, json-image: '{"image": null}'}
- {os: macos-14, os-family: osx-arm64, json-image: '{"image": null}'}
runs-on: ${{ matrix.env.os }}
container: ${{ fromJSON(matrix.env.json-image) }}
steps:
- name: Checkout Sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -68,17 +66,17 @@ 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
uses: actions/upload-artifact@v4
with:
name: khiops-conda-${{ matrix.os-family }}
name: khiops-conda-${{ matrix.env.os-family }}
path: ./build/conda
retention-days: 7
# Test Conda package on brand new environments
Expand Down
29 changes: 20 additions & 9 deletions packaging/conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,31 @@
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"
# Move the MODL binaries to the Conda PREFIX path
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
#
Expand All @@ -30,8 +41,8 @@ cp "./build/$CMAKE_PRESET/bin/MODL_Coclustering" "$PREFIX/bin"
# application pressing on "Allow" works).
#
# However, in the default settings, `conda build` relocalizes the executable by changing rpath of
# the library paths at $PREFIX by relative ones and in doing so it nullifies any signature. So we
# do ourselves this procedure first and then sign the binary.
# the library paths at $PREFIX by relative ones and in doing so it nullifies any signature. So we do
# ourselves this procedure first and then sign the binary.
#
# Note that in meta.yaml for osx-arm64 we have custom build.binary_relocation and
# build.detect_binary_files_with_prefix option
Expand Down
9 changes: 9 additions & 0 deletions packaging/conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
---
mpi:
- openmpi=4.1.4 # [not win]
- msmpi # [win]
cxx_compiler:
- gcc # [linux]
- clang # [osx]
cxx_compiler_version:
- 12 # [linux]
- 16 # [osx]
# 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
Expand Down
24 changes: 2 additions & 22 deletions packaging/conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18fb122

Please sign in to comment.