Skip to content

Commit 2905f03

Browse files
committed
CI: Python
1 parent 121be95 commit 2905f03

File tree

6 files changed

+103
-31
lines changed

6 files changed

+103
-31
lines changed

.github/workflows/dependencies/dependencies.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ sudo apt-get install -y --no-install-recommends\
1313
build-essential \
1414
g++ gfortran \
1515
libopenmpi-dev \
16-
openmpi-bin
16+
openmpi-bin \
17+
python3 \
18+
python3-pip
19+
20+
python3 -m pip install -U pip setuptools wheel

.github/workflows/dependencies/dependencies_clang6.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ sudo apt-get update
1111

1212
sudo apt-get install -y \
1313
build-essential \
14-
clang gfortran
14+
clang gfortran \
15+
python3 \
16+
python3-pip
17+
18+
python3 -m pip install -U pip setuptools wheel

.github/workflows/dependencies/dependencies_gcc10.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ sudo apt-get install -y --no-install-recommends \
1414
build-essential \
1515
g++-10 gfortran-10 \
1616
libopenmpi-dev \
17-
openmpi-bin
17+
openmpi-bin \
18+
python3 \
19+
python3-pip
20+
21+
python3 -m pip install -U pip setuptools wheel

.github/workflows/dependencies/dependencies_nofortran.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ sudo apt-get install -y --no-install-recommends\
1717
build-essential \
1818
g++ \
1919
libopenmpi-dev \
20-
openmpi-bin
20+
openmpi-bin \
21+
python3 \
22+
python3-pip
23+
24+
python3 -m pip install -U pip setuptools wheel

.github/workflows/linux.yml

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ jobs:
1616
- name: Build & Install
1717
run: |
1818
cd ExampleCodes
19-
mkdir build
20-
cd build
21-
cmake .. \
19+
cmake -S . -B build \
2220
-DCMAKE_BUILD_TYPE=Debug \
2321
-DCMAKE_VERBOSE_MAKEFILE=ON \
2422
-DAMReX_LINEAR_SOLVERS=ON \
2523
-DAMReX_FORTRAN=ON \
2624
-DAMReX_FORTRAN_INTERFACES=ON \
2725
-DAMReX_EB=ON \
28-
-DAMReX_PARTICLES=ON
29-
make -j 2
26+
-DAMReX_PARTICLES=ON \
27+
-DTUTORIAL_PYTHON=ON
28+
cmake --build build -j 2
29+
cmake --build build -j 2 --target pyamrex_pip_install
30+
- name: Run Python
31+
run: |
32+
cd ../GuidedTutorials/MultiFab/
33+
python main.py
3034
3135
# Build all tutorials
3236
tutorials_cxx20:
@@ -40,22 +44,26 @@ jobs:
4044
- name: Build & Install
4145
run: |
4246
cd ExampleCodes
43-
mkdir build
44-
cd build
45-
cmake .. \
47+
cmake -S . -B build \
4648
-DCMAKE_BUILD_TYPE=Debug \
4749
-DCMAKE_VERBOSE_MAKEFILE=ON \
4850
-DAMReX_OMP=ON \
4951
-DAMReX_PARTICLES=ON \
5052
-DAMReX_LINEAR_SOLVERS=ON \
5153
-DAMReX_FORTRAN=ON \
5254
-DAMReX_FORTRAN_INTERFACES=ON \
53-
-DAMReX_EB=ON \
55+
-DAMReX_EB=ON \
56+
-DTUTORIAL_PYTHON=ON \
5457
-DCMAKE_CXX_STANDARD=20 \
5558
-DCMAKE_C_COMPILER=$(which gcc-10) \
5659
-DCMAKE_CXX_COMPILER=$(which g++-10) \
5760
-DCMAKE_Fortran_COMPILER=$(which mpif90)
58-
make -j 2
61+
cmake --build build -j 2
62+
cmake --build build -j 2 --target pyamrex_pip_install
63+
- name: Run Python
64+
run: |
65+
cd ../GuidedTutorials/MultiFab/
66+
python main.py
5967
6068
tutorials_clang:
6169
name: [email protected] C++14 SP Particles DP Mesh Debug [tutorials]
@@ -68,9 +76,7 @@ jobs:
6876
- name: Build & Install
6977
run: |
7078
cd ExampleCodes
71-
mkdir build
72-
cd build
73-
cmake .. \
79+
cmake -S . -B build \
7480
-DCMAKE_BUILD_TYPE=Debug \
7581
-DCMAKE_VERBOSE_MAKEFILE=ON \
7682
-DAMReX_MPI=OFF \
@@ -81,11 +87,17 @@ jobs:
8187
-DAMReX_EB=ON \
8288
-DAMReX_PRECISION=DOUBLE \
8389
-DAMReX_PARTICLES_PRECISION=SINGLE \
90+
-DTUTORIAL_PYTHON=ON \
8491
-DCMAKE_CXX_STANDARD=14 \
8592
-DCMAKE_C_COMPILER=$(which clang) \
8693
-DCMAKE_CXX_COMPILER=$(which clang++) \
8794
-DCMAKE_Fortran_COMPILER=$(which gfortran)
88-
make -j 2
95+
cmake --build build -j 2
96+
cmake --build build -j 2 --target pyamrex_pip_install
97+
- name: Run Python
98+
run: |
99+
cd ../GuidedTutorials/MultiFab/
100+
python main.py
89101
90102
# Build all tutorials w/o MPI
91103
tutorials-nonmpi:
@@ -99,18 +111,22 @@ jobs:
99111
- name: Build & Install
100112
run: |
101113
cd ExampleCodes
102-
mkdir build
103-
cd build
104-
cmake .. \
114+
cmake -S . -B build \
105115
-DCMAKE_BUILD_TYPE=Debug \
106116
-DCMAKE_VERBOSE_MAKEFILE=ON \
107117
-DAMReX_MPI=OFF \
108118
-DAMReX_LINEAR_SOLVERS=ON \
109119
-DAMReX_FORTRAN=ON \
110120
-DAMReX_FORTRAN_INTERFACES=ON \
111121
-DAMReX_EB=ON \
112-
-DAMReX_PARTICLES=ON
113-
make -j 2
122+
-DAMReX_PARTICLES=ON \
123+
-DTUTORIAL_PYTHON=ON
124+
cmake --build build -j 2
125+
cmake --build build -j 2 --target pyamrex_pip_install
126+
- name: Run Python
127+
run: |
128+
cd ../GuidedTutorials/MultiFab/
129+
python main.py
114130
115131
# Build all tutorials
116132
tutorials-nofortran:
@@ -124,16 +140,20 @@ jobs:
124140
- name: Build & Install
125141
run: |
126142
cd ExampleCodes
127-
mkdir build
128-
cd build
129-
cmake .. \
143+
cmake -S . -B build \
130144
-DCMAKE_BUILD_TYPE=Debug \
131145
-DCMAKE_VERBOSE_MAKEFILE=ON \
132146
-DAMReX_LINEAR_SOLVERS=ON \
133147
-DAMReX_EB=ON \
134148
-DAMReX_PARTICLES=ON \
135-
-DAMReX_FORTRAN=OFF
136-
make -j 2
149+
-DAMReX_FORTRAN=OFF \
150+
-DTUTORIAL_PYTHON=ON
151+
cmake --build build -j 2
152+
cmake --build build -j 2 --target pyamrex_pip_install
153+
- name: Run Python
154+
run: |
155+
cd ../GuidedTutorials/MultiFab/
156+
python main.py
137157
138158
# Build all tutorials with CUDA 11.0.2 (recent supported)
139159
tutorials-cuda11:

