Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 76 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,104 @@
name: "Build and Test"
name: Build and Test

on:
push:
branches:
- '*'
- '**'
pull_request:
branches:
- main
- devel

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
exp:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04]
cc: [gcc, clang]
cxx: [g++, clang++]
include:
- cxx: clang++
cxxflags: -stdlib=libstdc++
exclude:
- cc: gcc
cxx: clang++
- cc: clang
cxx: g++
- os: ubuntu-24.04
toolchain: GCC 14
cc: gcc-14
cxx: g++-14
packages: gcc-14 g++-14 gfortran-14
fc: gfortran-14
- os: ubuntu-24.04
toolchain: Clang 18
cc: clang-18
cxx: clang++-18
packages: clang-18 libomp-18-dev gfortran-14
fc: gfortran-14
- os: ubuntu-26.04
toolchain: GCC 15
cc: gcc-15
cxx: g++-15
packages: gcc-15 g++-15 gfortran-15
fc: gfortran-15
- os: ubuntu-26.04
toolchain: Clang 22
cc: clang-22
cxx: clang++-22
packages: clang-22 libomp-22-dev gfortran-15
fc: gfortran-15

name: "Test pyEXP Build"
name: EXP and pyEXP (${{ matrix.os }}, ${{ matrix.toolchain }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
# The bundled pybind11 2.13 supports Python through 3.13.
python-version: '3.13'

- name: Install core dependencies - ubuntu
if: runner.os == 'Linux'
- name: Install dependencies
env:
TOOLCHAIN_PACKAGES: ${{ matrix.packages }}
run: |
sudo apt-get update
sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev libomp-dev python3-numpy python3-h5py
read -r -a toolchain_packages <<< "$TOOLCHAIN_PACKAGES"
sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev \
libopenmpi-dev openmpi-bin "${toolchain_packages[@]}"
python -m pip install numpy h5py

- name: Verify HDF5 test dependencies
run: /usr/bin/python3 -c "import h5py, numpy"

- name: Setup submodule and build
run: |
git submodule update --init --recursive
mkdir -p build/install
run: python -c "import h5py, numpy"

- name: Compile EXP
if: runner.os == 'Linux'
- name: Configure EXP
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
working-directory: ./build
run: >-
cmake
-DENABLE_NBODY=YES
-DENABLE_PYEXP=YES
-DCMAKE_BUILD_TYPE=Release
-DPython3_EXECUTABLE=/usr/bin/python3
-DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake
-DCMAKE_INSTALL_PREFIX=./install
-DCMAKE_CXX_FLAGS=${{ matrix.cxxflags }}
-Wno-dev
..
FC: ${{ matrix.fc }}
run: |
python_executable="$(command -v python)"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_NBODY=ON -DENABLE_PYEXP=ON -DENABLE_TESTS=ON \
-DPYBIND11_FINDPYTHON=ON \
-DPython_EXECUTABLE="$python_executable" \
-DPython3_EXECUTABLE="$python_executable" \
-DPYTHON_EXECUTABLE="$python_executable"

- name: Make
working-directory: ./build
run: make -j 4
- name: Build EXP
run: cmake --build build --parallel 2

- name: CTest Quick
working-directory: ./build
run: ctest --output-on-failure -L quick

#- name: CTest Long
#working-directory: ./build
#run: ctest --output-on-failure -L long
- name: Run quick tests
env:
OMP_NUM_THREADS: '2'
run: ctest --test-dir build --output-on-failure --no-tests=error -L '^quick$'
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ execute_process(

include_directories(${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include)
if (NOT DISABLE_PYTHON)
if(NOT Python3_EXECUTABLE)
if(Python_EXECUTABLE)
set(Python3_EXECUTABLE "${Python_EXECUTABLE}")
elseif(PYTHON_EXECUTABLE)
set(Python3_EXECUTABLE "${PYTHON_EXECUTABLE}")
endif()
endif()
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include)
endif()
include_directories(${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include)
Expand Down Expand Up @@ -311,9 +320,6 @@ if(ENABLE_TESTS)
endif()

# try to find pybind11 and build wrapper python module
if (NOT DISABLE_PYTHON)
find_package(Python3 COMPONENTS Interpreter Development)
endif()
message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}")
if(Python3_FOUND)
set(HAVE_PYTHON3 TRUE)
Expand Down
7 changes: 2 additions & 5 deletions pyEXP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
find_package (Python3 COMPONENTS Interpreter Development)

# Default build environment
#
set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp
Expand Down Expand Up @@ -50,6 +48,5 @@ message("The project has set the following flags: ${cxxflags}")

install(TARGETS pyEXP
RUNTIME DESTINATION bin
LIBRARY DESTINATION "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages"
ARCHIVE DESTINATION "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")

LIBRARY DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages"
ARCHIVE DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages")
Comment on lines +51 to +52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unified Python discovery before configuring pybind11, and removed the duplicate pyEXP lookup so both use the same interpreter. Committed as 09aaaa6.