Skip to content

Add amzn2023 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 9 additions & 6 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ jobs:
# A matrix of Dockerfile paths, associated tags, and which architectures
# they support.
matrix:
dockerfile: [[e4s-ubuntu-18.04, e4s-ubuntu-18.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[e4s-ubuntu-20.04, e4s-ubuntu-20.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[linux-ubuntu22.04-x86_64_v2, linux-ubuntu22.04-x86_64_v2/Dockerfile, 'linux/amd64'],
[e4s-amazonlinux-2, e4s-amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'],
[e4s-centos-7, e4s-centos-7.dockerfile, 'linux/amd64'],
[e4s-fedora-36, e4s-fedora-36.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64']]
dockerfile: [
[e4s-ubuntu-18.04, e4s-ubuntu-18.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[e4s-ubuntu-20.04, e4s-ubuntu-20.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[linux-ubuntu22.04, linux-ubuntu22.04/Dockerfile, 'linux/amd64/v2,linux/arm64'],
[linux-amzn2023, linux-amzn2023/Dockerfile, 'linux/amd64/v2,linux/arm64'],
[e4s-amazonlinux-2, e4s-amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'],
[e4s-centos-7, e4s-centos-7.dockerfile, 'linux/amd64'],
[e4s-fedora-36, e4s-fedora-36.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64']
]
name: Build ${{ matrix.dockerfile[0] }}
steps:
- name: Checkout
Expand Down
63 changes: 63 additions & 0 deletions Dockerfiles/linux-amzn2023/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM amazonlinux:2023 as build

WORKDIR /root

ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PATH=/root/tools/bin:/root/spack/bin:/usr/bin:/bin

RUN yum install -y \
bzip2 \
clang \
git \
lld \
make \
patch \
python \
tar \
unzip \
xz

RUN mkdir spack && \
cd spack && \
curl -Lfs https://github.com/spack/spack/archive/refs/heads/develop.tar.gz | tar -xzf - --strip-components=1 -C . && \
curl -Lfs https://github.com/spack/spack/pull/34926.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35020.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35078.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35174.patch | patch -p1 && \
true

ADD spack.yaml build.mk /root/

ADD Dockerfiles/linux-amzn2023/compilers.yaml /root/spack/etc/spack

# Assume system make is too old
RUN spack env create --with-view /root/tools tools && \
spack -e tools add [email protected] && \
spack -e tools concretize && \
spack -e tools install

RUN --mount=type=cache,target=/buildcache \
--mount=type=cache,target=/root/.spack/cache \
spack mirror add cache /buildcache && \
make -f build.mk -j$(nproc) BUILDCACHE=/buildcache

# Remove Spack metadata / Python cache to save some bytes
RUN find -L /opt/spack -type d \( -name '__pycache__' -or -name '.spack' \) -exec rm -rf {} + && \
find -L /opt/spack -type f -name '*.a' -exec rm -rf {} +

# Stage 2, create a small(er) docker image
FROM amazonlinux:2023

ENV NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PATH=/opt/spack/view/bin:/root/spack/bin:$PATH

COPY --from=build /opt/spack /opt/spack

# We stick to system compilers & linkers
RUN yum install -y gcc g++ gfortran binutils && \
yum clean all && \
rm -rf /var/cache/yum/*
16 changes: 16 additions & 0 deletions Dockerfiles/linux-amzn2023/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
compilers:
- compiler:
spec: [email protected]
paths:
cc: /usr/bin/clang
cxx: /usr/bin/clang++
f77: null
fc: null
flags:
cxxflags: '-O3 -g0'
cflags: '-O3 -g0'
ldflags: '-fuse-ld=lld -Wl,-O3'
operating_system: amzn2023
modules: []
environment: {}
extra_rpaths: []
3 changes: 0 additions & 3 deletions Dockerfiles/linux-ubuntu22.04-x86_64_v2/packages.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@ RUN mkdir spack && \
curl -Lfs https://github.com/spack/spack/archive/refs/heads/develop.tar.gz | tar -xzf - --strip-components=1 -C . && \
curl -Lfs https://github.com/spack/spack/pull/34926.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35020.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35078.patch | patch -p1 && \
curl -Lfs https://github.com/spack/spack/pull/35174.patch | patch -p1 && \
true

ADD spack.yaml /root/
ADD Dockerfiles/linux-ubuntu22.04-x86_64_v2/compilers.yaml Dockerfiles/linux-ubuntu22.04-x86_64_v2/packages.yaml /root/spack/etc/spack/
ADD spack.yaml build.mk /root/

ADD Dockerfiles/linux-ubuntu22.04/compilers.yaml /root/spack/etc/spack/

# Assume system make is too old
RUN spack env create --with-view /root/tools tools && \
spack -e tools add [email protected] && \
spack -e tools concretize && \
spack -e tools install


RUN --mount=type=cache,target=/root/.spack/cache \
spack -e . concretize -f && \
spack -e . install && \
spack -e . gc --yes-to-all && \
spack -e . env view --link run enable /opt/spack/view
RUN --mount=type=cache,target=/buildcache \
--mount=type=cache,target=/root/.spack/cache \
spack mirror add cache /buildcache && \
make -f build.mk -j$(nproc) BUILDCACHE=/buildcache

# Remove Spack metadata, python cache and static libraries to save some bytes
RUN find -L /opt/spack -type d \( -name '__pycache__' -or -name '.spack' \) -exec rm -rf {} + && \
Expand All @@ -54,7 +55,8 @@ RUN find -L /opt/spack -type d \( -name '__pycache__' -or -name '.spack' \) -exe
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=C \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PATH=/opt/spack/view/bin:/root/spack/bin:$PATH

COPY --from=build /opt/spack /opt/spack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ compilers:
cflags: '-O3 -g0 -ffunction-sections'
ldflags: '-fuse-ld=lld -Wl,-O3'
operating_system: ubuntu22.04
target: x86_64
modules: []
environment: {}
extra_rpaths: []
modules: []
27 changes: 27 additions & 0 deletions build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SPACK ?= spack
SPACK_INSTALL_FLAGS += --no-check-signature
BUILDCACHE = $(CURDIR)/buildcache
MAKEFLAGS += -Orecurse

export SPACK_COLOR = always
export SPACK_BACKTRACE = yes

.PHONY: all

all: push
$(SPACK) -e . gc --yes-to-all
$(SPACK) -e . env view --link run enable /opt/spack/view

include env.mk

spack.lock: spack.yaml
$(SPACK) -e . concretize -f

env.mk: spack.lock
$(SPACK) -e . env depfile -o $@ --make-prefix spack

spack/push/%: spack/install/%
$(SPACK) -e . buildcache create --unsigned --allow-root --only=package $(BUILDCACHE) /$(HASH) # push $(SPEC)

push: $(addprefix spack/push/,$(spack/SPACK_PACKAGE_IDS))
$(SPACK) -e . buildcache update-index $(BUILDCACHE)
15 changes: 13 additions & 2 deletions spack.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
spack:
view: false
specs:
- 'awscli'
- 'clingo-bootstrap@spack +optimized'
- 'curl'
- 'file'
Expand All @@ -13,7 +14,7 @@ spack:
- 'patch'
- 'patchelf'
- 'py-boto3'
- '[email protected] %clang +optimizations'
- '[email protected] %clang +optimizations +zlib_ng'
- 'tar'
- 'unzip'
- 'vim'
Expand All @@ -23,4 +24,14 @@ spack:
install_tree:
root: /opt/spack/store
concretizer:
unify: true
unify: true
packages:
all:
variants: ~nls
require:
- one_of:
- target=x86_64_v2
- target=aarch64
- target=ppc64le
zlib:
variants: ~shared