Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Add BLAS/LAPACK to the image #1

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
57 changes: 20 additions & 37 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,23 @@ on:
branches: [ main ]
workflow_dispatch:

jobs:
build_x86_64:
name: Build image for x86_64
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: ${{ github.ref_name == 'main' }}
tags: ghcr.io/cantera/manylinux_2_28_x86_64-hdf5-boost
build-args: |
TARGET_ARCH=x86_64
cache-from: type=gha
cache-to: type=gha,mode=max

build_aarch64:
name: Build image for aarch64
jobs:
build:
name: Build image for ${{ matrix.arch }}
runs-on: ubuntu-latest

strategy:
matrix:
include:
- arch: x86_64
plat: linux/amd64
- arch: aarch64
plat: linux/arm64
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
Expand All @@ -48,19 +31,19 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup up QEMU
- name: Set up QEMU
if: matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
push: ${{ github.ref_name == 'main' }}
tags: ghcr.io/cantera/manylinux_2_28_aarch64-hdf5-boost
platforms: ${{ matrix.plat }}
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/cantera/cantera-base-manylinux_2_28-${{ matrix.arch }}
build-args: |
TARGET_ARCH=aarch64
TARGET_ARCH=${{ matrix.arch }}
target: builder
cache-from: type=gha
cache-to: type=gha,mode=max
48 changes: 23 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ include(ExternalProject)

set(DOWNLOAD_DIR "/cache")

set(BOOST_VERSION 1.85.0)
set(BOOST_VERSION 1.86.0)
ExternalProject_Add(
boost
URL https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}-cmake.tar.xz
URL_HASH SHA256=0a9cc56ceae46986f5f4d43fe0311d90cf6d2fa9028258a95cab49ffdacf92ad
URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57
CMAKE_GENERATOR Ninja
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
Expand All @@ -19,36 +19,32 @@ ExternalProject_Add(
DOWNLOAD_DIR ${DOWNLOAD_DIR}
)

set(LIBAEC_VERSION 1.0.6)
set(LIBAEC_PATCHFILE)
ExternalProject_Add(
libaec
URL https://gitlab.dkrz.de/k202009/libaec/uploads/45b10e42123edd26ab7b3ad92bcf7be2/libaec-${LIBAEC_VERSION}.tar.gz
URL_HASH SHA256=032961877231113bb094ef224085e6d66fd670f85a3e17f53d0f131abf24f2fd
PATCH_COMMAND patch -p0 < ${LIBAEC_PATCHFILE}
CMAKE_GENERATOR Ninja
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_LIBDIR:STRING=lib
-DBUILD_TESTING:BOOL=OFF
DOWNLOAD_DIR ${DOWNLOAD_DIR}
)

set(LIBHDF5_VERSION 1.14.2)
set(LIBHDF5_SHORT_VERSION 1.14)
set(LIBHDF5_VERSION 1.14.5)
set(ZLIB_VERSION 1.3)
set(LIBAEC_VERSION 1.1.3)
ExternalProject_Add(
libhdf5
URL https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${LIBHDF5_SHORT_VERSION}/hdf5-${LIBHDF5_VERSION}/src/hdf5-${LIBHDF5_VERSION}.tar.gz
URL_HASH SHA256=1c342e634008284a8c2794c8e7608e2eaf26d01d445fb3dfd7f33cb2fb51ac53
URL https://github.com/HDFGroup/hdf5/releases/download/hdf5_${LIBHDF5_VERSION}/hdf5-${LIBHDF5_VERSION}.tar.gz
URL_HASH SHA256=ec2e13c52e60f9a01491bb3158cb3778c985697131fc6a342262d32a26e58e44
CMAKE_GENERATOR Ninja
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_PREFIX:STRING=/usr/local
-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON
-DHDF5_BUILD_EXAMPLES:BOOL=OFF
-DHDF5_BUILD_TOOLS:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
DEPENDS libaec
-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ
-DZLIB_PACKAGE_NAME:STRING=zlib
-DZLIB_TGZ_NAME:STRING=zlib-${ZLIB_VERSION}.tar.gz
-DZLIB_TGZ_ORIGPATH:STRING=https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}
-DZLIB_USE_LOCALCONTENT:BOOL=OFF
-DLIBAEC_PACKAGE_NAME:STRING=libaec
-DLIBAEC_TGZ_NAME:STRING=libaec-${LIBAEC_VERSION}.tar.gz
-DLIBAEC_TGZ_ORIGPATH:STRING=https://github.com/MathisRosenhauer/libaec/releases/download/v${LIBAEC_VERSION}
-DLIBAEC_USE_LOCALCONTENT:BOOL=OFF
-DHDF_PACKAGE_NAMESPACE:STRING=ct
DOWNLOAD_DIR ${DOWNLOAD_DIR}
)

