Skip to content

Commit 79b3d82

Browse files
add base cscs-ci ext (#138)
* add base cscs-ci ext
1 parent 9666426 commit 79b3d82

10 files changed

Lines changed: 355 additions & 96 deletions

File tree

ci/baseimage.cuda.Dockerfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
FROM ubuntu:22.04 as builder
2+
3+
ARG CUDA_ARCH=60
4+
5+
ENV DEBIAN_FRONTEND noninteractive
6+
7+
ENV FORCE_UNSAFE_CONFIGURE 1
8+
9+
ENV PATH="/spack/bin:${PATH}"
10+
11+
ENV MPICH_VERSION=3.4.3
12+
13+
ENV CMAKE_VERSION=3.27.9
14+
15+
RUN apt-get -y update
16+
17+
RUN apt-get install -y apt-utils
18+
19+
# install basic tools
20+
RUN apt-get install -y --no-install-recommends gcc g++ gfortran clang libomp-14-dev git make unzip file \
21+
vim wget pkg-config python3-pip python3-dev cython3 python3-pythran curl tcl m4 cpio automake meson \
22+
xz-utils patch patchelf apt-transport-https ca-certificates gnupg software-properties-common perl tar bzip2 \
23+
liblzma-dev libbz2-dev
24+
25+
# install CMake
26+
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz -O cmake.tar.gz && \
27+
tar zxvf cmake.tar.gz --strip-components=1 -C /usr
28+
29+
# get latest version of spack
30+
RUN git clone -b v0.21.0 https://github.com/spack/spack.git
31+
32+
# set the location of packages built by spack
33+
RUN spack config add config:install_tree:root:/opt/local
34+
# set cuda_arch for all packages
35+
RUN spack config add packages:all:variants:cuda_arch=${CUDA_ARCH}
36+
37+
# add local repo for cosma and tiled-mm
38+
COPY ./spack /cosma-repo
39+
RUN spack repo add /cosma-repo
40+
41+
# find all external packages
42+
RUN spack external find --all --exclude python
43+
44+
# find compilers
45+
RUN spack compiler find
46+
47+
# install yq (utility to manipulate the yaml files)
48+
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_386 && chmod a+x /usr/local/bin/yq
49+
50+
# change the fortran compilers: for gcc the gfortran is already properly set and the change has no effect; add it for clang
51+
RUN yq -i '.compilers[0].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
52+
yq -i '.compilers[0].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
53+
yq -i '.compilers[1].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
54+
yq -i '.compilers[1].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml
55+
56+
# install MPICH
57+
RUN spack install mpich@${MPICH_VERSION} %gcc
58+
59+
# for the MPI hook
60+
RUN echo $(spack find --format='{prefix.lib}' mpich) > /etc/ld.so.conf.d/mpich.conf
61+
RUN ldconfig
62+
63+
# create environments for several configurations and install dependencies
64+
RUN spack env create -d /cosma-env-cuda && \
65+
spack -e /cosma-env-cuda add "cosma@master %gcc +cuda +tests +scalapack +shared ^mpich" && \
66+
spack -e /cosma-env-cuda add "tiled-mm@master" && \
67+
spack -e /cosma-env-cuda develop -p /src cosma@master && \
68+
spack -e /cosma-env-cuda install --only=dependencies --fail-fast
69+
70+
RUN spack env create -d /cosma-env-cuda-gpu-direct && \
71+
spack -e /cosma-env-cuda-gpu-direct add "cosma@master %gcc +cuda +tests +scalapack +shared +gpu_direct ^mpich " && \
72+
spack -e /cosma-env-cuda-gpu-direct add "tiled-mm@master" && \
73+
spack -e /cosma-env-cuda-gpu-direct develop -p /src cosma@master && \
74+
spack -e /cosma-env-cuda-gpu-direct install --only=dependencies --fail-fast
75+
76+
RUN spack env create -d /cosma-env-cuda-nccl && \
77+
spack -e /cosma-env-cuda-nccl add "cosma@master %gcc +cuda +tests +scalapack +shared +nccl ^mpich " && \
78+
spack -e /cosma-env-cuda-nccl add "tiled-mm@master" && \
79+
spack -e /cosma-env-cuda-nccl develop -p /src cosma@master && \
80+
spack -e /cosma-env-cuda-nccl install --only=dependencies --fail-fast
81+
82+
RUN spack env create -d /cosma-env-cpu && \
83+
spack -e /cosma-env-cpu add "cosma@master %gcc ~cuda +tests +scalapack +shared ^mpich " && \
84+
spack -e /cosma-env-cpu develop -p /src cosma@master && \
85+
spack -e /cosma-env-cpu install --only=dependencies --fail-fast

ci/build.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG BASE_IMAGE
2+
FROM $BASE_IMAGE
3+
4+
ARG ENVPATH
5+
6+
# copy source files of the pull request into container
7+
COPY . /src
8+
9+
# build SIRIUS
10+
RUN spack -e $ENVPATH install
11+
12+
# # show the spack's spec
13+
RUN spack -e $ENVPATH find -lcdv
14+
15+
# we need a fixed name for the build directory
16+
# here is a hacky workaround to link ./spack-build-{hash} to ./spack-build
17+
RUN cd /src && ln -s $(spack -e $ENVPATH location -b cosma) spack-build

ci/cpu.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

ci/cscs-daint.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
include:
2+
- remote: 'https://gitlab.com/cscs-ci/recipes/-/raw/master/templates/v2/.ci-ext.yml'
3+
4+
stages:
5+
- baseimage
6+
- build
7+
- test
8+
9+
build base image:
10+
extends: .container-builder-dynamic-name
11+
stage: baseimage
12+
timeout: 2h
13+
variables:
14+
DOCKERFILE: ci/baseimage.cuda.Dockerfile
15+
WATCH_FILECHANGES: ci/baseimage.cuda.Dockerfile
16+
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/base/cosma-ci
17+
18+
build cosma:
19+
extends: .container-builder
20+
needs: ["build base image"]
21+
stage: build
22+
variables:
23+
DOCKERFILE: ci/build.Dockerfile
24+
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/cosma/cosma-ci:$CI_COMMIT_SHA
25+
ENVPATH: "/cosma-env-cuda"
26+
DOCKER_BUILD_ARGS: '["BASE_IMAGE=${BASE_IMAGE}", "ENVPATH=$ENVPATH"]'
27+
28+
build cosma cpu:
29+
extends: .container-builder
30+
needs: ["build base image"]
31+
stage: build
32+
variables:
33+
DOCKERFILE: ci/build.Dockerfile
34+
PERSIST_IMAGE_NAME: discard
35+
ENVPATH: "/cosma-env-cpu"
36+
DOCKER_BUILD_ARGS: '["BASE_IMAGE=${BASE_IMAGE}", "ENVPATH=$ENVPATH"]'
37+
38+
build cosma cuda gpu_direct:
39+
extends: .container-builder
40+
needs: ["build base image"]
41+
stage: build
42+
variables:
43+
DOCKERFILE: ci/build.Dockerfile
44+
PERSIST_IMAGE_NAME: discard
45+
ENVPATH: "/cosma-env-cuda-gpu-direct"
46+
DOCKER_BUILD_ARGS: '["BASE_IMAGE=${BASE_IMAGE}", "ENVPATH=$ENVPATH"]'
47+
48+
build cosma cuda nccl:
49+
extends: .container-builder
50+
needs: ["build base image"]
51+
stage: build
52+
variables:
53+
DOCKERFILE: ci/build.Dockerfile
54+
PERSIST_IMAGE_NAME: discard
55+
ENVPATH: "/cosma-env-cuda-nccl"
56+
DOCKER_BUILD_ARGS: '["BASE_IMAGE=${BASE_IMAGE}", "ENVPATH=$ENVPATH"]'
57+
58+
.run_tests:
59+
extends: .container-runner-daint-gpu
60+
needs: ["build cosma"]
61+
stage: test
62+
image: $CSCS_REGISTRY_PATH/cosma/cosma-ci:$CI_COMMIT_SHA
63+
variables:
64+
CRAY_CUDA_MPS: 1
65+
GIT_STRATEGY: none
66+
MPICH_MAX_THREAD_SAFETY: multiple
67+
CSCS_REGISTRY_LOGIN: 'YES'
68+
PULL_IMAGE: 'YES'
69+
SLURM_HINT: nomultithread
70+
SLURM_UNBUFFEREDIO: ''
71+
SLURM_WAIT: 0
72+
COSMA_GPU_MAX_TILE_K: 100
73+
COSMA_GPU_MAX_TILE_M: 100
74+
COSMA_GPU_MAX_TILE_N: 100
75+
76+
mapper:
77+
extends: .run_tests
78+
stage: test
79+
script: /cosma-env-cuda/.spack-env/view/bin/test.mapper
80+
variables:
81+
SLURM_JOB_NUM_NODES: 1
82+
SLURM_NTASKS: 1
83+
USE_MPI: 'YES'
84+
85+
pdgemm:
86+
extends: .run_tests
87+
stage: test
88+
script: /cosma-env-cuda/.spack-env/view/bin/test.pdgemm
89+
variables:
90+
SLURM_JOB_NUM_NODES: 2
91+
SLURM_NTASKS: 16
92+
USE_MPI: 'YES'
93+
94+
multiply:
95+
extends: .run_tests
96+
stage: test
97+
script: /cosma-env-cuda/.spack-env/view/bin/test.multiply
98+
variables:
99+
SLURM_JOB_NUM_NODES: 2
100+
SLURM_NTASKS: 16
101+
USE_MPI: 'YES'
102+
103+
scalar_matmul:
104+
extends: .run_tests
105+
stage: test
106+
script: /cosma-env-cuda/.spack-env/view/bin/test.scalar_matmul
107+
variables:
108+
SLURM_JOB_NUM_NODES: 1
109+
SLURM_NTASKS: 8
110+
USE_MPI: 'YES'
111+
112+
multiply_using_layout:
113+
extends: .run_tests
114+
stage: test
115+
script: /cosma-env-cuda/.spack-env/view/bin/test.multiply_using_layout
116+
variables:
117+
SLURM_JOB_NUM_NODES: 1
118+
SLURM_NTASKS: 4
119+
USE_MPI: 'YES'

ci/gpu.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

ci/sanitize.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

ci/test.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)