Skip to content

Commit 1da5a19

Browse files
committed
Added initial LC GitLab CI support.
1 parent d60b309 commit 1da5a19

File tree

9 files changed

+450
-1
lines changed

9 files changed

+450
-1
lines changed

.gitlab-ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
###############################################################################
2+
# General GitLab pipelines configurations for supercomputers and Linux clusters
3+
# at Lawrence Livermore National Laboratory (LLNL).
4+
#
5+
# This entire pipeline is LLNL-specific
6+
###############################################################################
7+
8+
# We define the following GitLab pipeline variables:
9+
#
10+
# GIT_SUBMODULE_STRATEGY:
11+
# Tells Gitlab to recursively update the submodules when cloning LvArray
12+
#
13+
# ALLOC_NAME:
14+
# On LLNL's quartz, this pipeline creates only one allocation shared among jobs
15+
# in order to save time and resources. This allocation has to be uniquely named
16+
# so that we are able to retrieve it.
17+
variables:
18+
GIT_SUBMODULE_STRATEGY: recursive
19+
ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID}
20+
21+
# Normally, stages are blocking in Gitlab. However, using the keyword "needs" we
22+
# can express dependencies between job that break the ordering of stages, in
23+
# favor of a DAG.
24+
# In practice q_* and l_* stages are independently run and start immediately.
25+
stages:
26+
- environment
27+
# quartz stages
28+
- q_allocate_resources
29+
- q_build_and_test
30+
- q_release_resources
31+
# lassen stages
32+
- l_build_and_test
33+
34+
# These are also templates (.name) that define project specific build commands.
35+
# If an allocation exist with the name defined in this pipeline, the job will
36+
# use it (slurm specific).
37+
.build_toss_3_x86_64_ib_script:
38+
script:
39+
- echo ${ALLOC_NAME}
40+
- export JOBID=$(squeue -h --name=${ALLOC_NAME} --format=%A)
41+
- echo ${JOBID}
42+
- srun $( [[ -n "${JOBID}" ]] && echo "--jobid=${JOBID}" ) -t 15 -N 1 scripts/gitlab/build_and_test.sh
43+
44+
# Lassen uses a different job scheduler (spectrum lsf) that does not
45+
# allow pre-allocation the same way slurm does.
46+
.build_blueos_3_ppc64le_ib_p9_script:
47+
script:
48+
- lalloc 1 -W 15 scripts/gitlab/build_and_test.sh
49+
50+
# "include" allows us to split the configuration in logical blocks
51+
include:
52+
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
53+
- local: .gitlab/quartz-templates.yml
54+
- local: .gitlab/quartz-jobs.yml
55+
- local: .gitlab/lassen-templates.yml
56+
- local: .gitlab/lassen-jobs.yml

.gitlab/lassen-jobs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
lassen_clang_10_0_1:
2+
variables:
3+
NAME: lassen_clang_10_0_1
4+
SPEC: "%[email protected] +cuda +umpire +chai +benchmarks +examples cuda_arch=70 ^[email protected] ^[email protected] build_type=Release cuda_arch=70 ^[email protected] build_type=Release cuda_arch=70 ^[email protected] build_type=Release cuda_arch=70"
5+
BUILD_TYPE: "Debug Release"
6+
extends: .build_and_test_on_lassen
7+
8+
lassen_gcc_8_3_1:
9+
variables:
10+
NAME: lassen_gcc_8_3_1
11+
SPEC: "%[email protected] +cuda +umpire +chai +benchmarks +examples cuda_arch=70 ^[email protected] ^[email protected] build_type=Release cuda_arch=70 ^[email protected] build_type=Release cuda_arch=70 ^[email protected] build_type=Release cuda_arch=70"
12+
BUILD_TYPE: "Debug Release"
13+
extends: .build_and_test_on_lassen

.gitlab/lassen-templates.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
####
2+
# Shared configuration of jobs for lassen
3+
.on_lassen:
4+
variables:
5+
tags:
6+
- shell
7+
- lassen
8+
rules:
9+
- if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_LASSEN == "OFF"'
10+
when: never
11+
- when: on_success
12+
13+
.build_and_test_on_lassen:
14+
stage: l_build_and_test
15+
extends: [.build_blueos_3_ppc64le_ib_p9_script, .on_lassen]
16+
needs: []

