From 4e7103a32b1dbfcb3aa33593e8dfb790af78b76d Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Tue, 2 Apr 2024 14:35:45 -0600 Subject: [PATCH 1/4] Add boost::make_shared header to timeseries --- src/timeseries/timeseries.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/timeseries/timeseries.hpp b/src/timeseries/timeseries.hpp index 565eb056..e8608dcb 100644 --- a/src/timeseries/timeseries.hpp +++ b/src/timeseries/timeseries.hpp @@ -35,6 +35,7 @@ #include // for boost::posix #include +#include #include #include #include From c52ecefb5af1e3f566b313fa32995c4cd9d02f7f Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 2 May 2024 20:36:41 +0000 Subject: [PATCH 2/4] Misc changes and WIP --- CMake/FindTBB.cmake | 450 ------------------------------------- CMakeLists.txt | 76 +++---- spack.yaml | 37 +-- src/CMakeLists.txt | 6 + src/main.cpp | 2 +- src/timeseries/netcdf.cpp | 2 +- third_party/CMakeLists.txt | 1 - 7 files changed, 56 insertions(+), 518 deletions(-) delete mode 100644 CMake/FindTBB.cmake diff --git a/CMake/FindTBB.cmake b/CMake/FindTBB.cmake deleted file mode 100644 index 5ba89d52..00000000 --- a/CMake/FindTBB.cmake +++ /dev/null @@ -1,450 +0,0 @@ -# - Find ThreadingBuildingBlocks include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(TBB -# [REQUIRED] # Fail with error if TBB is not found -# ) # -# Once done, this will define -# -# TBB_FOUND - system has TBB -# TBB_INCLUDE_DIRS - the TBB include directories -# TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or -# malloc proxy -# TBB::tbb - imported target for the TBB library -# -# TBB_VERSION_MAJOR - Major Product Version Number -# TBB_VERSION_MINOR - Minor Product Version Number -# TBB_INTERFACE_VERSION - Engineering Focused Version Number -# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version -# still supported. This uses the engineering -# focused interface version numbers. -# -# TBB_MALLOC_FOUND - system has TBB malloc library -# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories -# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined -# TBB::malloc - imported target for the TBB malloc library -# -# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library -# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories -# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined -# TBB::malloc_proxy - imported target for the TBB malloc proxy library -# -# -# This module reads hints about search locations from variables: -# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds -# ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation -# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb -# libraries. Should be specified with ENV TBB_ROOT -# and optionally... -# ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build -# -# -# Modified by Robert Maynard from the original OGRE source -# -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see http://www.ogre3d.org/ -# -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- -# -#============================================================================= -# Copyright 2010-2012 Kitware, Inc. -# Copyright 2012 Rolf Eike Beer -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -#============================================================================= -# FindTBB helper functions and macros -# - -# Use TBBConfig.cmake if possible. - -set(_tbb_find_quiet) -if (TBB_FIND_QUIETLY) - set(_tbb_find_quiet QUIET) -endif () -set(_tbb_find_components) -set(_tbb_find_optional_components) -foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) - if (TBB_FIND_REQUIRED_${_tbb_find_component}) - list(APPEND _tbb_find_components "${_tbb_find_component}") - else () - list(APPEND _tbb_find_optional_components "${_tbb_find_component}") - endif () -endforeach () -unset(_tbb_find_component) -find_package(TBB CONFIG ${_tbb_find_quiet} - COMPONENTS ${_tbb_find_components} - OPTIONAL_COMPONENTS ${_tbb_find_optional_components}) -unset(_tbb_find_quiet) -unset(_tbb_find_components) -unset(_tbb_find_optional_components) -if (TBB_FOUND) - return () -endif () - -#==================================================== -# Fix the library path in case it is a linker script -#==================================================== -function(tbb_extract_real_library library real_library) - if(NOT UNIX OR NOT EXISTS ${library}) - set(${real_library} "${library}" PARENT_SCOPE) - return() - endif() - - #Read in the first 4 bytes and see if they are the ELF magic number - set(_elf_magic "7f454c46") - file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) - if(_hex_data STREQUAL _elf_magic) - #we have opened a elf binary so this is what - #we should link to - set(${real_library} "${library}" PARENT_SCOPE) - return() - endif() - - file(READ ${library} _data OFFSET 0 LIMIT 1024) - if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") - #extract out the .so name from REGEX MATCH command - set(_proper_so_name "${CMAKE_MATCH_1}") - - #construct path to the real .so which is presumed to be in the same directory - #as the input file - get_filename_component(_so_dir "${library}" DIRECTORY) - set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE) - else() - #unable to determine what this library is so just hope everything works - #and pass it unmodified. - set(${real_library} "${library}" PARENT_SCOPE) - endif() -endfunction() - -#=============================================== -# Do the final processing for the package find. -#=============================================== -macro(findpkg_finish PREFIX TARGET_NAME) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - else () - if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) - message(FATAL_ERROR "Required library ${PREFIX} not found.") - endif () - endif () - - if (NOT TARGET "TBB::${TARGET_NAME}") - if (${PREFIX}_LIBRARY_RELEASE) - tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) - endif () - if (${PREFIX}_LIBRARY_DEBUG) - tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) - endif () - add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") - if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}" - IMPORTED_LOCATION_DEBUG "${real_debug}" - IMPORTED_LOCATION_RELEASE "${real_release}") - elseif (${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}") - elseif (${PREFIX}_LIBRARY_DEBUG) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_debug}") - endif () - endif () - - #mark the following variables as internal variables - mark_as_advanced(${PREFIX}_INCLUDE_DIR - ${PREFIX}_LIBRARY - ${PREFIX}_LIBRARY_DEBUG - ${PREFIX}_LIBRARY_RELEASE) -endmacro() - -#=============================================== -# Generate debug names from given release names -#=============================================== -macro(get_debug_names PREFIX) - foreach(i ${${PREFIX}}) - set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) - endforeach() -endmacro() - -#=============================================== -# See if we have env vars to help us find tbb -#=============================================== -macro(getenv_path VAR) - set(ENV_${VAR} $ENV{${VAR}}) - # replace won't work if var is blank - if (ENV_${VAR}) - string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) - endif () -endmacro() - -#=============================================== -# Couple a set of release AND debug libraries -#=============================================== -macro(make_library_set PREFIX) - if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) - set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG}) - elseif (${PREFIX}_RELEASE) - set(${PREFIX} ${${PREFIX}_RELEASE}) - elseif (${PREFIX}_DEBUG) - set(${PREFIX} ${${PREFIX}_DEBUG}) - endif () -endmacro() - - -#============================================================================= -# Now to actually find TBB -# - -# Get path, convert backslashes as ${ENV_${var}} -getenv_path(TBB_ROOT) - -# initialize search paths -set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT}) -set(TBB_INC_SEARCH_PATH "") -set(TBB_LIB_SEARCH_PATH "") - - -# If user built from sources -set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX}) -if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT) - getenv_path(TBB_BUILD_DIR) - if (NOT ENV_TBB_BUILD_DIR) - set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build) - endif () - - # include directory under ${ENV_TBB_ROOT}/include - list(APPEND TBB_LIB_SEARCH_PATH - ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release - ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug) -endif () - - -# For Windows, let's assume that the user might be using the precompiled -# TBB packages from the main website. These use a rather awkward directory -# structure (at least for automatically finding the right files) depending -# on platform and compiler, but we'll do our best to accommodate it. -# Not adding the same effort for the precompiled linux builds, though. Those -# have different versions for CC compiler versions and linux kernels which -# will never adequately match the user's setup, so there is no feasible way -# to detect the "best" version to use. The user will have to manually -# select the right files. (Chances are the distributions are shipping their -# custom version of tbb, anyway, so the problem is probably nonexistent.) -if (WIN32 AND MSVC) - set(COMPILER_PREFIX "vc7.1") - if (MSVC_VERSION EQUAL 1400) - set(COMPILER_PREFIX "vc8") - elseif(MSVC_VERSION EQUAL 1500) - set(COMPILER_PREFIX "vc9") - elseif(MSVC_VERSION EQUAL 1600) - set(COMPILER_PREFIX "vc10") - elseif(MSVC_VERSION EQUAL 1700) - set(COMPILER_PREFIX "vc11") - elseif(MSVC_VERSION EQUAL 1800) - set(COMPILER_PREFIX "vc12") - elseif(MSVC_VERSION GREATER_EQUAL 1900) - set(COMPILER_PREFIX "vc14") - endif () - - # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path - foreach (dir IN LISTS TBB_PREFIX_PATH) - if (CMAKE_CL_64) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX}) - else () - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX}) - endif () - endforeach () -endif () - -# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9) -# and above and AppleClang -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND - NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0) - set (USE_LIBCXX OFF) - cmake_policy(GET CMP0025 POLICY_VAR) - - if (POLICY_VAR STREQUAL "NEW") - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - set (USE_LIBCXX ON) - endif () - else () - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set (USE_LIBCXX ON) - endif () - endif () - - if (USE_LIBCXX) - foreach (dir IN LISTS TBB_PREFIX_PATH) - list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib) - endforeach () - endif () -endif () - -# check compiler ABI -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(COMPILER_PREFIX) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - list(APPEND COMPILER_PREFIX "gcc4.8") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) - list(APPEND COMPILER_PREFIX "gcc4.7") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) - list(APPEND COMPILER_PREFIX "gcc4.4") - endif() - list(APPEND COMPILER_PREFIX "gcc4.1") -elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(COMPILER_PREFIX) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess - list(APPEND COMPILER_PREFIX "gcc4.8") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) - list(APPEND COMPILER_PREFIX "gcc4.7") - endif() - list(APPEND COMPILER_PREFIX "gcc4.4") -else() # Assume compatibility with 4.4 for other compilers - list(APPEND COMPILER_PREFIX "gcc4.4") -endif () - -# if platform architecture is explicitly specified -set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) -if (TBB_ARCH_PLATFORM) - foreach (dir IN LISTS TBB_PREFIX_PATH) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM}) - endforeach () -endif () - -foreach (dir IN LISTS TBB_PREFIX_PATH) - foreach (prefix IN LISTS COMPILER_PREFIX) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib) - else () - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib) - endif () - endforeach() -endforeach () - -# add general search paths -foreach (dir IN LISTS TBB_PREFIX_PATH) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb - ${dir}/Libs) - list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include - ${dir}/include/tbb) -endforeach () - -set(TBB_LIBRARY_NAMES tbb) -get_debug_names(TBB_LIBRARY_NAMES) - - -find_path(TBB_INCLUDE_DIR - NAMES tbb/tbb.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_LIBRARY_RELEASE - NAMES ${TBB_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_LIBRARY_DEBUG - NAMES ${TBB_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) -make_library_set(TBB_LIBRARY) - -findpkg_finish(TBB tbb) - -#if we haven't found TBB no point on going any further -if (NOT TBB_FOUND) - return() -endif () - -#============================================================================= -# Look for TBB's malloc package -set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc) -get_debug_names(TBB_MALLOC_LIBRARY_NAMES) - -find_path(TBB_MALLOC_INCLUDE_DIR - NAMES tbb/tbb.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_MALLOC_LIBRARY_RELEASE - NAMES ${TBB_MALLOC_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_MALLOC_LIBRARY_DEBUG - NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) -make_library_set(TBB_MALLOC_LIBRARY) - -findpkg_finish(TBB_MALLOC tbbmalloc) - -#============================================================================= -# Look for TBB's malloc proxy package -set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy) -get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES) - -find_path(TBB_MALLOC_PROXY_INCLUDE_DIR - NAMES tbb/tbbmalloc_proxy.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE - NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG - NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) -make_library_set(TBB_MALLOC_PROXY_LIBRARY) - -findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) - - -#============================================================================= -#parse all the version numbers from tbb -if(NOT TBB_VERSION) - - #only read the start of the file - file(STRINGS - "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" - TBB_VERSION_CONTENTS - REGEX "VERSION") - - string(REGEX REPLACE - ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" - TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" - TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") - -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index e5c2ad6e..06ff4ac3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ cmake_policy(SET CMP0074 NEW) # set RPATH ON cmake_policy(SET CMP0042 NEW) +# Use _ROOT +cmake_policy(SET CMP0144 NEW) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -36,15 +39,12 @@ option(BUILD_DOCS "Builds documentation" OFF) message(STATUS "This is an MPI build? ${USE_MPI}") - - - if(BUILD_WITH_CONAN) message(FATAL_ERROR "Building CHM with conan is no longer supported in favour of using spack. Please revise build env accordingly.\n https://chm.readthedocs.io/en/dev/build.html") endif() if(NOT USE_MPI) - message(FATAL_ERROR "Building CHM wihtout MPI support is no longer supported") + message(FATAL_ERROR "Building CHM without MPI support is no longer supported") endif() option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE) @@ -128,47 +128,27 @@ endmacro() # Need to check for MPI before building external libraries find_package(MPI REQUIRED COMPONENTS C CXX Fortran) # MPI_C is needed for the mpi that HDF can bring in -if(MPI_FOUND AND USE_MPI) - message(STATUS "Found MPI at ${MPI_CXX_INCLUDE_DIRS}") - add_definitions(-DUSE_MPI) -else() - message(WARNING "MPI not enabled. Building for single process.") -endif() -if(USE_MPI AND NOT MPI_FOUND) - message(FATAL_ERROR "MPI was asked for, but not found") -endif() +message(STATUS "Found MPI at ${MPI_CXX_INCLUDE_DIRS}") +add_definitions(-DUSE_MPI) + set(Boost_USE_MULTITHREADED ON) #https://stackoverflow.com/a/58085634/410074 -if(USE_MPI AND MPI_FOUND) - find_package(Boost - 1.71.0 - COMPONENTS - system - filesystem - date_time - thread - regex - iostreams - program_options - mpi - serialization - REQUIRED) -else() - find_package(Boost - 1.71.0 - COMPONENTS - system - filesystem - date_time - log - thread - regex - iostreams - program_options - REQUIRED - ) -endif() + +find_package(Boost + 1.83.0 + COMPONENTS + system + filesystem + date_time + thread + regex + iostreams + program_options + mpi + serialization + REQUIRED) + #need this for calling the logger from multiple modules add_definitions(-DBOOST_LOG_DYN_LINK) @@ -178,7 +158,7 @@ add_definitions(-DBOOST_LOG_DYN_LINK) # ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’ add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) - +find_package(TBB REQUIRED CONFIG) find_package(CGAL 5.0 REQUIRED) # There is a bug in clang <11 (so far), that has a compiler parse error w/ boost 1.71 @@ -261,8 +241,9 @@ create_target(ARMADILLO) find_package(Eigen3 REQUIRED NO_MODULE) +set(BLA_VENDOR OpenBLAS) find_package(BLAS REQUIRED) -create_target(BLAS) # cmake < 3.18 + find_package(Sparsehash) @@ -297,7 +278,7 @@ create_target(PROJ) find_package (Threads REQUIRED) -find_package(TBB REQUIRED) + find_package(GSL REQUIRED) create_target(GSL) @@ -307,7 +288,8 @@ create_target(HDF5) find_package(NetCDF COMPONENTS C CXX REQUIRED) -find_package(spdlog REQUIRED) +find_package(spdlog CONFIG REQUIRED) +add_compile_definitions(SPDLOG_FMT_EXTERNAL) #To avoid issues #104, newer VTK version needs to be used. #8.1+ needs to be used so that proj4 name-collisions are resolved @@ -345,7 +327,7 @@ else() message(STATUS "gvpr and dot present, module output to pdf will function.") endif() -find_package(Trilinos 14.0 REQUIRED) +find_package(Trilinos 15.0 REQUIRED) create_target(Trilinos) #setup src dirs diff --git a/spack.yaml b/spack.yaml index 10057fcd..eda9ccdb 100644 --- a/spack.yaml +++ b/spack.yaml @@ -10,24 +10,25 @@ spack: # - vtk: [ vtk@9.2.6 ^mesa~llvm ] # when: '"ubuntu" in os' specs: - - boost@1.83.0+system+filesystem+date_time+thread+regex+iostreams+program_options+mpi+serialization - - cgal@5.5.2+header_only - - hdf5@1.14.3+cxx - - netcdf-cxx4@4.3.1 - - gdal@3.8.0 ^proj@9.2.1+curl+tiff - - proj@9.2.1+curl+tiff - - sparsehash@2.0.4 - - gperftools@2.13 - - gsl@2.7.1+external-cblas - - armadillo@12.4.0 - - intel-tbb@2021.9.0 - - eigen@3.4.0 - - meteoio@2.8.0 - - func@2.0 - - trilinos@14.4.0+mpi ^openmpi - - jemalloc@5.3.0 - - vtk@9.2.6 - - spdlog@1.12.0 + - "boost@1.83.0: +system+filesystem+date_time+thread+regex+iostreams+program_options+mpi+serialization" + - cgal +header_only + - hdf5 +cxx + - netcdf-cxx4 + - "gdal@3.8: +hdf5 +netcdf" + - "proj@9.2.1+curl+tiff" + - sparsehash + - gperftools + - gsl +external-cblas + - armadillo + - intel-oneapi-tbb + - eigen + - meteoio + - func + - "trilinos@15.0.0 +mpi +threadsafe +openmp" + - jemalloc + - "vtk@9:" + - spdlog + - openblas view: true concretizer: unify: true diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb181072..ee4a8a6f 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -202,6 +202,10 @@ if(BUILD_WITH_CONAN) endif() endif() + +add_compile_definitions(SPDLOG_FMT_EXTERNAL) +message("-- Final compile: ${CHM_BUILD_FLAGS}") + add_library(CHMmath OBJECT math/LinearAlgebra.cpp ) @@ -237,12 +241,14 @@ if(MPI_FOUND AND USE_MPI) endif() + target_compile_features(CHM PRIVATE cxx_std_14) target_link_libraries( CHM CHMmath ${EXT_TARGETS} ${THIRD_PARTY_TARGETS} + ${THIRD_PARTY_TARGETS} ) set_target_properties(CHM PROPERTIES diff --git a/src/main.cpp b/src/main.cpp index b430c235..2169a649 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,7 +74,7 @@ int main (int argc, char *argv[]) kernel.end(); try { - boost::filesystem::copy_file(kernel.log_file_path,kernel.o_path / "CHM.log", boost::filesystem::copy_option::overwrite_if_exists); + boost::filesystem::copy_file(kernel.log_file_path,kernel.o_path / "CHM.log", boost::filesystem::copy_options::overwrite_existing); } catch(...) { diff --git a/src/timeseries/netcdf.cpp b/src/timeseries/netcdf.cpp index e3aba02a..3eded721 100644 --- a/src/timeseries/netcdf.cpp +++ b/src/timeseries/netcdf.cpp @@ -303,7 +303,7 @@ void netcdf::open_GEM(const std::string &file) ygrid = itr.second.getSize(); } - SPDLOG_DEBUG("NetCDF grid is {} (x) by {} (y) {}", xgrid, ygrid); + SPDLOG_DEBUG("NetCDF grid is {} (x) by {} (y)", xgrid, ygrid); } diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 6e582888..03179fad 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -48,7 +48,6 @@ target_include_directories(SNOBAL PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/ # needed for logger.hpp... that's a funny dependence ) -message(FATAL "${CHM_BUILD_FLAGS}") set_target_properties( SNOBAL PROPERTIES From 4cc00c94d986ce4cc3a78d6e7a08c698bbbe9b4e Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 2 May 2024 16:24:38 -0600 Subject: [PATCH 3/4] remove duplicate compile option --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee4a8a6f..e62642ae 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -203,7 +203,6 @@ if(BUILD_WITH_CONAN) endif() -add_compile_definitions(SPDLOG_FMT_EXTERNAL) message("-- Final compile: ${CHM_BUILD_FLAGS}") add_library(CHMmath OBJECT From a8e7ff23c518488369bdb767e4ac266bcadf05ea Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 2 May 2024 16:24:51 -0600 Subject: [PATCH 4/4] protect boost < 1.74 --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 2169a649..751bd022 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,8 +74,12 @@ int main (int argc, char *argv[]) kernel.end(); try { +#if BOOST_VERSION < 107400 + boost::filesystem::copy_file(kernel.log_file_path,kernel.o_path / "CHM.log", boost::filesystem::copy_option::overwrite_if_exists); +#else boost::filesystem::copy_file(kernel.log_file_path,kernel.o_path / "CHM.log", boost::filesystem::copy_options::overwrite_existing); - } +#endif +} catch(...) {