Skip to content

Commit

Permalink
BM as the prefix of openmpi and lapack images
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Jun 16, 2024
1 parent e5f4dde commit 21eaa68
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 138 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/extract-image-names.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,33 @@ set -euo pipefail
# The input to this script is a JSON string passed via BAKE_METADATA env variable
# Here's example input (trimmed to relevant bits):
# BAKE_METADATA: {
# "qc-base": {
# "bm": {
# "containerimage.descriptor": {
# "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
# "digest": "sha256:8e57a52b924b67567314b8ed3c968859cad99ea13521e60bbef40457e16f391d",
# "size": 6170,
# },
# "containerimage.digest": "sha256:8e57a52b924b67567314b8ed3c968859cad99ea13521e60bbef40457e16f391d",
# "image.name": "ghcr.io/containers4hpc/qc-base"
# "image.name": "ghcr.io/containers4hpc/bm"
# },
# "qc-full-stack": {
# "image.name": "ghcr.io/containers4hpc/qc-full-stack"
# "bm-openmpi": {
# "image.name": "ghcr.io/containers4hpc/bm-openmpi"
# "containerimage.digest": "sha256:85ee91f61be1ea601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
# "...": ""
# },
# "bm-lapack": {
# "image.name": "ghcr.io/containers4hpc/bm-lapack"
# "containerimage.digest": "sha256:778a87878eu601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
# "...": ""
# }
# }
#
# Example output (real output is on one line):
#
# images={
# "QC_BASE_IMAGE": "ghcr.io/containers4hpc/base@sha256:8e57a52b924b67567314b8ed3c968859cad99ea13521e60bbef40457e16f391d",
# "QC_FULL_STACK_IMAGE": "ghcr.io/containers4hpc/full-stack@sha256:85ee91f61be1ea601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
# "BM_IMAGE": "ghcr.io/cnts4sci/bm@sha256:8e57a52b924b67567314b8ed3c968859cad99ea13521e60bbef40457e16f391d",
# "BM_OPENMPI_IMAGE": "ghcr.io/cnts4sci/bm-openmpi@sha256:85ee91f61be1ea601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
# "BM_LAPACK_IMAGE": "ghcr.io/cnts4sci/bm-lapack@sha256:85ee91f61be1ea601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
# }
#
# This json output is later turned to environment variables using fromJson() GHA builtin
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target: ["qc-base", "qc-full-stack"]
target: ["bm", "bm-openmpi", "bm-lapack"]
uses: ./.github/workflows/test.yml
with:
runsOn: ubuntu-22.04
Expand All @@ -56,7 +56,7 @@ jobs:
# and only for full-stack image (same for integration tests below).
test-arm64:
if: >-
github.repository == 'containers4hpc/quantum-container'
github.repository == 'cnts4sci/build-machine'
&& (github.ref_type == 'tag' || github.ref_name == 'main')
needs: build
uses: ./.github/workflows/test.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: true
matrix:
target: ["qc-base", "qc-full-stack"]
target: ["bm", "bm-openmpi", "bm-lapack"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
uses: docker/metadata-action@v5
env: ${{ fromJSON(steps.build_vars.outputs.vars) }}
with:
# e.g. ghcr.io/containers4hpc/qc-full-stack
# e.g. ghcr.io/cnts4sci/bm
# type=raw,value=python-${{ env.PYTHON_VERSION }},enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
images: ${{ inputs.registry }}/${{ github.repository_owner }}/${{ matrix.target }}
tags: |
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,3 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies 📦
run: |
pip install -r requirements.txt
pip freeze
# - name: Run tests
# run: pytest -m "${{ inputs.integration && 'integration' || 'not integration' }}" --target ${{inputs.target}}
# env: ${{ fromJSON(inputs.images) }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ In the image, we provide as much as possible the regular math libraries as we ca
- Libxc
- ..??

## Document on where to find which libraries *TODO
18 changes: 18 additions & 0 deletions bm-lapack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1

# Compile Lapack
FROM base-image AS lapack-builder

WORKDIR /lapack-build
ARG LAPACK_VERSION

RUN wget -c -O lapack.tar.gz https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v${LAPACK_VERSION}.tar.gz && \
mkdir -p lapack && \
tar xf lapack.tar.gz -C lapack --strip-components=1 && \
cd lapack && \
cp INSTALL/make.inc.gfortran make.inc && \
make lapacklib blaslib && \
mkdir -p /usr/local/lapack/lib && \
cp *.a /usr/local/lapack/lib && \
rm -rf /lapack-build

18 changes: 18 additions & 0 deletions bm-openmpi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1

# Compile openMPI
FROM base-image AS openmpi-builder

WORKDIR /openmpi-build
ARG OPENMPI_VERSION

# TODO: v4.1 -< OPENMPI_MAJOR_MINOR_VERSION
RUN wget -c -O openmpi.tar.gz https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-${OPENMPI_VERSION}.tar.gz && \
mkdir -p openmpi && \
tar xf openmpi.tar.gz -C openmpi --strip-components=1 && \
cd openmpi && \
./configure --prefix=/opt/openmpi --enable-static --disable-shared && \
make -j$(nproc) && \
make install && \
rm -rf /openmpi-build

19 changes: 19 additions & 0 deletions bm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1
FROM base-image

# Build toolchains
RUN apt-get update && apt-get install -y \
build-essential \
wget \
curl \
gcc \
g++ \
make \
libtool \
autoconf \
automake \
gfortran \
bzip2 \
tar \
git && \
rm -rf /var/lib/apt/lists/*
3 changes: 3 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"variable": {
"OPENMPI_VERSION": {
"default": "4.1.6"
},
"LAPACK_VERSION": {
"default": "3.10.1"
}
}
}
43 changes: 32 additions & 11 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ variable "PLATFORMS" {
default = ["linux/amd64"]
}

variable "BASE_IMAGE" {
default = "ubuntu:20.04"
}

variable "RUNTIME_BASE_IMAGE" {
variable "SYSTEM_BASE_IMAGE" {
default = "ubuntu:20.04"
}

variable "TARGETS" {
default = ["openmpi"]
default = ["bm-openmpi", "bm-lapack"]
}

# TAGS for softwares
variable "OPENMPI_VERSION" {

}
variable "LAPACK_VERSION" {
}

function "tags" {
Expand All @@ -41,14 +40,36 @@ group "default" {
targets = "${TARGETS}"
}

target "openmpi" {
tags = tags("openmpi")
context = "openmpi"
target "bm" {
tags = tags("bm")
context = "bm"
contexts = {
base-image = "docker-image://${SYSTEM_BASE_IMAGE}"
}
platforms = "${PLATFORMS}"
}

target "bm-openmpi" {
tags = tags("bm-openmpi")
context = "bm-openmpi"
contexts = {
base-image = "target:bm"
}
platforms = "${PLATFORMS}"
args = {
BASE_IMAGE = "${BASE_IMAGE}"
RUNTIME_BASE_IMAGE = "${RUNTIME_BASE_IMAGE}"
OPENMPI_VERSION = "${OPENMPI_VERSION}"
}
}

target "bm-lapack" {
tags = tags("bm-lapack")
context = "bm-lapack"
contexts = {
base-image = "target:bm"
}
platforms = "${PLATFORMS}"
args = {
LAPACK_VERSION = "${LAPACK_VERSION}"
}
}

22 changes: 0 additions & 22 deletions mpich/Dockerfile

This file was deleted.

87 changes: 0 additions & 87 deletions openmpi/Dockerfile

This file was deleted.

0 comments on commit 21eaa68

Please sign in to comment.