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

#718: implement pressio-log as logger #722

Merged
merged 11 commits into from
Feb 26, 2025
Merged
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
13 changes: 11 additions & 2 deletions .github/workflows/ci-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ jobs:
with:
repository: Pressio/pressio-templates-usage-as-library
path: examples
ref: add-compatibility-with-pressio-ops
ref: main

- name: Checkout pressio-log
uses: actions/checkout@v4
with:
repository: Pressio/pressio-log
path: pressio-log
ref: main

- name: Checkout pressio-ops
uses: actions/checkout@v4
Expand All @@ -91,10 +98,10 @@ jobs:
-D CMAKE_INSTALL_PREFIX:PATH=${PRESSIO_INSTALL_DIR} \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
${{ matrix.cmake_extra_args }} \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D PRESSIO_ENABLE_TESTS:BOOL=ON \
-D PRESSIO_ENABLE_TPL_EIGEN:BOOL=ON \
-D EIGEN_INCLUDE_DIR=/eigen/eigen-${{ env.eigen_version }} \
-D PRESSIO_LOG_INCLUDE_DIR=${GITHUB_WORKSPACE}/pressio-log/include \
-D PRESSIO_OPS_INCLUDE_DIR=${GITHUB_WORKSPACE}/pressio-ops/include

- name: Build
Expand All @@ -108,6 +115,7 @@ jobs:
--std=c++17 \
-DPRESSIO_ENABLE_TPL_EIGEN \
-I/eigen/eigen-${{ env.eigen_version }} \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main.cpp \
Expand All @@ -120,6 +128,7 @@ jobs:
$CXX \
--std=c++17 \
-I/eigen/eigen-${{ env.eigen_version }} \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main_with_defines.cpp \
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/ci-kokkos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ jobs:
with:
repository: Pressio/pressio-templates-usage-as-library
path: examples
ref: add-compatibility-with-pressio-ops
ref: main

- name: Checkout pressio-log
uses: actions/checkout@v4
with:
repository: Pressio/pressio-log
path: pressio-log
ref: main

- name: Checkout pressio-ops
uses: actions/checkout@v4
Expand All @@ -79,7 +86,6 @@ jobs:
-D PRESSIO_ENABLE_TPL_KOKKOS:BOOL=ON \
-D Kokkos_ROOT=/kokkos/install \
-D KokkosKernels_ROOT=/kokkos-kernels/install \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${PRESSIO_INSTALL_DIR} \
-D CMAKE_CXX_FLAGS='-Wall -Werror'

Expand All @@ -94,6 +100,7 @@ jobs:
-DPRESSIO_ENABLE_TPL_KOKKOS \
-I/kokkos/install/include \
-I/kokkos-kernels/install/include \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main.cpp
Expand All @@ -106,6 +113,7 @@ jobs:
-DPRESSIO_ENABLE_TPL_KOKKOS \
-I/kokkos/install/include \
-I/kokkos-kernels/install/include \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main_with_defines.cpp
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/ci-trilinos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ jobs:
with:
repository: Pressio/pressio-templates-usage-as-library
path: examples
ref: add-compatibility-with-pressio-ops
ref: main

- name: Checkout pressio-log
uses: actions/checkout@v4
with:
repository: Pressio/pressio-log
path: pressio-log
ref: main

- name: Checkout pressio-ops
uses: actions/checkout@v4
Expand Down Expand Up @@ -86,7 +93,6 @@ jobs:
-D PRESSIO_ENABLE_TPL_KOKKOS:BOOL=ON \
-D PRESSIO_ENABLE_TPL_BLAS:BOOL=ON \
-D PRESSIO_ENABLE_TPL_LAPACK:BOOL=ON \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D EIGEN_INCLUDE_DIR=/eigen/eigen-${{ env.eigen_version }} \
-D Trilinos_DIR=${{ env.trilinos_dir }}/lib/cmake/Trilinos \
-D CMAKE_INSTALL_PREFIX:PATH=${PRESSIO_INSTALL_DIR} \
Expand All @@ -104,6 +110,7 @@ jobs:
-DPRESSIO_ENABLE_TPL_TRILINOS \
-I/eigen/eigen-${{ env.eigen_version }} \
-I$trilinos_dir/include \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main.cpp
Expand All @@ -116,6 +123,7 @@ jobs:
-DPRESSIO_ENABLE_TPL_TRILINOS \
-I/eigen/eigen-${{ env.eigen_version }} \
-I$trilinos_dir/include \
-I${GITHUB_WORKSPACE}/pressio-log/include \
-I${GITHUB_WORKSPACE}/pressio-ops/include \
-I${PRESSIO_INSTALL_DIR}/include \
-c main_with_defines.cpp
Expand Down
43 changes: 38 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,51 @@ include(colors)
#=====================================================================
if(PRESSIO_OPS_INCLUDE_DIR)
message("${Green}-- Using ${PRESSIO_OPS_INCLUDE_DIR}")
include_directories(SYSTEM ${PRESSIO_OPS_INCLUDE_DIR})

