Skip to content

Commit

Permalink
Merge pull request #344 from astro-informatics/cg_cppflow_migration
Browse files Browse the repository at this point in the history
Updates from MSSL in-person meeting
  • Loading branch information
20DM authored Sep 12, 2024
2 parents 34bfb8c + 6c30d50 commit 4c50839
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 393 deletions.
117 changes: 64 additions & 53 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
OMP_NUM_THREADS: 2
CONAN_PRINT_RUN_COMMANDS: 1
CONAN_CPU_COUNT: 2
CONAN_SKIP_BROKEN_SYMLINKS_CHECK: 'True'

jobs:
build:
Expand Down Expand Up @@ -49,11 +46,11 @@ jobs:
- g++-11
- clang++
mpi:
- "on"
- "off"
- "ON"
- "OFF"
omp:
- "on"
- "off"
- "ON"
- "OFF"
exclude:
- cc: gcc-11
cxx: clang++
Expand All @@ -76,55 +73,19 @@ jobs:
cc: gcc-11
- os: macos-14
mpi: "on"
- os: macos-14
cxx: g++-11
- cxx: clang++
omp: "on"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/checkout@v4

# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}

- name: Install Dependencies on Ubunutu
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev ccache casacore-dev
pip install conan
- name: Install Dependencies on MacOS
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gcc libtiff open-mpi libomp libyaml ccache conan
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
- name: Install Tensorflow API on Ubuntu
# TODO could this be combined with mac version somehow? if/else?
if: ${{ contains(matrix.os, 'ubuntu') }}
uses: UCL/install-tensorflow-action@main
with:
version: 2.11.0
os: linux

- name: Install Tensorflow API on MacOS
if: ${{ contains(matrix.os, 'macos') }}
uses: UCL/install-tensorflow-action@main
with:
version: 2.11.0
os: darwin

- name: Select Python 3.10
# otherwise turtlebrowser/[email protected] fails on macos-12
# ref: https://github.com/turtlebrowser/get-conan/issues/4
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT
Expand All @@ -145,20 +106,70 @@ jobs:
# - name: Clear ccache
# run: ccache --clear

- name: Build sopt
- name: Install Dependencies on Ubunutu
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
conan profile detect
conan create ${{github.workspace}}/sopt --build missing -s compiler.cppstd=17 -o dompi=${{matrix.mpi}} -o openmp=${{matrix.omp}}
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev ccache graphviz libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev libbenchmark-dev libboost-all-dev libyaml-cpp-dev
- name: Dependencies
run: conan install ${{github.workspace}} -of ${{github.workspace}}/build -s compiler.cppstd=17 --build missing -o docasa=off -o dompi=${{matrix.mpi}} -o openmp=${{matrix.omp}}
- name: Install Dependencies on MacOS
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gcc libtiff open-mpi libomp eigen libyaml ccache cfitsio boost yaml-cpp
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
- name: Checkout Catch2
uses: actions/checkout@v4
with:
repository: catchorg/Catch2.git
path: Catch2
ref: v3.4.0

