-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
69 lines (60 loc) · 1.83 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
workflow:
rules:
- if: '$CI_COMMIT_BRANCH'
# variables:
# GIT_SUBMODULE_STRATEGY: recursive
.pnnl_tags_template: &pnnl_tags_definition
tags:
- k8s
- ikp
- eagles
- deception
stages:
- build_and_test
# PNNL Pipeline
#
x86_64-gcc-cuda-build:
stage: build_and_test
<<: *pnnl_tags_definition
script:
- |
set -xv
whoami
#
# NOTES: WORKDIR is on constance/marianas/newell
# ./ is only on the Kubernetes instance
#
export WORKDIR="$HOME/gitlab/${CI_PIPELINE_ID}/${WORKDIR_SUFFIX}/"
export BUILD_DIR="/scratch/eagles-ci/${CI_PIPELINE_ID}/"
export SRCDIR=${WORKDIR}
if [[ ! -d "$WORKDIR" ]]; then
# if workdir already exists, we're in the testing job
mkdir -p "$WORKDIR"
cp -R ./* "$WORKDIR"
cp -R ./.git "$WORKDIR"
cp .gitmodules "$WORKDIR"
fi
[ -d "$WORKDIR/build" ] && rm -rf "$WORKDIR/build"
mkdir -p "$WORKDIR/build"
export output_filename="${WORKDIR}/job.out"
[ -f $output_filename ] && rm $output_filename
touch $output_filename
tail -f $output_filename &
export tailpid=$!
jobid=$(sbatch --export=ALL -A eagles --gres=gpu:1 --ntasks=2 -p dlt -o $output_filename -e $output_filename -t 1:00:00 $WORKDIR/tools/marianas-cuda-ci.sh)
export jobid=$(echo $jobid | cut -f4 -d' ')
res=1
while :;
do
export count=$(grep BUILD_STATUS $output_filename | wc -l)
if [[ "$count" != "0" ]]; then
kill $tailpid
echo 'Last tail of build output:'
tail -n 50 $output_filename
res=$(perl -ne 'if (/BUILD_STATUS/) { s/.+://; print; exit; }' $output_filename)
break
fi
sleep 10
done
echo "Finished batch job with exit code: $res"
exit $res