Skip to content

Commit cde8084

Browse files
add cscs-ci ext (#16)
1 parent 85331eb commit cde8084

File tree

4 files changed

+138
-1
lines changed

4 files changed

+138
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.DS_Store*
22
*.swp
33
__pycache__
4-
build*
54
exports
65
doc
76
.idea*

ci/baseimage.cuda.Dockerfile

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
# find all external packages
38+
RUN spack external find --all --exclude python
39+
40+
# find compilers
41+
RUN spack compiler find
42+
43+
# install yq (utility to manipulate the yaml files)
44+
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
45+
46+
# change the fortran compilers: for gcc the gfortran is already properly set and the change has no effect; add it for clang
47+
RUN yq -i '.compilers[0].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
48+
yq -i '.compilers[0].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
49+
yq -i '.compilers[1].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml && \
50+
yq -i '.compilers[1].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml
51+
52+
# install MPICH
53+
RUN spack install mpich@${MPICH_VERSION} %gcc
54+
55+
# for the MPI hook
56+
RUN echo $(spack find --format='{prefix.lib}' mpich) > /etc/ld.so.conf.d/mpich.conf
57+
RUN ldconfig
58+
59+
# create environments for several configurations and install dependencies
60+
RUN spack env create -d /tiledmm-env-cuda && \
61+
spack -e /tiledmm-env-cuda add "tiled-mm@master %gcc +cuda +tests +shared " && \
62+
spack -e /tiledmm-env-cuda develop -p /src tiled-mm@master && \
63+
spack -e /tiledmm-env-cuda install --only=dependencies --fail-fast

ci/build.Dockerfile

+17
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 tiled-mm
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 tiled-mm) spack-build

ci/cscs.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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/tiledmm-ci
17+
18+
build tiled-mm:
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/tiledmm/tiledmm-ci:$CI_COMMIT_SHA
25+
ENVPATH: "/tiledmm-env-cuda"
26+
DOCKER_BUILD_ARGS: '["BASE_IMAGE=${BASE_IMAGE}", "ENVPATH=$ENVPATH"]'
27+
28+
.run_tests:
29+
extends: .container-runner-daint-gpu
30+
needs: ["build tiled-mm"]
31+
stage: test
32+
image: $CSCS_REGISTRY_PATH/tiledmm/tiledmm-ci:$CI_COMMIT_SHA
33+
variables:
34+
GIT_STRATEGY: none
35+
MPICH_MAX_THREAD_SAFETY: multiple
36+
CSCS_REGISTRY_LOGIN: 'YES'
37+
PULL_IMAGE: 'YES'
38+
SLURM_HINT: nomultithread
39+
SLURM_UNBUFFEREDIO: ''
40+
SLURM_WAIT: 0
41+
42+
test1:
43+
extends: .run_tests
44+
stage: test
45+
script: /src/spack-build/tests/test-multiply -m 50 -n 200 -k 21 --tile_m 4 --tile_n 4 --tile_k 4 --beta 0 --n_streams 2
46+
variables:
47+
SLURM_JOB_NUM_NODES: 1
48+
SLURM_NTASKS: 1
49+
USE_MPI: 'YES'
50+
51+
test2:
52+
extends: .run_tests
53+
stage: test
54+
script: /src/spack-build/tests/test-multiply -m 5 -n 2 -k 2 --tile_m 4 --tile_n 4 --tile_k 4 --beta 0 --n_streams 2
55+
variables:
56+
SLURM_JOB_NUM_NODES: 1
57+
SLURM_NTASKS: 1
58+
USE_MPI: 'YES'

0 commit comments

Comments
 (0)