.gitlab/quartz-jobs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
quartz_clang_10_0_1:
2+
variables:
3+
NAME: quartz_clang_10_0_1
4+
SPEC: "%[email protected] +umpire +chai +benchmarks +examples ^[email protected] build_type=Release ^[email protected] build_type=Release ^[email protected] build_type=Release"
5+
BUILD_TYPE: "Debug Release"
6+
extends: .build_and_test_on_quartz
7+
8+
quartz_gcc_8_3_1:
9+
variables:
10+
NAME: quartz_gcc_8_3_1
11+
SPEC: "%[email protected] +umpire +chai +benchmarks +examples ^[email protected] build_type=Release ^[email protected] build_type=Release ^[email protected] build_type=Release"
12+
BUILD_TYPE: "Debug Release"
13+
extends: .build_and_test_on_quartz

.gitlab/quartz-templates.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
####
2+
# Shared configuration of jobs for quartz
3+
.on_quartz:
4+
tags:
5+
- shell
6+
- quartz
7+
rules:
8+
- if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_QUARTZ == "OFF"'
9+
when: never
10+
- if: '$CI_JOB_NAME =~ /release_resources/'
11+
when: always
12+
- when: on_success
13+
14+
####
15+
# In pre-build phase, allocate a node for builds
16+
allocate_resources (on quartz):
17+
variables:
18+
GIT_STRATEGY: none
19+
extends: .on_quartz
20+
stage: q_allocate_resources
21+
script:
22+
- salloc -N 1 -c 36 -p pdebug -t 20 --no-shell --job-name=${ALLOC_NAME}
23+
24+
####
25+
# In post-build phase, deallocate resources
26+
# Note : make sure this is run even on failure of the build phase
27+
# (see .on_quartz rules)
28+
release_resources (on quartz):
29+
variables:
30+
GIT_STRATEGY: none
31+
extends: .on_quartz
32+
stage: q_release_resources
33+
script:
34+
- export JOBID=$(squeue -h --name=${ALLOC_NAME} --format=%A)
35+
- ([[ -n "${JOBID}" ]] && scancel ${JOBID})
36+
37+
####
38+
# Generic quartz build job, extending build script
39+
.build_and_test_on_quartz:
40+
extends: [.build_toss_3_x86_64_ib_script, .on_quartz]
41+
stage: q_build_and_test

