-
Notifications
You must be signed in to change notification settings - Fork 10
185 lines (183 loc) · 6.86 KB
/
nwchem-podman-build.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: nwchem_podman_build
on:
repository_dispatch:
types: [backend_automation]
workflow_dispatch:
jobs:
shifter_schedule:
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule')
strategy:
fail-fast: false
matrix:
folder:
- nwchem-dev.mpipr.nersc_podman.mpich4
branch: [ master, hotfix/release-7-2-0]
openmp: [ Y, N]
fc: [ gfortran]
armci_network: [ MPI-PR ]
include:
- folder: nwchem-dev.mpipr.nersc_podman.mpich4
armci_network: MPI-PR
openmp: N
branch: master
fc: nvfortran
- folder: nwchem-dev.mpipr.nersc_podman.mpich4
armci_network: MPI-PR
openmp: N
branch: release-7-2-0
fc: nvfortran
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: FC tag
id: fc-tag
run: |
if [[ ${{ matrix.fc }} == 'gfortran' ]]; then
echo "fc=" >> $GITHUB_ENV
else
echo "fc=$(echo .${{matrix.fc }} )" >> $GITHUB_ENV
fi
- name: cache key
run: |
echo "cache_key=${{ matrix.folder }}-${{ matrix.branch }}${{ env.fc }}-cache-v005" >> $GITHUB_ENV
- name: Setup cache
id: setup-cache
uses: actions/cache@v4
with:
path: |
~/cache
key: ${{ env.cache_key }}
- name: Login to GitHub Container Registry
if: ${{ github.actor == github.repository_owner }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: fetch cache
if: (steps.setup-cache.outputs.cache-hit == 'true')
run: |
cd ${{ matrix.folder }}
ls -lrta
if [[ -f ~/cache/libext.tar.bz2 ]]; then \
echo "libext cache present" ; \
mkdir -p cache|| true ; \
rsync -av ~/cache/libext* cache/. ; \
echo "libext cache fetched" ; \
fi
if [[ -f ~/cache/simint.tar.bz2 ]]; then \
echo "simint cache present" ; \
mkdir -p cache|| true ; \
rsync -av ~/cache/simint* cache/. ; \
echo "simint cache fetched" ; \
fi
if [[ -f ~/cache/mpich.tar.bz2 ]]; then \
echo "mpich cache present" ; \
mkdir -p cache|| true ; \
rsync -av ~/cache/mpich* cache/. ; \
echo "mpich cache fetched" ; \
ls -l cache/ ; \
echo "======" ; \
fi
- name: openmp tag
id: openmp-tag
run: |
if [[ ${{ matrix.openmp }} == 'N' ]]; then
echo "omp_tag=_no_openmp" >> $GITHUB_ENV
else
echo "omp_tag=" >> $GITHUB_ENV
fi
shell: bash
- name: armci_net tag
id: armci_net
run: |
echo "armci_net=.$(echo ${{ matrix.armci_network }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash
- name: nwchem version tag
run: |
if [[ ${{ matrix.branch }} == master ]]; then
echo "longnwversion=$(echo ${{ matrix.folder }}| sed -e 's|.mpipr||')" >> $GITHUB_ENV
elif [[ ${{ matrix.branch }} == hotfix/release-7-2-0 ]]; then
echo "longnwversion=$(echo ${{ matrix.folder }} | sed -e 's|.mpipr||' | sed -e 's|dev|720|')" >> $GITHUB_ENV
else
echo "longnwversion=$(echo ${{ matrix.folder }} | sed -e 's|.mpipr||' | sed -e 's|dev|${{ matrix.branch }}|')" >> $GITHUB_ENV
fi
shell: bash
- name: docker tag
id: docker-tag
run: |
echo "tag=ghcr.io/${{ github.actor }}/${{ env.longnwversion}}${{ env.omp_tag }}${{ env.armci_net }}${{ env.fc }}" >> $GITHUB_ENV
shell: bash
- name: builddate
id: build-date
run: |
echo "date=$(TZ=America/Los_Angeles date +%Y%m%d_%H%M%S)" >> $GITHUB_ENV
- name: Install podman
run: |
sudo apt-get install -y podman
which podman
podman version
- name: build podman
run: |
cd ${{ matrix.folder }}
podman build \
--build-arg FC=${{ matrix.fc }} \
--build-arg USE_OPENMP_VALUE=${{ matrix.openmp }} \
--build-arg NWCHEM_BRANCH=${{ matrix.branch}} \
--build-arg ARMCI_NETWORK=${{ matrix.armci_network}} \
--build-arg CACHE_HIT=${{ env.cache_hit }} \
--build-arg GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }} \
--build-arg CUDA_VERSION_MAJOR=11 \
--build-arg CUDA_VERSION_MINOR=7 \
--format docker \
-t ${{ env.tag }}:latest .
- name: push to ghcr.io
run: |
echo ${{ secrets.GITHUB_TOKEN }} | podman login -u ${{ github.actor }} --password-stdin ghcr.io
podman push ${{ env.tag }}:latest ${{ env.tag }}:${{ env.date }}
podman push ${{ env.tag }}:latest ${{ env.tag }}:latest
- name: load and test image
if: ( github.actor == github.repository_owner )
run: |
sleep 30s
podman pull ${{ env.tag }}
export MYLDPATH=/usr/local/lib:/opt/lib
if [[ ${{ matrix.fc }} == nvfortran ]]; then
podman run -e LD_LIBRARY_PATH="$MYLDPATH" --entrypoint=ldd --rm \
${{ env.tag }} /opt/nwchem/bin/LINUX64/nwchem
else
cd /tmp
umask u=rwx,g=rwx,o=rwx
umask -S
git clone --no-checkout https://github.com/nwchemgit/nwchem
cd nwchem
git sparse-checkout init --cone
git sparse-checkout set QA
git checkout
cd QA
podman run --rm -e LD_LIBRARY_PATH="$MYLDPATH" \
-e HWLOC_HIDE_ERRORS=2 -w /opt/nwchem/QA \
-v `pwd`:/opt/nwchem/QA --entrypoint='/opt/nwchem/QA/runtests.mpi.unix' \
${{ env.tag }} \
procs 2 h2o_opt prop_mep_gcube
fi
- name: store cache
if: ( github.actor == github.repository_owner )
run: |
mkdir -p ~/cache/
podman run --privileged --user 0 --rm \
--entrypoint='/bin/cp' -v ~/cache:/data \
${{ env.tag }} \
-rp /opt/nwchem/src/libext/libext.tar.bz2 /data/. || true
podman run --privileged --user 0 --rm \
--entrypoint='/bin/cp' -v ~/cache:/data \
${{ env.tag }} \
-rp /opt/nwchem/src/libext/simint.tar.bz2 /data/. || true
podman run --privileged --user 0 --rm \
--entrypoint='/bin/cp' -v ~/cache:/data \
${{ env.tag }} \
-rp /usr/local/mpich.tar.bz2 /data/. || true
ls -Ralrt ~/cache || true