- name: Build Catch2
run: |
mkdir Catch2/build
cd Catch2/build
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local
make -j$(nproc --ignore 1) install
- name: Install FFTW
run: |
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
cd fftw-3.3.10
./configure --prefix=${{github.workspace}}/local --enable-shared
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/local/lib*/cmake/*/FFTW3Config.cmake
- name: Checkout SOPT
uses: actions/checkout@v4
with:
repository: astro-informatics/sopt.git
path: sopt
ref: development

- name: Build sopt
run: |
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
mkdir -p ${{github.workspace}}/sopt/build
cd ${{github.workspace}}/sopt/build
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=OFF -Dexamples=OFF
make -j$(nproc --ignore 1) install
- name: Install
# Build your program with the given configuration
run: conan build ${{github.workspace}} -of ${{github.workspace}}/build -s compiler.cppstd=17 -o docasa=off -o dompi=${{matrix.mpi}} -o openmp=${{matrix.omp}}
run: |
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}}
make -j$(nproc --ignore 1) install
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
run: |
export LD_LIBRARY_PATH=${{github.workspace}}/local/lib:${{github.workspace}}/local/external/lib:${LD_LIBRARY_PATH}
ctest -C ${{env.BUILD_TYPE}} --output-on-failure
113 changes: 30 additions & 83 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
branches: [ development ]
if: github.event.pull_request.draft == false

env:
USE_CONAN: 0

jobs:
make-documentation:
runs-on: ubuntu-20.04
Expand All @@ -23,52 +20,31 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev ccache casacore-dev doxygen graphviz
if [[ "$USE_CONAN" = 1 ]]; then
pip install conan
else
sudo apt install libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev
sudo apt install libbenchmark-dev libboost-all-dev libyaml-cpp-dev
git clone https://github.com/catchorg/Catch2.git -b v3.4.0
mkdir Catch2/build
cd Catch2/build
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build
make -j$(nproc --ignore 1) install
cd -
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
cd fftw-3.3.10
./configure --prefix=${{github.workspace}}/build --enable-shared
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/build/lib*/cmake/*/FFTW3Config.cmake
cd -
fi
sudo apt install openmpi-bin libopenmpi-dev ccache casacore-dev doxygen graphviz libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev libbenchmark-dev libboost-all-dev libyaml-cpp-dev
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
- name: Install Tensorflow API on Ubuntu
uses: UCL/install-tensorflow-action@main
- name: Checkout Catch2
uses: actions/checkout@v4
with:
version: 2.11.0
os: linux
repository: catchorg/Catch2.git
path: Catch2
ref: v3.4.0

- name: Checkout cppflow repo
uses: actions/checkout@v3
with:
repository: UCL/cppflow.git
path: cppflow
ref: master
- name: Build Catch2
run: |
mkdir Catch2/build
cd Catch2/build
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local
make -j$(nproc --ignore 1) install
- name: Create cppflow package
- name: Install FFTW
run: |
if [[ "USE_CONAN" = 1 ]]; then
conan detect profile
conan create ./cppflow -s compiler.cppstd=17
else
mkdir cppflow/build
cd cppflow/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}
#cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build
make -j$(nproc --ignore 1) install
fi
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
cd fftw-3.3.10
./configure --prefix=${{github.workspace}}/local --enable-shared
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/local/lib*/cmake/*/FFTW3Config.cmake
- name: Checkout SOPT
uses: actions/checkout@v3
Expand All @@ -79,48 +55,19 @@ jobs:

- name: Create SOPT package
run : |
if [[ "USE_CONAN" = 1 ]]; then
conan create ./sopt -s compiler.cppstd=17 --build missing -o dompi=off -o docasa=off -o openmp=off -o docs=off -o cppflow=on
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/Catch2/build/lib/cmake:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/build/lib/cmake:$CMAKE_PREFIX_PATH
mkdir sopt/build
cd sopt/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD} -Ddocasa=OFF -Ddompi=OFF -Dopenmp=OFF -Ddocs=OFF -Dcppflow=ON
#cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build -Ddompi=OFF -Dopenmp=OFF -Ddocs=OFF -Dcppflow=ON
make -j$(nproc --ignore 1) install
fi
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
mkdir sopt/build
cd sopt/build
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddocasa=OFF -Ddompi=OFF -Dopenmp=OFF -Ddocs=OFF -Dtests=OFF -Dexamples=OFF
make -j$(nproc --ignore 1) install
- name: Configure
run: |
if [[ "USE_CONAN" = 1 ]]; then
# Doxygen currently broken in Conan v1 and v2
#conan install doxygen/1.9.4@#2af713e135f12722e3536808017ba086 --update
conan install ${{github.workspace}} -if ${{github.workspace}}/build -s compiler.cppstd=17 --build missing -o docasa=off -o dompi=off -o openmp=off -o docs=on -o cppflow=on
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD} -Ddompi=OFF -Dopenmp=OFF -Ddocs=ON -Dcppflow=ON
fi
- name: Build
run: |
if [[ "USE_CONAN" = 1 ]]; then
conan build ${{github.workspace}} -of ${{github.workspace}}/build -s compiler.cppstd=17 -o docasa=off -o dompi=off -o openmp=off -o docs=on -o cppflow=on
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
##export CMAKE_PREFIX_PATH=${{github.workspace}}/fftw-3.3.10/build/lib/cmake:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/fftw-3.3.10/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/Catch2/build/lib/cmake:$CMAKE_PREFIX_PATH
##export CMAKE_PREFIX_PATH=${{github.workspace}}/sopt/build:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
cd ${{github.workspace}}/build
make -j$(nproc --ignore 1) install
fi
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=OFF -Dopenmp=OFF -Ddocs=ON
make -j$(nproc --ignore 1) install
- name: Deploy to GH pages
if: ${{github.event_name == 'push'}}
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ option(docimg "Enable CImg" off)
option(docasa "Enable CASA" off)
option(docs "Build documentation" off)
option(coverage "Build coverage" off)
option(cppflow "Build with TensorFlow interface" off)
option(onnxrt "Build with ONNXruntime interface" off)

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
Expand All @@ -29,7 +29,6 @@ set(Sopt_GIT_TAG "development" CACHE STRING "Branch/tag when downloading sopt")

## we are doing c++11
#include(AddCPP11Flags)
# c++17 is required when using cppflow with learned algorithms
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
Loading

0 comments on commit 4c50839

Please sign in to comment.