Skip to content

Commit

Permalink
CI: Python
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Aug 11, 2023
1 parent 7c5010e commit 789a9cf
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 32 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/dependencies/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ sudo apt-get install -y --no-install-recommends\
build-essential \
g++ gfortran \
libopenmpi-dev \
openmpi-bin
openmpi-bin \
python3 \
python3-pip

python3 -m pip install -U pip setuptools wheel
6 changes: 5 additions & 1 deletion .github/workflows/dependencies/dependencies_clang6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ sudo apt-get update

sudo apt-get install -y \
build-essential \
clang gfortran
clang gfortran \
python3 \
python3-pip

python3 -m pip install -U pip setuptools wheel
6 changes: 5 additions & 1 deletion .github/workflows/dependencies/dependencies_gcc10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ sudo apt-get install -y --no-install-recommends \
build-essential \
g++-10 gfortran-10 \
libopenmpi-dev \
openmpi-bin
openmpi-bin \
python3 \
python3-pip

python3 -m pip install -U pip setuptools wheel
6 changes: 5 additions & 1 deletion .github/workflows/dependencies/dependencies_nofortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ sudo apt-get install -y --no-install-recommends\
build-essential \
g++ \
libopenmpi-dev \
openmpi-bin
openmpi-bin \
python3 \
python3-pip

python3 -m pip install -U pip setuptools wheel
70 changes: 45 additions & 25 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ jobs:
- name: Build & Install
run: |
cd ExampleCodes
mkdir build
cd build
cmake .. \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_LINEAR_SOLVERS=ON \
-DAMReX_FORTRAN=ON \
-DAMReX_FORTRAN_INTERFACES=ON \
-DAMReX_EB=ON \
-DAMReX_PARTICLES=ON
make -j 2
-DAMReX_PARTICLES=ON \
-DTUTORIAL_PYTHON=ON
cmake --build build -j 2
cmake --build build -j 2 --target pip_install
- name: Run Python
run: |
cd ../GuidedTutorials/MultiFab/
python main.py
# Build all tutorials
tutorials_cxx20:
Expand All @@ -40,22 +44,26 @@ jobs:
- name: Build & Install
run: |
cd ExampleCodes
mkdir build
cd build
cmake .. \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_OMP=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_LINEAR_SOLVERS=ON \
-DAMReX_FORTRAN=ON \
-DAMReX_FORTRAN_INTERFACES=ON \
-DAMReX_EB=ON \
-DAMReX_EB=ON \
-DTUTORIAL_PYTHON=ON \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_C_COMPILER=$(which gcc-10) \
-DCMAKE_CXX_COMPILER=$(which g++-10) \
-DCMAKE_Fortran_COMPILER=$(which mpif90)
make -j 2
cmake --build build -j 2
cmake --build build -j 2 --target pip_install
- name: Run Python
run: |
cd ../GuidedTutorials/MultiFab/
python main.py
tutorials_clang:
name: [email protected] C++14 SP Particles DP Mesh Debug [tutorials]
Expand All @@ -66,11 +74,9 @@ jobs:
- name: Dependencies
run: .github/workflows/dependencies/dependencies_clang6.sh
- name: Build & Install
run: |
run: |
cd ExampleCodes
mkdir build
cd build
cmake .. \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_MPI=OFF \
Expand All @@ -81,11 +87,17 @@ jobs:
-DAMReX_EB=ON \
-DAMReX_PRECISION=DOUBLE \
-DAMReX_PARTICLES_PRECISION=SINGLE \
-DTUTORIAL_PYTHON=ON \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DCMAKE_Fortran_COMPILER=$(which gfortran)
make -j 2
cmake --build build -j 2
cmake --build build -j 2 --target pip_install
- name: Run Python
run: |
cd ../GuidedTutorials/MultiFab/
python main.py
# Build all tutorials w/o MPI
tutorials-nonmpi:
Expand All @@ -99,18 +111,22 @@ jobs:
- name: Build & Install
run: |
cd ExampleCodes
mkdir build
cd build
cmake .. \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_MPI=OFF \
-DAMReX_LINEAR_SOLVERS=ON \
-DAMReX_FORTRAN=ON \
-DAMReX_FORTRAN_INTERFACES=ON \
-DAMReX_EB=ON \
-DAMReX_PARTICLES=ON
make -j 2
-DAMReX_PARTICLES=ON \
-DTUTORIAL_PYTHON=ON
cmake --build build -j 2
cmake --build build -j 2 --target pip_install
- name: Run Python
run: |
cd ../GuidedTutorials/MultiFab/
python main.py
# Build all tutorials
tutorials-nofortran:
Expand All @@ -124,16 +140,20 @@ jobs:
- name: Build & Install
run: |
cd ExampleCodes
mkdir build
cd build
cmake .. \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_LINEAR_SOLVERS=ON \
-DAMReX_EB=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_FORTRAN=OFF
make -j 2
-DAMReX_FORTRAN=OFF \
-DTUTORIAL_PYTHON=ON
cmake --build build -j 2
cmake --build build -j 2 --target pip_install
- name: Run Python
run: |
cd ../GuidedTutorials/MultiFab/
python main.py
# Build all tutorials with CUDA 11.0.2 (recent supported)
tutorials-cuda11:
Expand Down
42 changes: 39 additions & 3 deletions ExampleCodes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake )
# If AMReX_DIR is passed then we link to the library found there. Otherwise
# the sources are fetched and compiled from the repo pointed to by AMReX_GIT_REPO
#
set ( AMReX_GIT_REPO "https://github.com/AMReX-Codes/amrex.git/"
CACHE STRING "The URL identifying the repo to fetchg AMReX from" )
set ( AMReX_GIT_REPO "https://github.com/AMReX-Codes/amrex.git"
CACHE STRING "The URL identifying the repo to fetch AMReX from" )