scripts/gitlab/build_and_test.sh

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/usr/bin/env bash
2+
3+
###############################################################################
4+
# Copyright (c) 2016-21, Lawrence Livermore National Security, LLC
5+
# and RAJA project contributors. See the RAJA/COPYRIGHT file for details.
6+
#
7+
# SPDX-License-Identifier: (BSD-3-Clause)
8+
###############################################################################
9+
10+
11+
set -o errexit
12+
set -o nounset
13+
14+
option=${1:-""}
15+
hostname="$(hostname)"
16+
project_dir="$(pwd)"
17+
18+
hostconfig=${HOST_CONFIG:-""}
19+
20+
name=${NAME}
21+
22+
spec=${SPEC:-""}
23+
24+
build_type=${BUILD_TYPE}
25+
26+
# Dependencies
27+
if [[ "${option}" != "--build-only" && "${option}" != "--test-only" ]]
28+
then
29+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
30+
echo "~~~~~ Building Dependencies"
31+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
32+
33+
if [[ -z ${spec} ]]
34+
then
35+
echo "SPEC is undefined, aborting..."
36+
exit 1
37+
fi
38+
39+
prefix_opt=""
40+
41+
if [[ -d /dev/shm ]]
42+
then
43+
prefix="/dev/shm/${hostname}/${name}"
44+
mkdir -p ${prefix}
45+
prefix_opt="--prefix=${prefix}"
46+
fi
47+
48+
python scripts/uberenv/uberenv.py --spec="${spec}" ${prefix_opt}
49+
fi
50+
51+
# Host config file
52+
# We are looking for a unique host config in project dir.
53+
hostconfigs=( $( ls "${project_dir}/"*@*.cmake ) )
54+
if [[ ${#hostconfigs[@]} == 1 ]]
55+
then
56+
hostconfig_path=${hostconfigs[0]}
57+
echo "Found host config file: ${hostconfig_path}"
58+
elif [[ ${#hostconfigs[@]} == 0 ]]
59+
then
60+
echo "No result for: ${project_dir}/hc-*.cmake"
61+
echo "Spack generated host-config not found."
62+
exit 1
63+
else
64+
echo "More than one result for: ${project_dir}/hc-*.cmake"
65+
echo "${hostconfigs[@]}"
66+
echo "Please specify one with HOST_CONFIG variable"
67+
exit 1
68+
fi
69+
70+
71+
build_dir="${project_dir}/build_"
72+
73+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
74+
echo "~~~~~ Project Dir: ${project_dir}"
75+
echo "~~~~~ Host-config: ${hostconfig_path}"
76+
echo "~~~~~ Build Dir: ${build_dir}"
77+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
78+
79+
# Build
80+
for buildType in ${build_type}
81+
do
82+
cd ${project_dir}
83+
84+
if [[ "${option}" != "--deps-only" && "${option}" != "--test-only" ]]
85+
then
86+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
87+
echo "~~~~~ Building LvArray"
88+
echo "~~~~~ Build Type: ${buildType}"
89+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
90+
91+
python scripts/config-build.py -hc ${hostconfig_path} -bt ${buildType} -bp ${build_dir}
92+
93+
cd ${build_dir}
94+
cmake --build . -j
95+
fi
96+
97+
# Test
98+
if [[ "${option}" != "--build-only" ]]
99+
then
100+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
101+
echo "~~~~~ Testing LvArray"
102+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
103+
104+
if [[ ! -d ${build_dir} ]]
105+
then
106+
echo "ERROR: Build directory not found : ${build_dir}" && exit 1
107+
fi
108+
109+
cd ${build_dir}
110+
111+
ctest --output-on-failure -T test 2>&1 | tee tests_output.txt
112+
113+
no_test_str="No tests were found!!!"
114+
if [[ "$(tail -n 1 tests_output.txt)" == "${no_test_str}" ]]
115+
then
116+
echo "ERROR: No tests were found" && exit 1
117+
fi
118+
119+
echo "Copying Testing xml reports for export"
120+
tree Testing
121+
cp Testing/*/Test.xml ${project_dir}
122+
123+
if grep -q "Errors while running CTest" ./tests_output.txt
124+
then
125+
echo "ERROR: failure(s) while running CTest" && exit 1
126+
fi
127+
fi
128+
done
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
from spack import *
7+
8+
9+
class Chai(CMakePackage, CudaPackage):
10+
"""
11+
Copy-hiding array interface for data migration between memory spaces
12+
"""
13+
14+
homepage = "https://github.com/LLNL/CHAI"
15+
git = "https://github.com/LLNL/CHAI.git"
16+
17+
version('develop', branch='develop', submodules='True')
18+
version('master', branch='main', submodules='True')
19+
version('2.2.0', tag='v2.2.0', submodules='True')
20+
version('2.1.1', tag='v2.1.1', submodules='True')
21+
version('2.1.0', tag='v2.1.0', submodules='True')
22+
version('2.0.0', tag='v2.0.0', submodules='True')
23+
version('1.2.0', tag='v1.2.0', submodules='True')
24+
version('1.1.0', tag='v1.1.0', submodules='True')
25+
version('1.0', tag='v1.0', submodules='True')
26+
27+
variant('shared', default=True, description='Build Shared Libs')
28+
variant('raja', default=False, description='Build plugin for RAJA')
29+
variant('benchmarks', default=False, description='Build benchmarks.')
30+
variant('examples', default=False, description='Build examples.')
31+
32+
depends_on('[email protected]:', type='build')
33+
depends_on('umpire')
34+
depends_on('raja', when="+raja")
35+
36+
depends_on('[email protected]:', type='build', when="+cuda")
37+
depends_on('umpire+cuda', when="+cuda")
38+
depends_on('raja+cuda', when="+raja+cuda")
39+
40+
def cmake_args(self):
41+
spec = self.spec
42+
43+
options = []
44+
45+
if '+cuda' in spec:
46+
options.extend([
47+
'-DENABLE_CUDA=ON',
48+
'-DCUDA_TOOLKIT_ROOT_DIR=' + spec['cuda'].prefix])
49+
50+
if not spec.satisfies('cuda_arch=none'):
51+
cuda_arch = spec.variants['cuda_arch'].value
52+
options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
53+
flag = '-arch sm_{0}'.format(cuda_arch[0])
54+
options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag))
55+
else:
56+
options.append('-DENABLE_CUDA=OFF')
57+
58+
if '+raja' in spec:
59+
options.extend(['-DENABLE_RAJA_PLUGIN=ON',
60+
'-DRAJA_DIR=' + spec['raja'].prefix])
61+
62+
options.append('-Dumpire_DIR:PATH='
63+
+ spec['umpire'].prefix.share.umpire.cmake)
64+
65+
options.append('-DENABLE_TESTS={0}'.format(
66+
'ON' if self.run_tests else 'OFF'))
67+
68+
options.append('-DENABLE_BENCHMARKS={0}'.format(
69+
'ON' if '+benchmarks' in spec else 'OFF'))
70+
71+
options.append('-DENABLE_EXAMPLES={0}'.format(
72+
'ON' if '+examples' in spec else 'OFF'))
73+
74+
return options

0 commit comments

Comments
 (0)