Skip to content

Commit

Permalink
Merge pull request #287 from LLNL/feature/add_performance_testing
Browse files Browse the repository at this point in the history
Performance Testing
  • Loading branch information
ldowen authored Sep 26, 2024
2 parents c1100a3 + a249a09 commit 94bc035
Show file tree
Hide file tree
Showing 41 changed files with 865 additions and 170 deletions.
1 change: 0 additions & 1 deletion .gitlab/jobs-mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ blueos_cuda_11_gcc_spectrum_build:
blueos_cuda_11_gcc_spectrum_test:
extends: [.blueos_resource2, .cuda_11_gcc_spectrum, .run_ats]
needs: [blueos_cuda_11_gcc_spectrum_build]
allow_failure: true

blueos_cuda_11_gcc_spectrum_cleanup:
extends: [.blueos_resource2, .cuda_11_gcc_spectrum, .cleanup_dir]
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
path = extern/chai
url = https://github.com/llnl/chai
branch = feature/ManagedSharedPtr
ignore = all
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Notable changes include:
* TPL builds have been split off into a separate Gitlab CI stage to help with timeouts on allocations.
* Failed ATS runs are automatically retested once in the Gitlab CI.
* Python execute command is centralized in scripts/spheralutils.py now.
* Caliper updated v2.11.
* Adiak added as TPL.
* Created singleton wrapper for cali::ConfigManger and python wrapped Caliper timer and Adiak routines.

* Build changes / improvements:
* Distributed source directory must always be built now.
Expand All @@ -23,6 +26,8 @@ Notable changes include:
* The FSISPH package is now optional (SPHERAL\_ENABLE\_FSISPH).
* The GSPH package is now optional (SPHERAL\_ENABLE\_GSPH).
* The SVPH package is now optional (SPHERAL\_ENABLE\_SVPH).
* Cleaner Spheral Spack package.
* ENABLE\_DEV\_BUILD can now export targets properly.

* Bug Fixes / improvements:
* Wrappers for MPI calls are simplified and improved.
Expand Down
38 changes: 37 additions & 1 deletion cmake/InstallTPLs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ endif()
# Find pre-compiled TPLs
#-----------------------------------------------------------------------------------

# Any targets that used find package must be added to these lists
set(SPHERAL_FP_TPLS )
set(SPHERAL_FP_DIRS )

# Use find_package to get axom (which brings in fmt) and patch fmt
find_package(axom REQUIRED NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake)
list(APPEND SPHERAL_BLT_DEPENDS axom )
list(APPEND SPHERAL_FP_TPLS axom)
list(APPEND SPHERAL_FP_DIRS ${axom_DIR}/lib/cmake)

# This is a hack to handle transitive issues that come
# from using object libraries with newer version of axom
Expand All @@ -82,6 +88,31 @@ foreach(_comp ${AXOM_COMPONENTS_ENABLED})
list(APPEND SPHERAL_BLT_DEPENDS ${axom_deps})
endforeach()

message("-----------------------------------------------------------------------------")
# Use find_package to get adiak
find_package(adiak REQUIRED NO_DEFAULT_PATH PATHS ${adiak_DIR}/lib/cmake/adiak)
if(adiak_FOUND)
list(APPEND SPHERAL_BLT_DEPENDS adiak::adiak)
list(APPEND SPHERAL_FP_TPLS adiak)
list(APPEND SPHERAL_FP_DIRS ${adiak_DIR})
message("Found Adiak External Package")
endif()
message("-----------------------------------------------------------------------------")
# Use find_package to get caliper
if (ENABLE_TIMER)
# Save caliper_DIR because it gets overwritten by find_package
if(NOT CONFIG_CALIPER_DIR)
# Only save if it does not exists already
set(CONFIG_CALIPER_DIR "${caliper_DIR}" CACHE PATH "Configuration Caliper directory")
endif()
find_package(caliper REQUIRED NO_DEFAULT_PATH PATHS ${caliper_DIR}/share/cmake/caliper)
if(caliper_FOUND)
list(APPEND SPHERAL_BLT_DEPENDS caliper)
list(APPEND SPHERAL_FP_TPLS caliper)
list(APPEND SPHERAL_FP_DIRS ${caliper_DIR})
message("Found Caliper External Package")
endif()
endif()
message("-----------------------------------------------------------------------------")
find_package(RAJA REQUIRED NO_DEFAULT_PATH PATHS ${raja_DIR})
if (RAJA_FOUND)
Expand All @@ -100,6 +131,8 @@ if(chai_DIR AND USE_EXTERNAL_CHAI)
if (chai_FOUND)
message("Found chai External Package.")
endif()
list(APPEND SPHERAL_FP_TPLS chai)
list(APPEND SPHERAL_FP_DIRS ${chai_DIR})
else()
message("Using chai Submodule.")
set(chai_DIR "${SPHERAL_ROOT_DIR}/extern/chai")
Expand All @@ -108,6 +141,10 @@ else()
endif()

