@@ -10,68 +10,50 @@ concurrency:
10
10
group : ${{ github.workflow }}-${{ github.ref }}
11
11
cancel-in-progress : true
12
12
13
+ env :
14
+ # Note that each spack version needs it's own registry
15
+ SPACK_VERSION : develop
16
+ REGISTRY : ghcr.io/awslabs/palace
17
+ GITHUB_USER : ${{ github.actor }}
18
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19
+
13
20
jobs :
14
21
build-and-test-spack :
15
22
strategy :
16
- fail-fast : false
23
+ fail-fast : false # don't have one build stop others from finishing
17
24
matrix :
18
- include : # Include GPU build tests
19
- - compiler : gcc
20
- mpi : openmpi
21
- gpu : none
22
-
23
- # - compiler: gcc
24
- # mpi: mpich
25
- # gpu: cuda
26
-
27
- # - compiler: gcc
28
- # mpi: mpich
29
- # gpu: rocm
25
+ compiler : [gcc] # , clang, intel]
26
+ gpu : [none] # , cuda, rocm]
27
+ blas : [openblas] # ,intel-oneapi-mkl]
28
+ spack_version : [develop] # ,v0.23.1]
29
+ mpi : [openmpi] # , mpich, mvapich]
30
30
31
31
runs-on : palace_ubuntu-latest_16-core
32
32
steps :
33
33
- uses : actions/checkout@v4
34
34
35
- - name : Configure Open MPI
36
- if : matrix.mpi == 'openmpi'
37
- run : |
38
- sudo apt-get install -y openmpi-bin libopenmpi-dev
39
-
40
- - name : Configure MPICH
41
- if : matrix.mpi == 'mpich'
42
- run : |
43
- sudo apt-get install -y mpich libmpich-dev
44
-
45
- - name : Configure Intel MPI
46
- if : matrix.mpi == 'intelmpi'
47
- uses : mpi4py/setup-mpi@v1
48
- with :
49
- mpi : ${{ matrix.mpi }}
50
-
51
35
- name : Configure Clang compiler
52
36
if : matrix.compiler == 'clang'
53
- run : |
54
- sudo apt-get install -y clang lld
37
+ run : sudo apt-get install -y clang lld
55
38
56
39
- name : Configure Intel oneAPI compiler
57
40
if : matrix.compiler == 'intel'
58
- run : |
41
+ run :
59
42
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp=2024.2.1-1079 \
60
- intel-oneapi-compiler-fortran=2024.2.1-1079
61
-
62
- - uses : vsoch/spack-package-action/install@main
43
+ intel-oneapi-compiler-fortran=2024.2.1-1079
63
44
64
- - name : Build Palace
45
+ - name : Setup Spack
46
+ uses : spack/setup-spack@v2
47
+ with :
48
+ ref : develop
49
+ buildcache : true
50
+ color : true
51
+ # This seems unecessary, but otherwise we clone into ./spack
52
+ # This then would override the spack local repo dir, and break CI
53
+ path : spack-path
54
+
55
+ - name : Setup Environment
65
56
run : |
66
- # Clean up Android SDK install (confuses Spack MKL link line?)
67
- sudo rm -rf $ANDROID_HOME
68
-
69
- # Set up Spack to use external packages (MPI, etc.) and local Palace package
70
- # recipe
71
- . /opt/spack/share/spack/setup-env.sh
72
- spack external find --all
73
- spack repo add spack/local
74
-
75
57
# Configure GPU variant
76
58
if [[ "${{ matrix.gpu }}" == 'cuda' ]]; then
77
59
GPU_VARIANT="+cuda cuda_arch=70"
@@ -81,25 +63,99 @@ jobs:
81
63
GPU_VARIANT=""
82
64
fi
83
65
84
- # Build and install
85
- PALACE_SPEC="local.palace@develop%${{ matrix.compiler }}$GPU_VARIANT ^${{ matrix.mpi }}"
86
- PALACE_SPEC="$PALACE_SPEC ^petsc~hdf5 ^intel-oneapi-mkl"
87
- spack spec $PALACE_SPEC
88
- spack dev-build $PALACE_SPEC
66
+ # Develop requires ^compiler, not %compiler
67
+ if [[ "${{ matrix.spack_version }}" == 'v0.23.1' ]]; then
68
+ PALACE_SPEC="local.palace@develop %${{ matrix.compiler }} ${GPU_VARIANT} ^${{ matrix.mpi }} ^${{ matrix.blas }}"
69
+ else
70
+ PALACE_SPEC="local.palace@develop${GPU_VARIANT} ^${{ matrix.mpi }} ^${{ matrix.blas }} ^${{ matrix.compiler }}"
71
+ fi
89
72
90
- - name : Run tests
91
- if : matrix.gpu == 'none' # Skip tests for GPU builds
92
- env :
93
- NUM_PROC_TEST_MAX : ' 8'
73
+ # Spack.yaml with most / all settings configured
74
+ cat << EOF > spack.yaml
75
+ spack:
76
+ specs:
77
+ - ${PALACE_SPEC}
78
+ view: false
79
+ config:
80
+ install_tree:
81
+ root: /opt/spack
82
+ padded_length: False
83
+ concretizer:
84
+ reuse: false
85
+ unify: true
86
+ targets:
87
+ granularity: generic
88
+ packages:
89
+ petsc:
90
+ require: ~hdf5
91
+ rocblas:
92
+ require: ~tensile
93
+ repos:
94
+ - spack/local
95
+ mirrors:
96
+ spack:
97
+ binary: true
98
+ url: https://binaries.spack.io/${SPACK_VERSION}
99
+ local-buildcache:
100
+ binary: true
101
+ autopush: true
102
+ url: oci://${{ env.REGISTRY }}-${SPACK_VERSION}
103
+ signed: false
104
+ access_pair:
105
+ id_variable: GITHUB_USER
106
+ secret_variable: GITHUB_TOKEN
107
+ EOF
108
+
109
+ - name : Configure External Packages
94
110
run : |
95
- # Configure environment
96
- export NUM_PROC_TEST=$(nproc 2> /dev/null || sysctl -n hw.ncpu)
97
- if [[ "$NUM_PROC_TEST" -gt "$NUM_PROC_TEST_MAX" ]]; then
98
- NUM_PROC_TEST=$NUM_PROC_TEST_MAX
99
- fi
100
- . /opt/spack/share/spack/setup-env.sh
101
- spack load palace
111
+ # These cause build issues if built as externals
112
+ # - python : often distributed python isn't feature complete / not all dependencies get detected
113
+ # - OpenSSL / OpenSSH : since they are in /usr, spack struggles. It's common to rebuild these
114
+ # - ncurses / bzip2 / xz / curl : caused build issues. We pull these from GHCR cache after first build
115
+ spack -e . external find --all \
116
+ --exclude openssl \
117
+ --exclude openssh \
118
+ --exclude python \
119
+ --exclude ncurses \
120
+ --exclude bzip2 \
121
+ --exclude xz \
122
+ --exclude curl
123
+
124
+ - name : Configure Compilers
125
+ run : spack -e . compiler find && spack -e . compiler list
126
+
127
+ - name : Configure Binary Mirror Keys
128
+ run : |
129
+ # If we cached these, that would be faster and safer
130
+ spack -e . buildcache keys --install --trust
102
131
132
+ - name : Bootstrap
133
+ run : spack -e . bootstrap now
134
+
135
+ - name : Concretize
136
+ # In theory we can re-use a concretization and pin a spack to speed this up.
137
+ # Unfortunately it then becomes difficult to know when to re-concretize.
138
+ run : |
139
+ # Using `spack develop` in order to have an in-source build
140
+ spack -e . develop --path=$(pwd) local.palace@git."${{ github.head_ref || github.ref_name }}"=develop
141
+ spack -e . concretize -f
142
+
143
+ - name : Build Dependencies
144
+ run : |
145
+ spack -e . install --only-concrete --no-check-signature --fail-fast --show-log-on-error --only dependencies
146
+
147
+ - name : Build Palace
148
+ # Build palace from source using this current directory
149
+ # We use `--no-cache` in order to force a rebuild
150
+ run : spack -e . install --only-concrete --keep-stage --show-log-on-error --only package --no-cache
151
+
152
+ # Should we run unit tests as well here?
153
+ - name : Run Integration Tests
154
+ if : matrix.gpu == 'none' # Skip tests for GPU builds
155
+ env :
156
+ NUM_PROC_TEST_MAX : " 8"
157
+ run : |
158
+ eval $(spack -e . load --sh palace)
103
159
# Run tests
104
160
julia --project=test/examples -e 'using Pkg; Pkg.instantiate()'
105
161
julia --project=test/examples --color=yes test/examples/runtests.jl
0 commit comments