else()

include(FetchContent)
message("${Green}-- PRESSIO_OPS_INCLUDE_DIR is not defined, so fetching pressio-ops...")

FetchContent_Declare(
pressio-ops
GIT_REPOSITORY https://github.com/Pressio/pressio-ops.git
GIT_TAG develop
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)

FetchContent_MakeAvailable(pressio-ops)
set(PRESSIO_OPS_INCLUDE_DIR ${pressio-ops_SOURCE_DIR}/include)
endif()

# logging
#=====================================================================
option(PRESSIO_ENABLE_LOGGING "Enable logging via pressio-log" ON)
if (PRESSIO_ENABLE_LOGGING)
add_compile_definitions(PRESSIO_ENABLE_LOGGING=1)
else()
add_compile_definitions(PRESSIO_ENABLE_LOGGING=0)
endif()

# get pressio-log (either find it or fetch it)
message(STATUS "PRESSIO_ENABLE_LOGGING = ${PRESSIO_ENABLE_LOGGING}")
if (PRESSIO_ENABLE_LOGGING)
if(PRESSIO_LOG_INCLUDE_DIR)
message("${Green}-- Using ${PRESSIO_LOG_INCLUDE_DIR}")
else()
include(FetchContent)
message("${Green}-- PRESSIO_LOG_INCLUDE_DIR is not defined, so fetching pressio-log...")
FetchContent_Declare(
pressio-log
GIT_REPOSITORY https://github.com/Pressio/pressio-log.git
GIT_TAG main
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(pressio-log)
set(PRESSIO_LOG_INCLUDE_DIR ${pressio-log_SOURCE_DIR}/include)
endif()
else()
message(STATUS "Logging has been disabled (PRESSIO_ENABLE_LOGGING=OFF)")
endif()

# versioning
#=====================================================================
# adapted from Eigen
Expand Down Expand Up @@ -77,6 +103,13 @@ if(PRESSIO_ENABLE_TESTS)
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${PRESSIO_OPS_INCLUDE_DIR}>"
)

if (PRESSIO_ENABLE_LOGGING)
target_include_directories(
pressio INTERFACE
"$<BUILD_INTERFACE:${PRESSIO_LOG_INCLUDE_DIR}>"
)
endif()

enable_testing()
add_subdirectory(tests)
endif()
166 changes: 0 additions & 166 deletions docs/source/components/utils.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ open an issue on `github <https://github.com/Pressio/pressio>`_.
./components/ode
./components/nonlinsolvers
./components/linsolvers
./components/utils

.. toctree::
:caption: Miscellanea
Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ or you can pick a `release version <https://github.com/Pressio/pressio/releases>

3. Use cmake to configure by passing to the comand line the target list of cmake variables to define.

For example, suppose we want to enable support for Trilinos and the debug prints. We would do:
For example, suppose we want to enable support for Trilinos and the loger. We would do:
Copy link
Member

Choose a reason for hiding this comment

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

typo


.. code-block:: bash

Expand All @@ -98,7 +98,7 @@ For example, suppose we want to enable support for Trilinos and the debug prints

cmake -D CMAKE_INSTALL_PREFIX=../install \
-D PRESSIO_ENABLE_TPL_TRILINOS=ON \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D PRESSIO_ENABLE_LOGGING=ON \
${PRESSIO_SRC}

make install # nothing is built, just headers copied to installation
Expand Down
Loading