Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
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'],
[linux-amzn2023-x86_64_v2, linux-amzn2023-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']]
Expand Down
62 changes: 62 additions & 0 deletions Dockerfiles/linux-amzn2023-x86_64_v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM amazonlinux:2023 as build

WORKDIR /root

ENV LC_ALL=C \
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-x86_64_v2/compilers.yaml Dockerfiles/linux-amzn2023-x86_64_v2/packages.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/*
32 changes: 32 additions & 0 deletions Dockerfiles/linux-amzn2023-x86_64_v2/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
target: x86_64
modules: []
environment: {}
extra_rpaths: []
- compiler:
spec: [email protected]
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: null
fc: null
flags:
cxxflags: '-O3 -g0'
cflags: '-O3 -g0'
operating_system: amzn2023
target: x86_64
modules: []
environment: {}
extra_rpaths: []
3 changes: 3 additions & 0 deletions Dockerfiles/linux-amzn2023-x86_64_v2/packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages:
all:
require: target=x86_64_v2
18 changes: 10 additions & 8 deletions Dockerfiles/linux-ubuntu22.04-x86_64_v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ 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 spack.yaml build.mk /root/

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

# Assume system make is too old
Expand All @@ -39,12 +42,10 @@ RUN spack env create --with-view /root/tools tools && \
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
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)
10 changes: 8 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,9 @@ spack:
install_tree:
root: /opt/spack/store
concretizer:
unify: true
unify: true
packages:
all:
variants: ~nls
zlib:
variants: ~shared