Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Conan for installing dependencies #302

Merged
merged 97 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
8190e07
Fixed spdlog error, same as sopt
SJaffa Feb 24, 2022
313ceef
Fix error in CI
SJaffa Feb 24, 2022
56e2807
Add conan install steps to workflows
SJaffa Feb 24, 2022
03d307e
Conanfile with same dependencies as sopt
SJaffa Feb 24, 2022
e33cd14
Added some of the lookup_package packages into Conan
SJaffa Feb 24, 2022
f4dd1f2
Fixed linking and versions
SJaffa Feb 24, 2022
d0f51a8
Update build to use conan. Update to conanfile.py similar to sopt.
tkoskela Mar 18, 2022
654fb27
Fix class name
tkoskela Apr 29, 2022
70e9e82
Apply changes done in sopt
tkoskela May 9, 2022
f3a49a1
WIP: Builds object files but fails during linking
tkoskela Aug 12, 2022
8d4649c
A version that compiles and passes tests. Outstanding thigs:
tkoskela Aug 12, 2022
ff0ba95
Checkout sopt and create package to install purify
tkoskela Aug 25, 2022
b15f613
Skip broken symlinks, remove unnecessary options
tkoskela Aug 31, 2022
39424c4
Fix typo
tkoskela Aug 31, 2022
44d2638
Add path to sopt repo so it doesn't override purify
tkoskela Aug 31, 2022
8d1b286
Set config with conan command
tkoskela Aug 31, 2022
2ad4aa2
Define env variables inside the job
tkoskela Aug 31, 2022
8b51794
Add debugging session dispatch
tkoskela Aug 31, 2022
4e30e42
Move tmate up
tkoskela Aug 31, 2022
0643b46
Set True as string
tkoskela Aug 31, 2022
0401f7a
pass build settings and options to create
tkoskela Aug 31, 2022
4373769
Re-add build missing flag
tkoskela Aug 31, 2022
08abc5f
Add sopt submodule
tkoskela Aug 31, 2022
8bde8e9
Merge branch 'tk/submodule' into tk/port-from-sopt
tkoskela Aug 31, 2022
565101d
checkout with sopt submodule
tkoskela Aug 31, 2022
b0ad948
Remove regresssions option from conanfile
SJaffa Mar 1, 2023
a7f5728
Update buld instructions to use conan
SJaffa Mar 1, 2023
ed05c6e
Merge branch 'sj/conan-build' into tk/port-from-sopt
tkoskela Mar 8, 2023
639a3e0
Merge pull request #304 from astro-informatics/tk/port-from-sopt
tkoskela Mar 8, 2023
544e5d7
Merge updates from sopt workflow
tkoskela Mar 8, 2023
291768f
Update sopt to latest
tkoskela Mar 8, 2023
34a1bcd
Always override zlib version to avoid conflicts
tkoskela Mar 29, 2023
0a940e4
Add support for learned g_proximal in forward-backward algorithm
tkoskela Mar 29, 2023
85b055c
Adding cppflow flag to purify and passing through to sopt
SJaffa Apr 5, 2023
e99418d
Linting
SJaffa Apr 5, 2023
1174f56
More linting
SJaffa Apr 5, 2023
13f1f2a
More linting
SJaffa Apr 5, 2023
52c6d4c
Delete lookup files for dependencies handled by conan
tkoskela Apr 5, 2023
e6cce69
Update to c++17
tkoskela Apr 5, 2023
3739ab4
Work in progress on building with conan packages
tkoskela Apr 5, 2023
6927c0c
Fix g_proximal_type naming
May 17, 2023
aafe8fc
Fix bracket error and g_proximal type naming
May 17, 2023
31dcff9
Updating installation instructions to use conan packages
SJaffa May 17, 2023
ddab449
Access Psi through g_proximal for all algorithms
May 22, 2023
bce0ecd
Reordered tests to be alphabetical
SJaffa May 31, 2023
b3bf7c8
Reordered mpi tests
SJaffa May 31, 2023
5ac1634
Merge branch 'mm_use_gproximal_base' into sj/reorder-tests
SJaffa May 31, 2023
5b88303
Fix g_proximal constructors to be exclusive
May 31, 2023
d9d73f5
Speed up sopt package creation
tkoskela Jun 7, 2023
810f33a
Merge branch 'sj/conan-build' of github.com:astro-informatics/purify …
tkoskela Jun 7, 2023
ad3ac7c
Set MPI communicators for FB algorithm
Jun 14, 2023
7e28358
Fix non-MPI tests when compiled with MPI
Jun 14, 2023
5c6605d
Merge pull request #315 from astro-informatics/mm_use_gproximal_base
mmcleod89 Jun 15, 2023
3ec43f6
remove cmake shell for testing
tkoskela Jun 16, 2023
17cc09b
Update gcc version
tkoskela Jun 16, 2023
e93f622
clean up commented code
tkoskela Jun 16, 2023
c8f0e48
Merge pull request #319 from tkoskela/sj/conan-build
tkoskela Jun 19, 2023
ad900df
Add guard around including sopt cppflow header
tkoskela Jun 21, 2023
81d6fb0
Merge branch 'sj/conan-build' of github.com:astro-informatics/purify …
tkoskela Jun 21, 2023
6a47e81
Update sopt submodule to latest dev branch
SJaffa Jun 21, 2023
e8cc1e8
Set Primal Dual tests to "should fail"
Jun 21, 2023
d5b44e1
feat: adds gh action to facilitate use of latest clang-format
krishnakumarg1984 Jun 22, 2023
1f531c8
Modify inplace to get meaningful git diff
tkoskela Jun 28, 2023
715545a
Create .clang-format-ignore
tkoskela Jun 28, 2023
a713c26
Merge pull request #322 from astro-informatics/kg/update_ghactions_cl…
tkoskela Jun 28, 2023
f58795c
Change back to correct format
tkoskela Jun 28, 2023
201094b
chore: reformat project files according to clang-format 16
krishnakumarg1984 Jun 28, 2023
81f8493
Require standard version and disable extensions
tkoskela Jun 28, 2023
3af87cd
Merge branch 'sj/conan-build' of github.com:astro-informatics/purify …
tkoskela Jun 28, 2023
85c5f90
Install boost without fiber, only run gcc mac workflow
tkoskela Jun 29, 2023
f45b45b
Clean up packages installed by conan from brew and apt install
tkoskela Jun 29, 2023
22d6caf
Add comments and exclude python
tkoskela Jun 29, 2023
400b8b5
Re-populate the matrix
tkoskela Jun 29, 2023
aad50ee
Drop support for OpenMP on apple-clang
tkoskela Jun 29, 2023
45d6f27
Follow cppreference recommendation for initialising arrays
tkoskela Jun 29, 2023
abac0d3
Include array suggested on stackoverflow
tkoskela Jun 29, 2023
a27ae08
Initialise with single braces
tkoskela Jun 29, 2023
a068fd6
Merge pull request #327 from astro-informatics/tk/fix-apple-clang
tkoskela Jun 29, 2023
8abb404
Merge pull request #326 from astro-informatics/tk/debug-boost-build
tkoskela Jul 6, 2023
c81cb67
Clarify Readme
tkoskela Jul 12, 2023
36d61f3
Remove trusty references and some extra whitespace
tkoskela Jul 12, 2023
7bf07e9
Make path to sopt consistent
tkoskela Jul 12, 2023
4ad5053
Apply suggestions from code review
tkoskela Jul 12, 2023
6c0f7f0
Update cmake_files/dependencies.cmake
tkoskela Jul 12, 2023
74b1d41
removed old conanfile
tkoskela Jul 12, 2023
a4bef2b
Merge branch 'sj/conan-build' of github.com:astro-informatics/purify …
tkoskela Jul 12, 2023
3d20e49
Fix PURIFY_CPPFLOW flag
mmcleod89 Jul 17, 2023
a1d441f
remove checks for n_iters from tests
Jul 17, 2023
0f3c373
Add comments to explain shouldfail test
tkoskela Jul 20, 2023
308b32a
Catch2 macro does not like one-line if statements
tkoskela Jul 20, 2023
78808a1
Add missing step
tkoskela Jul 20, 2023
2f8bd05
Merge pull request #312 from astro-informatics/sj/reorder-tests
SJaffa Jul 21, 2023
48e9b89
Update README.md
tkoskela Jul 21, 2023
01904c3
Updated docs workflow
SJaffa Jul 21, 2023
8c42441
Passing docs option into Sopt
SJaffa Jul 21, 2023
50ce76e
Merge branch 'sj/conan-build' of https://github.com/astro-informatics…
SJaffa Jul 21, 2023
3123788
Add note on symlinks
SJaffa Jul 21, 2023
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
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#ignore .in.h template files
**/*.in.h
122 changes: 93 additions & 29 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@ on:
push:
branches: [ development ]
pull_request:
branches: [ development ]
# CI runs when new commits are pushed or when draft PR is marked ready for review
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
OMP_NUM_THREADS: 4
OMP_NUM_THREADS: 2
CONAN_PRINT_RUN_COMMANDS: 1
CONAN_CPU_COUNT: 2
CONAN_SKIP_BROKEN_SYMLINKS_CHECK: 'True'

jobs:
build:
# Skip CI if PR is a draft
if: github.event.pull_request.draft == false
name: ${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
Expand All @@ -29,51 +41,96 @@ jobs:
- ubuntu-20.04
- macos-11
cc:
- gcc-9
- gcc-10
- clang
cxx:
- g++-9
- g++-10
- clang++
mpi:
- "ON"
- "OFF"
- "on"
- "off"
omp:
- "ON"
- "OFF"
- "on"
- "off"
exclude:
- cc: gcc-9
- cc: gcc-10
cxx: clang++
- cc: clang
cxx: g++-9
cxx: g++-10
- os: ubuntu-20.04
cc: clang
cxx: clang++
- os: macos-11
mpi: "on"
- cxx: clang++
omp: "on"

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

# 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 install libfftw3-dev libtiff5-dev openmpi-bin libopenmpi-dev libboost-all-dev libeigen3-dev libyaml-cpp-dev ccache libcfitsio-dev casacore-dev
run: |
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev ccache casacore-dev

- name: Install Dependencies on MacOS
if: ${{ contains(matrix.os, 'macos') }}
run: brew install fftw libtiff open-mpi boost libyaml cfitsio ccache
run: |
# Brew update has bugs but we don't seem to be affected, see
# https://github.com/actions/setup-python/issues/577
# brew update is very slow because it's updating a lot of unrelated packages
# workflow seems to run fine with default versions
# brew update
brew install open-mpi libomp ccache
echo "CMAKE_PREFIX_PATH=/usr/local/opt/libomp" >> $GITHUB_ENV

- 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: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.60.1

- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT
- name: Set ccache cache directory
shell: bash
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
- name: Cache ccache files
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{runner.workspace}}/.ccache
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
restore-keys: |
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}
Expand All @@ -83,21 +140,28 @@ jobs:
# - name: Clear ccache
# run: ccache --clear

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}}
- name: create sopt package on gcc
if: ${{ contains(matrix.cxx, 'g++-10') }}
run: conan create ${{github.workspace}}/sopt --build missing -s:b compiler.libcxx=libstdc++11 -o:b mpi=${{matrix.mpi}} -o:b openmp=${{matrix.omp}} -pr:h=default -pr:b=default

- name: create sopt package on apple-clang
if: ${{ contains(matrix.cxx, 'clang++') }}
run: conan create ${{github.workspace}}/sopt --build missing -o:b mpi=${{matrix.mpi}} -o:b openmp=${{matrix.omp}} -pr:h=default -pr:b=default

- name: Conan install on gcc
if: ${{ contains(matrix.cxx, 'g++-10') }}
run: conan install ${{github.workspace}} -if ${{github.workspace}}/build -s compiler.libcxx=libstdc++11 --build missing -o mpi=${{matrix.mpi}} -o openmp=${{matrix.omp}} -pr:h=default -pr:b=default

- name: Conan install on apple-clang
if: ${{ contains(matrix.cxx, 'clang++') }}
run: conan install ${{github.workspace}} -if ${{github.workspace}}/build --build missing -o mpi=${{matrix.mpi}} -o openmp=${{matrix.omp}} -pr:h=default -pr:b=default

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2
run: conan build ${{github.workspace}} -bf ${{github.workspace}}/build

- 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}}
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
16 changes: 10 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ name: Documentation
on:
push:
branches: [ development ]

jobs:
make-documentation:
runs-on: ubuntu-20.04
steps:

- name: Install dependencies
run: sudo apt install libfftw3-dev libtiff5-dev libboost-all-dev libeigen3-dev libyaml-cpp-dev libcfitsio-dev casacore-dev doxygen graphviz

run: |
sudo apt install libfftw3-dev libtiff5-dev libboost-all-dev libeigen3-dev libyaml-cpp-dev libcfitsio-dev casacore-dev doxygen graphviz
pip install conan
SJaffa marked this conversation as resolved.
Show resolved Hide resolved

- name: Pull sopt repo and build docs
run : |
git clone https://github.com/astro-informatics/sopt.git
Expand All @@ -23,21 +25,23 @@ jobs:

- name: Check out Purify
uses: actions/checkout@v2

- name: Configure and build docs
run: |
mkdir build
cd build
conan install ..
cmake .. \
-Ddompi=OFF \
-Dopenmp=OFF \
-Ddocs=ON \
-Dweb=ON
make docweb VERBOSE=1

- name: Deploy to GH pages
if: ${{github.event_name == 'push'}}
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: build/cpp/docs/html # The folder the action should deploy.

29 changes: 14 additions & 15 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@ name: Linting
on:
push:
branches: [ development ]
pull-request:
branches: [development]
pull_request:
branches: [development]



jobs:
linting:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2


- name: Install dependencies
run: |
sudo apt install clang-format

uses: actions/checkout@v3

# Check code meets Google C++ style guide https://google.github.io/styleguide/cppguide.html
- name: Run linting
run: |
find ../ -regex '.*\.\(cc\|h\)' -not -iname '*.in.h' | xargs -I{} -P 10 clang-format -i -style=file {}; git diff

uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,cc'
clangFormatVersion: 16
inplace: True

- name: Report results
run: |
run: |
git diff --exit-code || (echo '## NOTE: your code is not linted properly - please commit the suggested changes'; false)

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sopt"]
path = sopt
url = https://github.com/astro-informatics/sopt.git
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(Purify C CXX)

# Location of extra cmake includes for the project
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_files)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/build)

# Downloads and installs GreatCMakeCookOff
# It contains a number of cmake recipes
Expand All @@ -19,6 +20,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)

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Relese' as none was specified.")
Expand All @@ -30,8 +32,12 @@ message(STATUS "Building purify in ${CMAKE_BUILD_TYPE} mode")
include(version)
set(Sopt_GIT_TAG "development" CACHE STRING "Branch/tag when downloading sopt")

# we are doing c++11
include(AddCPP11Flags)
## 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)

# sets up rpath so libraries can be found
include(rpath)
Expand All @@ -52,7 +58,7 @@ endif()

if(tests) # Adds ctest
enable_testing()
find_package(Catch 2.3.0 EXACT)
find_package(Catch)
include(AddCatchTest)
endif()

Expand Down
Loading