list(APPEND SPHERAL_BLT_DEPENDS chai camp RAJA umpire)
list(APPEND SPHERAL_FP_TPLS RAJA umpire)
list(APPEND SPHERAL_FP_DIRS ${raja_DIR} ${umpire_DIR})
set_property(GLOBAL PROPERTY SPHERAL_FP_TPLS ${SPHERAL_FP_TPLS})
set_property(GLOBAL PROPERTY SPHERAL_FP_DIRS ${SPHERAL_FP_DIRS})

message("-----------------------------------------------------------------------------")

Expand All @@ -116,7 +153,6 @@ list(APPEND SPHERAL_EXTERN_LIBS boost eigen qhull silo hdf5 polytope)

blt_list_append( TO SPHERAL_EXTERN_LIBS ELEMENTS aneos IF ENABLE_ANEOS)
blt_list_append( TO SPHERAL_EXTERN_LIBS ELEMENTS opensubdiv IF ENABLE_OPENSUBDIV)
blt_list_append( TO SPHERAL_EXTERN_LIBS ELEMENTS caliper IF ENABLE_TIMER)

# Create and install target library for each external library
foreach(lib ${SPHERAL_EXTERN_LIBS})
Expand Down
6 changes: 2 additions & 4 deletions cmake/SetupSpheral.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ endif()
# Build C++ tests and install tests to install directory
#-------------------------------------------------------------------------------
if (ENABLE_TESTS)
add_subdirectory(${SPHERAL_ROOT_DIR}/tests/unit/CXXTests)
add_subdirectory(${SPHERAL_ROOT_DIR}/tests/unit)

# A macro to preserve directory structure when installing files
macro(install_with_directory)
Expand Down Expand Up @@ -189,6 +189,4 @@ if (ENABLE_TESTS)
DESTINATION ${SPHERAL_TEST_INSTALL_PREFIX})
endif()

if(NOT ENABLE_DEV_BUILD)
include(${SPHERAL_ROOT_DIR}/cmake/SpheralConfig.cmake)
endif()
include(${SPHERAL_ROOT_DIR}/cmake/SpheralConfig.cmake)
35 changes: 14 additions & 21 deletions cmake/spheral/SpheralAddLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ function(spheral_add_obj_library package_name obj_list_name)
# Install the headers
install(FILES ${${package_name}_headers}
DESTINATION include/${package_name})

if(ENABLE_DEV_BUILD)
install(TARGETS Spheral_${package_name}
DESTINATION lib)
endif()
# Append Spheral_${package_name} to the global object list
# For example, SPHERAL_OBJ_LIBS or LLNLSPHERAL_OBJ_LIBS
set_property(GLOBAL APPEND PROPERTY ${obj_list_name} Spheral_${package_name})
Expand All @@ -71,7 +66,7 @@ endfunction()
# ----------------------
# INPUT-OUTPUT VARIABLES
# ----------------------
# package_name : REQUIRED : Desired package name
# package_name : REQUIRED : Desired package name (either CXX or LLNLCXX)
# _cxx_obj_list : REQUIRED : List of internal targets to include
# -----------------------
# OUTPUT VARIABLES TO USE - Made available implicitly after function call
Expand All @@ -85,28 +80,29 @@ function(spheral_add_cxx_library package_name _cxx_obj_list)
get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS)
# For including files in submodules, currently unused
get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES)
# Convert package name to lower-case for export target name
string(TOLOWER ${package_name} lower_case_package)
set(export_target_name spheral_${lower_case_package}-targets)

if(ENABLE_SHARED)
# Build shared spheral C++ library
blt_add_library(NAME Spheral_${package_name}
HEADERS ${${package_name}_headers}
SOURCES ${${package_name}_sources}
DEPENDS_ON ${_cxx_obj_list} ${SPHERAL_CXX_DEPENDS} ${SPHERAL_BLT_DEPENDS}
SHARED TRUE)
if(ENABLE_DEV_BUILD)
install(TARGETS ${_cxx_obj_list}
EXPORT ${export_target_name}
DESTINATION lib)
add_library(Spheral_${package_name} INTERFACE)
target_link_libraries(Spheral_${package_name} INTERFACE ${_cxx_obj_list})
else()
# Build static spheral C++ library
# Build static or shared spheral C++ library
blt_add_library(NAME Spheral_${package_name}
HEADERS ${${package_name}_headers}
SOURCES ${${package_name}_sources}
DEPENDS_ON ${_cxx_obj_list} ${SPHERAL_CXX_DEPENDS} ${SPHERAL_BLT_DEPENDS}
SHARED FALSE)
SHARED ${ENABLE_SHARED})
endif()
target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_SUBMOD_INCLUDES})
if(ENABLE_CUDA)
set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
endif()