#
# Fetch and compile AMReX or link to an existing CMake build install of libamrex.
# If AMReX_DIR is passed then we link to the library found there. Otherwise
# the sources are fetched and compiled from the repo pointed to by AMReX_GIT_REPO
# the sources are fetched and compiled from the repo pointed to by pyAMReX_GIT_REPO
#
set ( pyAMReX_GIT_REPO "https://github.com/AMReX-Codes/pyamrex.git"
CACHE STRING "The URL identifying the repo to fetch pyAMReX from" )
option(TUTORIAL_PYTHON OFF)

#
# Fetch and compile AMReX or link to an existing CMake build install of libamrex.
# If AMReX_DIR is passed then we link to the library found there. Otherwise
# the sources are fetched and compiled from the repo pointed to by SUNDIALS_GIT_REPO
#
set ( SUNDIALS_GIT_REPO "https://github.com/LLNL/sundials.git"
CACHE STRING "The URL identifying the repo to fetch SUNDIALS from" )
Expand Down Expand Up @@ -174,6 +183,33 @@ else()
endif()
endif()

if(TUTORIAL_PYTHON)
if(DEFINED pyAMReX_DIR)
add_subdirectory(${pyAMReX_DIR})
else()
#
# Fetch pyAMReX repo
#
message(STATUS "Fetching from ${pyAMReX_GIT_REPO} branch ${pyAMReX_GIT_BRANCH}" )

set(pyAMReX_GIT_BRANCH "development" CACHE STRING "The pyAMReX branch to checkout")
set(pyAMReX_INSTALL "NO" CACHE INTERNAL "Disable install target for pyAMReX")

include(FetchContent)
#set(FETCHCONTENT_QUIET OFF) # Verbose ON

FetchContent_Declare( fetchedpyamrex
GIT_REPOSITORY ${pyAMReX_GIT_REPO}
GIT_TAG ${pyAMReX_GIT_BRANCH}
)

if(NOT fetchedpyamrex_POPULATED)
FetchContent_Populate(fetchedpyamrex)
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
endif()
endif()
endif()

#
# List of subdirectories to search for CMakeLists.
# For now, we do not include MUI, SDC, SWFFT
Expand Down

0 comments on commit 789a9cf

Please sign in to comment.