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

[Trivial] Add ability to use system packages #1171

Merged
merged 4 commits into from
Sep 11, 2024
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Current develop

### Added (new features/APIs/variables/...)
- [[PR 1171]](https://github.com/parthenon-hpc-lab/parthenon/pull/1171) Add PARTHENON_USE_SYSTEM_PACKAGES build option


### Changed (changing behavior/API/variables/...)


Expand Down
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright(C) 2020-2024 The Parthenon collaboration
# Licensed under the 3-clause BSD License, see LICENSE file for details
#=========================================================================================
# (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved.
# (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved.
#
# This program was produced under U.S. Government contract 89233218CNA000001 for Los
# Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
Expand Down Expand Up @@ -60,6 +60,17 @@ option(CODE_COVERAGE "Enable code coverage reporting" OFF)
option(ENABLE_ASAN "Turn on ASAN" OFF)
option(ENABLE_HWASAN "Turn on HWASAN (currently ARM-only)" OFF)

option(PARTHENON_USE_SYSTEM_PACKAGES "Enables search for system packages when available" OFF)
if (PARTHENON_USE_SYSTEM_PACKAGES)
option(PARTHENON_IMPORT_KOKKOS
"If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon"
ON)
else()
option(PARTHENON_IMPORT_KOKKOS
"If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon"
OFF)
endif()
Comment on lines +64 to +72
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I considered using CMakeDependentOption here, but I want IMPORT_KOKKOS available and user-visible no matter which setting of PARTHENON_USE_SYSTEM_PACKAGES was chosen.


include(cmake/Format.cmake)
include(cmake/Lint.cmake)

Expand Down Expand Up @@ -204,7 +215,6 @@ endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)

option(PARTHENON_IMPORT_KOKKOS "If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon" OFF)
if (NOT TARGET Kokkos::kokkos)
if (PARTHENON_IMPORT_KOKKOS)
find_package(Kokkos 4)
Expand Down Expand Up @@ -367,7 +377,11 @@ if (PARTHENON_ENABLE_UNIT_TESTS OR PARTHENON_ENABLE_INTEGRATION_TESTS OR PARTHEN
endif()

if (PARTHENON_ENABLE_ASCENT)
find_package(Ascent REQUIRED NO_DEFAULT_PATH)
if (PARTHENON_USE_SYSTEM_PACKAGES)
find_package(Ascent REQUIRED)
else()
find_package(Ascent REQUIRED NO_DEFAULT_PATH)
endif()
endif()

# Installation configuration
Expand Down
3 changes: 2 additions & 1 deletion doc/sphinx/src/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ General list of cmake options:
|| PARTHENON\_COPYRIGHT\_CHECK\_DEFAULT || OFF || Option || Check copyright as part of the default target (otherwise use the `check-copyright` target) |
|| CMAKE\_INSTALL\_PREFIX || machine specific || String || Optional path for library installation |
|| Kokkos\_ROOT || unset || String || Path to a Kokkos source directory (containing CMakeLists.txt) |
|| PARTHENON\_IMPORT\_KOKKOS || ON/OFF || Option || If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon |
|| PARTHENON\_USE\_SYSTEM\_PACKAGES || OFF || Option || If ON, attempt to link to system dependencies for Kokkos and Ascent if possible. If OFF, will avoid doing so by default. |
|| PARTHENON\_IMPORT\_KOKKOS || OFF/ON || Option || If ON, attempt to link to an external Kokkos library. Else build from source. Default is ON if PARTHENON\_USE\_SYSTEM\_PACKAGES and OFF otherwise. |
|| BUILD\_SHARED\_LIBS || OFF || Option || If installing Parthenon, whether to build as shared rather than static |
+-------------------------------------------+--------------------------------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+

Expand Down
Loading