Skip to content

Commit 525d631

Browse files
authored
Update to C++20 (#172)
1 parent e406dca commit 525d631

15 files changed

Lines changed: 85 additions & 199 deletions

File tree

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2020 The AMReX Community
3+
# Copyright 2020-2022 The AMReX Community
44
#
55
# License: BSD-3-Clause-LBNL
66
# Authors: Axel Huebl
77

88
set -eu -o pipefail
99

10+
# `man apt.conf`:
11+
# Number of retries to perform. If this is non-zero APT will retry
12+
# failed files the given number of times.
13+
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
14+
1015
sudo apt-get update
1116

1217
sudo apt-get install -y --no-install-recommends\
1318
build-essential \
19+
libfftw3-dev \
1420
g++ gfortran \
1521
libopenmpi-dev \
16-
openmpi-bin \
17-
python3 \
18-
python3-pip
19-
20-
python3 -m pip install -U pip
21-
python3 -m pip install -U build packaging setuptools wheel
22+
openmpi-bin
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2020-2022 The AMReX Community
4+
#
5+
# License: BSD-3-Clause-LBNL
6+
# Authors: Axel Huebl
7+
8+
set -eu -o pipefail
9+
10+
# `man apt.conf`:
11+
# Number of retries to perform. If this is non-zero APT will retry
12+
# failed files the given number of times.
13+
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
14+
15+
sudo apt-get update
16+
17+
sudo apt-get install -y --no-install-recommends \
18+
build-essential \
19+
libfftw3-dev \
20+
gfortran \
21+
clang-$1

.github/workflows/dependencies/dependencies_clang6.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/dependencies/dependencies_dpcpp.sh

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
set -eu -o pipefail
99

10+
# `man apt.conf`:
11+
# Number of retries to perform. If this is non-zero APT will retry
12+
# failed files the given number of times.
13+
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
14+
1015
# Ref.: https://github.com/rscohn2/oneapi-ci
1116
# intel-basekit intel-hpckit are too large in size
1217

@@ -19,9 +24,31 @@ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt
1924

2025
sudo apt-get update
2126

22-
sudo apt-get install -y --no-install-recommends \
23-
build-essential \
24-
intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel \
25-
g++ gfortran \
26-
libopenmpi-dev \
27-
openmpi-bin
27+
# try apt install up to five times, to avoid connection splits
28+
status=1
29+
for itry in {1..5}
30+
do
31+
sudo apt-get install -y --no-install-recommends \
32+
build-essential \
33+
intel-oneapi-compiler-dpcpp-cpp \
34+
intel-oneapi-compiler-fortran \
35+
intel-oneapi-mkl-devel \
36+
intel-oneapi-mpi-devel \
37+
&& { sudo apt-get clean; status=0; break; } \
38+
|| { sleep 10; }
39+
done
40+
if [[ ${status} -ne 0 ]]; then exit 1; fi
41+
42+
source /etc/os-release
43+
ver="${VERSION_ID//\"/}"
44+
if [ "$ver" == "22.04" ]; then exit 0; fi
45+
46+
status=1
47+
for itry in {1..5}
48+
do
49+
sudo apt-get install -y --no-install-recommends \
50+
intel-ocloc \
51+
libigc-dev \
52+
&& { sudo apt-get clean; status=0; break; } \
53+
|| { sleep 10; }
54+
done

.github/workflows/dependencies/dependencies_gcc10.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/dependencies/dependencies_nofortran.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/dependencies/dependencies_nvcc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sudo apt-get install -y \
2525
wget
2626

2727
VERSION_DOTTED=${1-12.0} && VERSION_DASHED=$(sed 's/\./-/' <<< $VERSION_DOTTED)
28-
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
28+
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
2929
sudo dpkg -i cuda-keyring_1.0-1_all.deb
3030
sudo apt-get update
3131
sudo apt-get install -y \

.github/workflows/id_most_recent_comment_on_PR.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/linux.yml

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66

77
# Build all tutorials
88
tutorials_build:
9-
name: GNU@7.5 C++14 [tutorials]
9+
name: GNU [tutorials]
1010
runs-on: ubuntu-24.04
1111
env: {CXXFLAGS: "-Werror -Wshadow -Woverloaded-virtual -Wunreachable-code -fno-operator-names"}
1212
steps:
@@ -35,14 +35,14 @@ jobs:
3535
python main.py
3636
3737
# Build all tutorials
38-
tutorials_cxx20:
39-
name: GNU@10.3 C++20 OMP [tutorials]
38+
tutorials_omp:
39+
name: GNU OMP [tutorials]
4040
runs-on: ubuntu-24.04
4141
env: {CXXFLAGS: "-Werror -Wno-error=deprecated-declarations -Wshadow -Woverloaded-virtual -Wunreachable-code -fno-operator-names"}
4242
steps:
4343
- uses: actions/checkout@v4
4444
- name: Dependencies
45-
run: .github/workflows/dependencies/dependencies_gcc10.sh
45+
run: .github/workflows/dependencies/dependencies.sh
4646
- name: Build & Install
4747
run: |
4848
cd ExampleCodes
@@ -55,11 +55,7 @@ jobs:
5555
-DAMReX_FORTRAN=ON \
5656
-DAMReX_FORTRAN_INTERFACES=ON \
5757
-DAMReX_EB=ON \
58-
-DTUTORIAL_PYTHON=ON \
59-
-DCMAKE_CXX_STANDARD=20 \
60-
-DCMAKE_C_COMPILER=$(which gcc-10) \
61-
-DCMAKE_CXX_COMPILER=$(which g++-10) \
62-
-DCMAKE_Fortran_COMPILER=$(which mpif90)
58+
-DTUTORIAL_PYTHON=ON
6359
cmake --build build -j 2
6460
cmake --build build -j 2 --target pyamrex_pip_install
6561
- name: Run Python
@@ -70,13 +66,13 @@ jobs:
7066
python main.py
7167
7268
tutorials_clang:
73-
name: Clang@6.0 C++14 SP Particles DP Mesh Debug [tutorials]
69+
name: Clang SP Particles DP Mesh Debug [tutorials]
7470
runs-on: ubuntu-24.04
7571
env: {CXXFLAGS: "-Werror -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -fno-operator-names"}
7672
steps:
7773
- uses: actions/checkout@v4
7874
- name: Dependencies
79-
run: .github/workflows/dependencies/dependencies_clang6.sh
75+
run: .github/workflows/dependencies/dependencies_clang.sh 18
8076
- name: Build & Install
8177
run: |
8278
cd ExampleCodes
@@ -92,7 +88,6 @@ jobs:
9288
-DAMReX_PRECISION=DOUBLE \
9389
-DAMReX_PARTICLES_PRECISION=SINGLE \
9490
-DTUTORIAL_PYTHON=ON \
95-
-DCMAKE_CXX_STANDARD=14 \
9691
-DCMAKE_C_COMPILER=$(which clang) \
9792
-DCMAKE_CXX_COMPILER=$(which clang++) \
9893
-DCMAKE_Fortran_COMPILER=$(which gfortran)
@@ -107,7 +102,7 @@ jobs:
107102
108103
# Build all tutorials w/o MPI
109104
tutorials-nonmpi:
110-
name: GNU@7.5 C++14 NOMPI [tutorials]
105+
name: GNU NOMPI [tutorials]
111106
runs-on: ubuntu-24.04
112107
env: {CXXFLAGS: "-Werror -Wshadow -Woverloaded-virtual -Wunreachable-code -fno-operator-names"}
113108
steps:
@@ -138,13 +133,13 @@ jobs:
138133
139134
# Build all tutorials
140135
tutorials-nofortran:
141-
name: GNU@7.5 C++14 w/o Fortran [tutorials]
136+
name: GNU w/o Fortran [tutorials]
142137
runs-on: ubuntu-24.04
143138
env: {CXXFLAGS: "-Werror -Wshadow -Woverloaded-virtual -Wunreachable-code -fno-operator-names"}
144139
steps:
145140
- uses: actions/checkout@v4
146141
- name: Dependencies
147-
run: .github/workflows/dependencies/dependencies_nofortran.sh
142+
run: .github/workflows/dependencies/dependencies.sh
148143
- name: Build & Install
149144
run: |
150145
cd ExampleCodes
@@ -165,9 +160,9 @@ jobs:
165160
cd ../HeatEquation/Source/
166161
python main.py
167162
168-
# Build all tutorials with CUDA 11.0.2 (recent supported)
169-
tutorials-cuda11:
170-
name: CUDA@11.2 GNU@9.3.0 C++17 Release [tutorials]
163+
# Build all tutorials with CUDA
164+
tutorials-cuda:
165+
name: CUDA Release [tutorials]
171166
runs-on: ubuntu-24.04
172167
env: {CXXFLAGS: "-fno-operator-names"}
173168
steps:
@@ -192,16 +187,14 @@ jobs:
192187
-DCMAKE_CXX_COMPILER=$(which g++) \
193188
-DCMAKE_CUDA_HOST_COMPILER=$(which g++) \
194189
-DCMAKE_Fortran_COMPILER=$(which gfortran) \
195-
-DCMAKE_CUDA_STANDARD=17 \
196-
-DCMAKE_CXX_STANDARD=17 \
197190
-DAMReX_CUDA_ARCH=8.0 \
198191
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
199192
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
200193
201194
cmake --build build -j 2
202195
203196
tutorials-dpcpp:
204-
name: DPCPP GFortran@7.5 C++17 [tutorials]
197+
name: DPCPP [tutorials]
205198
runs-on: ubuntu-24.04
206199
env: {CXXFLAGS: "-fno-operator-names"}
207200
steps:
@@ -215,26 +208,18 @@ jobs:
215208
set -e
216209
cd ExampleCodes
217210
cmake -S . -B build \
218-
-DCMAKE_CXX_COMPILER_ID="Clang" \
219-
-DCMAKE_CXX_COMPILER_VERSION=12.0 \
220-
-DCMAKE_CXX_STANDARD_COMPUTED_DEFAULT="17" \
221211
-DCMAKE_VERBOSE_MAKEFILE=ON \
222212
-DAMReX_LINEAR_SOLVERS=ON \
223-
-DAMReX_FORTRAN=ON \
224-
-DAMReX_FORTRAN_INTERFACES=ON \
225213
-DAMReX_EB=ON \
226214
-DAMReX_PARTICLES=ON \
227215
-DAMReX_GPU_BACKEND=SYCL \
228216
-DCMAKE_C_COMPILER=$(which icx) \
229217
-DCMAKE_CXX_COMPILER=$(which icpx) \
230-
-DCMAKE_Fortran_COMPILER=$(which gfortran)
218+
-DCMAKE_Fortran_COMPILER=$(which ifx)
231219
cmake --build build --parallel 2
232-
# note: setting the CXX compiler ID is a work-around for
233-
# the 2021.1 DPC++ release / CMake 3.19.0-3.19.1
234-
# https://gitlab.kitware.com/cmake/cmake/-/issues/21551#note_869580
235220
236221
tutorials-hip:
237-
name: HIP ROCm GFortran@9.3 C++17 [tutorials]
222+
name: HIP ROCm GFortran [tutorials]
238223
runs-on: ubuntu-24.04
239224
# Have to have -Wno-deprecated-declarations due to deprecated atomicAddNoRet
240225
# Have to have -Wno-gnu-zero-variadic-macro-arguments to avoid
@@ -275,7 +260,6 @@ jobs:
275260
-DAMReX_GPU_BACKEND=HIP \
276261
-DAMReX_AMD_ARCH=gfx908 \
277262
-DCMAKE_C_COMPILER=$(which clang) \
278-
-DCMAKE_CXX_COMPILER=$(which clang++) \
279-
-DCMAKE_CXX_STANDARD=17
263+
-DCMAKE_CXX_COMPILER=$(which clang++)
280264
cmake --build build_nofortran -j 2
281265

0 commit comments

Comments
 (0)