## This cleans up library targets created with object libs. It is turned off as it triggers
## a failure on Werror and pedantic builds.
#set(_properties COMPILE_DEFINITIONS LINK_LIBRARIES LINK_OPTIONS INTERFACE_LINK_OPTIONS COMPILE_OPTIONS INTERFACE_COMPILE_OPTIONS)
Expand All @@ -118,15 +114,12 @@ function(spheral_add_cxx_library package_name _cxx_obj_list)

#set_target_properties(Spheral_${package_name} PROPERTIES INTERFACE_LINK_LIBRARIES "")

# Convert package name to lower-case for export target name
string(TOLOWER ${package_name} lower_case_package)

# Install Spheral C++ target and set it as an exportable CMake target
install(TARGETS Spheral_${package_name}
DESTINATION lib
EXPORT spheral_${lower_case_package}-targets)
EXPORT ${export_target_name})
# Export Spheral target
install(EXPORT spheral_${lower_case_package}-targets DESTINATION lib/cmake)
install(EXPORT ${export_target_name} DESTINATION lib/cmake)

# Set the r-path of the C++ lib such that it is independent of the build dir when installed
set_target_properties(Spheral_${package_name} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
Expand Down
2 changes: 1 addition & 1 deletion cmake/spheral/SpheralInstallPythonFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function(spheral_install_python_files)
install(FILES ${ARGV}
DESTINATION ${SPHERAL_SITE_PACKAGES_PATH}/Spheral)
install(CODE "execute_process( \
COMMAND ${PYTHON_EXE} -m compileall DESTINATION ${SPHERAL_SITE_PACKAGES_PATH}/Spheral \
COMMAND ${PYTHON_EXE} -m compileall ${SPHERAL_SITE_PACKAGES_PATH}/Spheral \
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})")
endif()

Expand Down
13 changes: 8 additions & 5 deletions cmake/spheral_cxx-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ if(NOT SPHERAL_FOUND)
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_EXE ${Python3_EXECUTABLE})
endif()

if(NOT TARGET axom)
find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR} ${axom_DIR}/lib ${axom_DIR}/lib/cmake)
endif()
# Loop over TPLs that use find_package
set(SPHERAL_FP_TPLS "@SPHERAL_FP_TPLS@")
set(SPHERAL_FP_DIRS "@SPHERAL_FP_DIRS@")
foreach(tpl dir IN ZIP_LISTS SPHERAL_FP_TPLS SPHERAL_FP_DIRS)
if(NOT TARGET ${tpl})
find_package(${tpl} REQUIRED QUIET NO_DEFAULT_PATH PATHS ${dir})
endif()
endforeach()
if(NOT TARGET chai)
if (@USE_EXTERNAL_CHAI@)
set(SPHERAL_CHAI_DIR "@chai_DIR@/lib/cmake/chai")
Expand All @@ -47,7 +51,6 @@ if(NOT SPHERAL_FOUND)
endif()
endif()
include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake")

set_property(TARGET Spheral_CXX
APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS})
Expand Down
1 change: 0 additions & 1 deletion cmake/tpl/caliper.cmake

This file was deleted.

46 changes: 24 additions & 22 deletions docs/build_guide/include/appendecies/cmake_config.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ For just the C++ compiled Spheral a number of TPLs are required:
- Polyclipper
- Conduit
- Axom
- Adiak
- Caliper

There are also a number of libraries / python packages that are required for compiling the python bindings and executing Spheral at runtime:

Expand Down Expand Up @@ -66,58 +68,58 @@ OpenMP and MPI support is handled through BLT. Use the option flags ``-DENABLE_
CMake variables
--------------------

In this section we list the CMake variables that can be tweaked for a Spheral build. Where appropriate the options are listed, with the default value in *italics*.
In this section we list the CMake variables that can be tweaked for a Spheral build. Where appropriate the options are listed, with the default value in **bold**.

``CMAKE_BUILD_TYPE`` (Debug, *Release*, RelWithDebInfo, MinSizeRel)
``CMAKE_BUILD_TYPE`` (Debug, **Release**, RelWithDebInfo, MinSizeRel)
Choose the type of build -- for more information see the `CMake documentation <https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`_.

``CMAKE_INSTALL_PREFIX``
The top-level path for installing Spheral include files, libraries, and any Python modules or documentation.

``ENABLE_CXXONLY`` (On, *Off*)
``ENABLE_CXXONLY`` (On, **Off**)
Do not build python wrappers for Spheral.

``ENABLE_STATIC_CXXONLY`` (On, *Off*)
``ENABLE_STATIC_CXXONLY`` (On, **Off**)
Do not build python wrappers for Spheral. Build and export static library files for Spheral.