Expand All @@ -72,7 +68,7 @@ ExternalProject_Add(
URL_HASH SHA256=fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16
CMAKE_GENERATOR Ninja
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=release
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_LIBDIR:STRING=lib
-DYAML_CPP_DISABLE_UNINSTALL:BOOL=OFF
-DYAML_CPP_FORMAT_SOURCE:BOOL=OFF
Expand All @@ -93,6 +89,8 @@ ExternalProject_Add(
-DBUILD_SHARED_LIBS:BOOL=OFF
-DEXAMPLES_ENABLE_C:BOOL=OFF
-DEXAMPLES_INSTALL:BOOL=OFF
-DENABLE_LAPACK:BOOL=ON
-DBLA_VENDOR:STRING=OpenBLAS
DOWNLOAD_DIR ${DOWNLOAD_DIR}
)

Expand All @@ -111,11 +109,11 @@ ExternalProject_Add(
DOWNLOAD_DIR ${DOWNLOAD_DIR}
)

set(HIGHFIVE_VERSION 2.9.0)
set(HIGHFIVE_VERSION 2.10.0)
ExternalProject_Add(
highfive
URL https://github.com/BlueBrain/HighFive/archive/refs/tags/v${HIGHFIVE_VERSION}.tar.gz
URL_HASH SHA256=6301def8ceb9f4d7a595988612db288b448a3c0546f6c83417dab38c64994d7e
URL_HASH SHA256=c29e8e1520e7298fabb26545f804e35bb3af257005c1c2df62e39986458d7c38
CMAKE_GENERATOR Ninja
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
Expand Down
24 changes: 20 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@
# from TARGETARCH which is defined by docker. The reason is because TARGETARCH=amd64
# but we need TARGET_ARCH=x86_64
ARG TARGET_ARCH
FROM quay.io/pypa/manylinux_2_28_${TARGET_ARCH}:2024-07-15-c746fd8
FROM quay.io/pypa/manylinux_2_28_${TARGET_ARCH}:2024-10-05-46a4cc2 AS builder

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build image for x86_64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG quay.io/pypa/manylinux_2_28_${TARGET_ARCH}:2024-10-05-46a4cc2 results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build image for aarch64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG quay.io/pypa/manylinux_2_28_${TARGET_ARCH}:2024-10-05-46a4cc2 results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

ARG NINJA_VERSION=1.12.1
# Has to be repeated here so it's imported from the "top level" above the FROM
ARG TARGET_ARCH

COPY CMakeLists.txt libaec_cmakelists.patch /tmp/
COPY CMakeLists.txt /build/
WORKDIR /build/

RUN --mount=type=cache,target=/cache \
if [[ "$TARGET_ARCH" == "aarch64" ]]; then NINJA_ARCH="-aarch64"; else NINJA_ARCH=""; fi \
&& echo "Getting Ninja for '${NINJA_ARCH}'" \
&& curl -fsSL -o /cache/ninja-linux.zip https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH}.zip \
&& unzip /cache/ninja-linux.zip -d /usr/local/bin \
&& ninja --version \
&& mkdir build \
&& yum install -y openblas-devel \
&& cmake -G Ninja -S . -B build \
&& pushd build \
&& cmake -G Ninja -DLIBAEC_PATCHFILE=/tmp/libaec_cmakelists.patch ../tmp \
&& ninja \
&& popd \
&& rm -rf build

# FROM builder AS tester

# RUN yum install -y python3.12-pip \
# && python3.12 -m pip install --root-user-action=ignore build auditwheel

# COPY cantera-3.1.0a4.tar.gz /project/

# RUN --mount=type=cache,target=/root/.cache \
# pushd project \
# && tar --strip-components=1 -zxf cantera-*.tar.gz \
# && rm -f cantera-*.tar.gz \
# && python3.12 -m build --wheel . \
# && pushd dist \
# && auditwheel repair -w . cantera*.whl
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'manylinux' Docker images are used to build Python extension modules compatible with many popular Linux distributions. This repository builds several dependencies on top of the standard manylinux images, for using in building Cantera.
'manylinux' Docker images are used to build Python extension modules compatible with many popular Linux distributions. This repository builds several dependencies on top of the standard manylinux images, for use in building Cantera.

Images are published on GitHub container registry:
Images are published on the GitHub container registry:

- [manylinux_2_28_x86_64-hdf5-boost](https://github.com/orgs/cantera/packages/container/package/manylinux_2_28_x86_64-hdf5-boost).
- [manylinux_2_28_aarch64-hdf5-boost](https://github.com/orgs/cantera/packages/container/package/manylinux_2_28_aarch64-hdf5-boost).
- [cantera-base-manylinux_2_28-x86_64](https://github.com/orgs/cantera/packages/container/package/manylinux_2_28_x86_64-hdf5-boost).
- [cantera-base-manylinux_2_28-aarch64](https://github.com/orgs/cantera/packages/container/package/manylinux_2_28_aarch64-hdf5-boost).
11 changes: 0 additions & 11 deletions libaec_cmakelists.patch

This file was deleted.