ExampleCodes/CMakeLists.txt

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake )
1414
# If AMReX_DIR is passed then we link to the library found there. Otherwise
1515
# the sources are fetched and compiled from the repo pointed to by AMReX_GIT_REPO
1616
#
17-
set ( AMReX_GIT_REPO "https://github.com/AMReX-Codes/amrex.git/"
18-
CACHE STRING "The URL identifying the repo to fetchg AMReX from" )
17+
set ( AMReX_GIT_REPO "https://github.com/AMReX-Codes/amrex.git"
18+
CACHE STRING "The URL identifying the repo to fetch AMReX from" )
1919

2020
#
2121
# Fetch and compile AMReX or link to an existing CMake build install of libamrex.
2222
# If AMReX_DIR is passed then we link to the library found there. Otherwise
23-
# the sources are fetched and compiled from the repo pointed to by AMReX_GIT_REPO
23+
# the sources are fetched and compiled from the repo pointed to by pyAMReX_GIT_REPO
24+
#
25+
set ( pyAMReX_GIT_REPO "https://github.com/AMReX-Codes/pyamrex.git"
26+
CACHE STRING "The URL identifying the repo to fetch pyAMReX from" )
27+
option(TUTORIAL_PYTHON OFF)
28+
29+
#
30+
# Fetch and compile AMReX or link to an existing CMake build install of libamrex.
31+
# If AMReX_DIR is passed then we link to the library found there. Otherwise
32+
# the sources are fetched and compiled from the repo pointed to by SUNDIALS_GIT_REPO
2433
#
2534
set ( SUNDIALS_GIT_REPO "https://github.com/LLNL/sundials.git"
2635
CACHE STRING "The URL identifying the repo to fetch SUNDIALS from" )
@@ -182,6 +191,33 @@ else()
182191
endif()
183192
endif()
184193

194+
if(TUTORIAL_PYTHON)
195+
if(DEFINED pyAMReX_DIR)
196+
add_subdirectory(${pyAMReX_DIR})
197+
else()
198+
#
199+
# Fetch pyAMReX repo
200+
#
201+
message(STATUS "Fetching from ${pyAMReX_GIT_REPO} branch ${pyAMReX_GIT_BRANCH}" )
202+
203+
set(pyAMReX_GIT_BRANCH "development" CACHE STRING "The pyAMReX branch to checkout")
204+
set(pyAMReX_INSTALL "NO" CACHE INTERNAL "Disable install target for pyAMReX")
205+
206+
include(FetchContent)
207+
#set(FETCHCONTENT_QUIET OFF) # Verbose ON
208+
209+
FetchContent_Declare( fetchedpyamrex
210+
GIT_REPOSITORY ${pyAMReX_GIT_REPO}
211+
GIT_TAG ${pyAMReX_GIT_BRANCH}
212+
)
213+
214+
if(NOT fetchedpyamrex_POPULATED)
215+
FetchContent_Populate(fetchedpyamrex)
216+
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
217+
endif()
218+
endif()
219+
endif()
220+
185221
#
186222
# List of subdirectories to search for CMakeLists.
187223
# For now, we do not include MUI, SDC, SWFFT

0 commit comments

Comments
 (0)