From 2803474fa2f0c204cbfbc62653f91c4d908bfbec Mon Sep 17 00:00:00 2001 From: KyleKlenk <kyle.c.klenk@gmail.com> Date: Wed, 29 Mar 2023 13:52:07 -0600 Subject: [PATCH] Add Kinsol_Cluster option Added Kinsol_Cluster option to cmake --- build/cmake/CMakeLists.txt | 16 ++-- build/cmake/kinsol.cmake | 156 ++++++++++++++++++++----------------- 2 files changed, 92 insertions(+), 80 deletions(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index bdc7360..93f92e8 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -24,9 +24,9 @@ include(ida.cmake) ######### SET THE PATHS TO THE SUNDIALS LIBRARIES AND INCLUDE FILES ######### ############################################################################# -# set(DIR_SUNDIALS "/globalhome/kck540/HPC/Libraries/sundials/instdir") +set(DIR_SUNDIALS "/globalhome/kck540/HPC/Libraries/sundials/instdir") # set(DIR_SUNDIALS "/home/kklenk/projects/rpp-kshook/CompHydCore/SummaSundials/sundials/sundials/instdir") -set(DIR_SUNDIALS "/usr/local/sundials-6.3.0") +# set(DIR_SUNDIALS "/usr/local/sundials-6.3.0") ############################################################################# # Set default build type to Release @@ -35,10 +35,10 @@ if(NOT CMAKE_BUILD_TYPE) endif() # Add options for build type -set(CMAKE_CONFIGURATION_TYPES Debug Release Cluster Cluster_Debug Kinsol Kinsol_Debug IDA IDA_DEBUG) - +set(CMAKE_CONFIGURATION_TYPES Debug Release Cluster Cluster_Debug Kinsol Kinsol_Debug Kinsol_Cluster IDA IDA_DEBUG) +message("Build type: ${CMAKE_BUILD_TYPE}") # Set compiler flags -if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES Cluster_Debug OR CMAKE_BUILD_TYPE MATCHES Kinsol_Debug) +if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL Cluster_Debug OR CMAKE_BUILD_TYPE STREQUAL Kinsol_Debug) message("Debug build.") add_definitions(-DDEBUG) set(SUMMA_NOAHMP_OPTIONS -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors) @@ -56,7 +56,7 @@ endif() # Set include directories -if (CMAKE_BUILD_TYPE MATCHES Cluster OR CMAKE_BUILD_TYPE MATCHES Cluster_Debug) +if (CMAKE_BUILD_TYPE STREQUAL Cluster OR CMAKE_BUILD_TYPE STREQUAL Cluster_Debug) find_package(CAF REQUIRED) find_package(netCDF REQUIRED) @@ -65,7 +65,7 @@ if (CMAKE_BUILD_TYPE MATCHES Cluster OR CMAKE_BUILD_TYPE MATCHES Cluster_Debug) compile_summa_original(PARENT_DIR, ${DIR_SUNDIALS}) -elseif(CMAKE_BUILD_TYPE MATCHES IDA OR CMAKE_BUILD_TYPE MATCHES IDA_DEBUG) +elseif(CMAKE_BUILD_TYPE STREQUAL IDA OR CMAKE_BUILD_TYPE STREQUAL IDA_DEBUG) find_package(CAF REQUIRED) find_package(netCDF REQUIRED) find_package(LAPACK REQUIRED) @@ -74,7 +74,7 @@ elseif(CMAKE_BUILD_TYPE MATCHES IDA OR CMAKE_BUILD_TYPE MATCHES IDA_DEBUG) compile_with_ida(PARENT_DIR, ${DIR_SUNDIALS}) -elseif(CMAKE_BUILD_TYPE MATCHES Kinsol OR CMAKE_BUILD_TYPE MATCHES Kinsol_Debug) +elseif(CMAKE_BUILD_TYPE STREQUAL Kinsol OR CMAKE_BUILD_TYPE STREQUAL Kinsol_Debug OR CMAKE_BUILD_TYPE STREQUAL Kinsol_Cluster) message("\nBuilding Kinsol\n") compile_with_kinsol(PARENT_DIR, ${DIR_SUNDIALS}) diff --git a/build/cmake/kinsol.cmake b/build/cmake/kinsol.cmake index b3a0e35..647c7f7 100644 --- a/build/cmake/kinsol.cmake +++ b/build/cmake/kinsol.cmake @@ -8,44 +8,30 @@ function(compile_with_kinsol PARENT_DIR, DIR_SUNDIALS) message("DIR_SUNDIALS: ${DIR_SUNDIALS}") # Building Summa with sundials on local machine - link_directories(${DIR_SUNDIALS}/lib) - set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib:/usr/local/lib") - set(SUMMA_INCLUDES - "/usr/include" - "${DIR_SUNDIALS}/include" - "${DIR_SUNDIALS}/fortran" - ${netCDF_INCLUDES} - ${LAPACK_INCLUDES}) - # link_directories(${DIR_SUNDIALS}/lib64) - # set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib64") - # set(SUMMA_INCLUDES - # "$ENV{EBROOTNETCDFMINFORTRAN}/include" - # "${DIR_SUNDIALS}/include" - # "${DIR_SUNDIALS}/fortran" - # ${netCDF_INCLUDES} - # ${LAPACK_INCLUDES}) - - set(SUMMA_LIBS - -lsundials_fkinsol_mod - -lsundials_fnvecserial_mod - -lsundials_fsunmatrixdense_mod - -lsundials_fsunlinsoldense_mod - -lsundials_fsunnonlinsolnewton_mod - -lnetcdff - -lopenblas - SUMMA_NOAHMP) - # set(SUMMA_LIBS - # -lsundials_fkinsol_mod - # -lsundials_fnvecserial_mod - # -lsundials_fsunmatrixdense_mod - # -lsundials_fsunlinsoldense_mod - # -lsundials_fsunnonlinsolnewton_mod - # -lnetcdff - # ${netCDF_LIBRARIES} - # ${LAPACK_LIBRARIES} - # SUMMA_NOAHMP) + if (CMAKE_BUILD_TYPE STREQUAL Kinsol_Cluster) + link_directories(${DIR_SUNDIALS}/lib64) + set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib64") + set(SUMMA_INCLUDES + "$ENV{EBROOTNETCDFMINFORTRAN}/include" + "${DIR_SUNDIALS}/include" + "${DIR_SUNDIALS}/fortran" + ${netCDF_INCLUDES} + ${LAPACK_INCLUDES}) + + + set(SUMMA_LIBS + -lsundials_fkinsol_mod + -lsundials_fnvecserial_mod + -lsundials_fsunmatrixdense_mod + -lsundials_fsunlinsoldense_mod + -lsundials_fsunnonlinsolnewton_mod + -lnetcdff + ${netCDF_LIBRARIES} + ${LAPACK_LIBRARIES} + SUMMA_NOAHMP) - set(SUMMA_ACTORS_INCLUDES + + set(SUMMA_ACTORS_INCLUDES ${CAF_INCLUDES} "$ENV{EBROOTNETCDFMINFORTRAN}/include" ${LAPACK_INCLUDES} @@ -56,42 +42,68 @@ function(compile_with_kinsol PARENT_DIR, DIR_SUNDIALS) "${PARENT_DIR}/build/includes/job_actor" "${PARENT_DIR}/build/includes/file_access_actor" "${PARENT_DIR}/build/includes/hru_actor") - # set(SUMMA_ACTORS_INCLUDES - # ${CAF_INCLUDES} - # "$ENV{EBROOTNETCDFMINFORTRAN}/include" - # ${LAPACK_INCLUDES} - # "${DIR_SUNDIALS}/include" - # "${PARENT_DIR}/build/includes/global" - # "${PARENT_DIR}/build/includes/summa_actor" - # "${PARENT_DIR}/build/includes/gru_actor" - # "${PARENT_DIR}/build/includes/job_actor" - # "${PARENT_DIR}/build/includes/file_access_actor" - # "${PARENT_DIR}/build/includes/hru_actor") - set(SUMMA_ACTORS_LIBS - -lopenblas - -lcaf_core - -lcaf_io - summa - -lnetcdff - -lsundials_fkinsol_mod - -lsundials_fnvecserial_mod - -lsundials_fsunmatrixdense_mod - -lsundials_fsunlinsoldense_mod - -lsundials_fsunnonlinsolnewton_mod) - # set(SUMMA_ACTORS_LIBS - # ${CAF_LIBRARIES} - # ${netCDF_LIBRARIES} - # ${LAPACK_LIBRARIES} - # -lcaf_core - # -lcaf_io - # summa - # -lnetcdff - # -lsundials_fkinsol_mod - # -lsundials_fnvecserial_mod - # -lsundials_fsunmatrixdense_mod - # -lsundials_fsunlinsoldense_mod - # -lsundials_fsunnonlinsolnewton_mod) + + set(SUMMA_ACTORS_LIBS + ${CAF_LIBRARIES} + ${netCDF_LIBRARIES} + ${LAPACK_LIBRARIES} + -lcaf_core + -lcaf_io + summa + -lnetcdff + -lsundials_fkinsol_mod + -lsundials_fnvecserial_mod + -lsundials_fsunmatrixdense_mod + -lsundials_fsunlinsoldense_mod + -lsundials_fsunnonlinsolnewton_mod) + + else() + link_directories(${DIR_SUNDIALS}/lib) + set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib:/usr/local/lib") + set(SUMMA_INCLUDES + "/usr/include" + "${DIR_SUNDIALS}/include" + "${DIR_SUNDIALS}/fortran" + ${netCDF_INCLUDES} + ${LAPACK_INCLUDES}) + + set(SUMMA_LIBS + -lsundials_fkinsol_mod + -lsundials_fnvecserial_mod + -lsundials_fsunmatrixdense_mod + -lsundials_fsunlinsoldense_mod + -lsundials_fsunnonlinsolnewton_mod + -lnetcdff + -lopenblas + SUMMA_NOAHMP) + + set(SUMMA_ACTORS_INCLUDES + ${CAF_INCLUDES} + "$ENV{EBROOTNETCDFMINFORTRAN}/include" + ${LAPACK_INCLUDES} + "${DIR_SUNDIALS}/include" + "${PARENT_DIR}/build/includes/global" + "${PARENT_DIR}/build/includes/summa_actor" + "${PARENT_DIR}/build/includes/gru_actor" + "${PARENT_DIR}/build/includes/job_actor" + "${PARENT_DIR}/build/includes/file_access_actor" + "${PARENT_DIR}/build/includes/hru_actor") + + set(SUMMA_ACTORS_LIBS + -lopenblas + -lcaf_core + -lcaf_io + summa + -lnetcdff + -lsundials_fkinsol_mod + -lsundials_fnvecserial_mod + -lsundials_fsunmatrixdense_mod + -lsundials_fsunlinsoldense_mod + -lsundials_fsunnonlinsolnewton_mod) + endif() + + set(ACTORS_DIR ${PARENT_DIR}/build/source/actors) -- GitLab