``ENABLE_SHARED`` (*On*, Off)
``ENABLE_SHARED`` (**On**, Off)
Build Spheral C++ libraries as shared libraries.

``ENABLE_DEV_BUILD`` (On, *Off*)
``ENABLE_DEV_BUILD`` (On, **Off**)
Builds separate internal C++ libraries for faster code development.

``<TPL-Name-Here>_DIR``
Directory of previously built TPL.

``ENABLE_STATIC_TPL`` (On, *Off*)
``ENABLE_STATIC_TPL`` (On, **Off**)
Link static libraries instead of shared for HDF5 and Conduit.

``ENABLE_OPENMP`` (*On*, Off)
``ENABLE_OPENMP`` (**On**, Off)
Support for OpenMP.

``ENABLE_MPI`` (*On*, Off)
``ENABLE_MPI`` (**On**, Off)
Support for MPI.

``ENABLE_1D`` (*On*, Off)
``ENABLE_1D`` (**On**, Off)
Build Spheral with 1D support.

``ENABLE_2D`` (*On*, Off)
``ENABLE_2D`` (**On**, Off)
Build Spheral with 2D support.

``ENABLE_3D`` (*On*, Off)
``ENABLE_3D`` (**On**, Off)
Build Spheral with 3D support.

``ENABLE_ANEOS`` (*On*, Off)
``ENABLE_ANEOS`` (**On**, Off)
Install the ANEOS (Analytics Equation of State) package along with the Spheral interface to it. This is a legacy equation of state frequently used for geophysical materials. See descriptions in the `iSALE <https://github.com/isale-code/M-ANEOS>`_ documentation.

``ENABLE_HELMHOLTZ`` (*On*, Off)
``ENABLE_HELMHOLTZ`` (**On**, Off)
Compile the included Helmholtz equation of state, typically used in astrophysical calculations. See a discussion `here <http://cococubed.asu.edu/code_pages/eos.shtml>`_.

``ENABLE_OPENSUBDIV`` (*On*, Off)
``ENABLE_OPENSUBDIV`` (**On**, Off)
Install the Opensubdiv library along with the Spheral interface to it. Opensubdiv is a `Pixar provided library <https://github.com/PixarAnimationStudios/OpenSubdiv>`_, which Spheral uses to implement refinement of polyhedra for some specialized problem generation capabilities.

``ENABLE_TIMER`` (*On*, Off)
Enable timer information from Spheral.
``ENABLE_TIMER`` (On, **Off**)
Enable Caliper timer information for Spheral.

``DBC_MODE`` (None, All, Pre)
Set the compile time design by contract (DBC) mode for Spheral. Design by contract statements are very useful developer tools, whereby the developer can insert tests in the code as they write it. These statements are both useful for tracking down bugs with fine-grained testing throughout the code, as well as useful documentation in the code about what sort of conditions are expected to hold.
Expand All @@ -138,23 +140,23 @@ In this section we list the CMake variables that can be tweaked for a Spheral bu

It is worth noting ``DBC_MODE=All`` is quite expensive at run time (of order 4x more), so this is not intended to be active for a release/production compilation of Spheral.

``ENABLE_WARNINGS`` (On, *Off*)
``ENABLE_WARNINGS`` (On, **Off**)
Enable compiler warnings.

``ENABLE_BOUNDCHECKING`` (On, *Off*)
``ENABLE_BOUNDCHECKING`` (On, **Off**)
If building with the Gnu compilers enable STL bound checking by passing -D_GLIBCXX_DEBUG=1 to the compiler.
Note, this is a very expensive option at runtime!

``ENABLE_NAN_EXCEPTIONS`` (On, *Off*)
``ENABLE_NAN_EXCEPTIONS`` (On, **Off**)
Raise exceptions in the C++ code when floating-point exceptions occur. Gnu compilers only.

``ENABLE_DOCS`` (On, *Off*)
``ENABLE_DOCS`` (On, **Off**)
Choose whether or not to build this documentation.

``SPHINX_EXECUTABLE``
Specify where the Sphinx executable is that should be used to build documentation. If not given, assumes the Spheral built Sphinx will be used.

``SPHINX_THEME`` (*sphinx_rtd_theme*)
``SPHINX_THEME`` (**sphinx_rtd_theme**)
Give the Sphinx theme to use when generating documentation. Default based on read the docs theme.

``SPHINX_THEME_DIR``
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# -- Project information -----------------------------------------------------

project = 'Spheral'
copyright = '2012, LLNS'
copyright = '2024, LLNS'
author = 'J. Michael Owen'

# The short X.Y version
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import sphinx_rtd_theme
# -- Project information -----------------------------------------------------

project = 'Spheral'
copyright = '2012, LLNS'
copyright = '2024, LLNS'
author = 'J. Michael Owen'

# The short X.Y version
Expand Down
Loading

0 comments on commit 94bc035

Please sign in to comment.