diff --git a/cmake/SerialboxConfig.cmake.in b/cmake/SerialboxConfig.cmake.in index 010127b3..55844db9 100644 --- a/cmake/SerialboxConfig.cmake.in +++ b/cmake/SerialboxConfig.cmake.in @@ -2,7 +2,7 @@ ## ## S E R I A L B O X ## -## This file is distributed under terms of BSD license. +## This file is distributed under terms of BSD license. ## See LICENSE.txt for more information. ## ##===------------------------------------------------------------------------------------------===## @@ -71,7 +71,7 @@ function( serialbox_alias_targets ) # serialbox_alias_targets( alias target_shared target_static align ) # # Creates ALIAS target for given targets. Prefer target_shared if availabe - # + # set( _alias ${ARGV0} ) set( _target_shared ${ARGV1} ) set( _target_static ${ARGV2} ) @@ -107,7 +107,7 @@ endfunction() # Find Serialbox libraries #====--------------------------------------------------------------------------------------------=== -# Import library targets +# Import library targets if( NOT @PROJECT_NAME@_TARGETS_EXPORTED ) include("${CMAKE_CURRENT_LIST_DIR}/SerialboxTargets.cmake") set( ${PROJECT_NAME}_TARGETS_EXPORTED TRUE ) @@ -151,57 +151,46 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS)) # # Pthreads # - message( STATUS "Serialbox: find_depencency( Threads )" ) + message( STATUS "Serialbox: find_dependency(Threads)" ) find_dependency(Threads) - # - # Boost (Serialbox always uses the shared Boost libraries) - # - get_property(SHARED_LIB_SUPPORT GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) - if (SHARED_LIB_SUPPORT) - set(Boost_USE_STATIC_LIBS OFF) - set(Boost_USE_STATIC_RUNTIME OFF) - set(Boost_USE_MULTITHREADED ON) - endif() - set(BOOST_LIBRARYDIR "${SERIALBOX_BOOST_LIBRARY_DIRS}") set(BOOST_INCLUDEDIR "${SERIALBOX_BOOST_INCLUDE_DIRS}") set(Boost_NO_SYSTEM_PATHS "ON") # Force boost to search locations specified above - message( STATUS "Serialbox: find_depencency( Boost ${SERIALBOX_BOOST_VERSION} EXACT COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS}}") - find_dependency(Boost - ${SERIALBOX_BOOST_VERSION} EXACT COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS}) + message( STATUS "Serialbox: find_dependency(Boost ${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})") + find_dependency(Boost + ${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS}) if(Boost_FOUND) list(APPEND SERIALBOX_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) else() - # Give some diagnostic infos set(WARN_STR "Serialbox: Boost (${SERIALBOX_BOOST_VERSION}) NOT found!") - + if(DEFINED Boost_LIB_VERSION) string(REPLACE "_" "." FOUND_BOOST_VERSION ${Boost_LIB_VERSION}) - list(APPEND WARN_STR " (Found Boost ${FOUND_BOOST_VERSION})") + list(APPEND WARN_STR " (Found Boost ${FOUND_BOOST_VERSION})") endif() - + list(APPEND WARN_STR "\nRequired components:") - + foreach(component ${SERIALBOX_REQUIRED_BOOST_COMPONENTS}) list(APPEND WARN_STR "\n - ${component}") endforeach() - + message(WARNING ${WARN_STR} "\n") endif() - + # # OpenSSL # if(SERIALBOX_HAS_OPENSSL) find_package(OpenSSL QUIET) - if(NOT OpenSSL_FOUND) + if(NOT OpenSSL_FOUND) message(WARNING "Serialbox depends on the OpenSSL libraries") endif() endif() - + # # NetCDF # @@ -210,7 +199,7 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS)) if(NETCDF_ROOT_ENV) set(NETCDF_ROOT ${NETCDF_ROOT_ENV} CACHE PATH "NetCDF install path.") endif() - + if(NOT(DEFINED NETCDF_ROOT)) find_path(NETCDF_ROOT NAMES include/netcdf.h) else() @@ -222,7 +211,7 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS)) if(NETCDF_LIBRARIES) mark_as_advanced(NETCDF_LIBRARIES) else() - message(WARNING + message(WARNING "Serialbox depends on the NetCDF-4 libraries. (Try setting NETCDF_ROOT in the env)") endif() endif() @@ -233,4 +222,3 @@ endif() #====--------------------------------------------------------------------------------------------=== find_file(SERIALBOX_PPSER pp_ser.py @PACKAGE_PYTHON_INSTALL_DIR@/pp_ser) include(@PACKAGE_CMAKE_INSTALL_DIR@/SerialboxTooling.cmake) - diff --git a/cmake/modules/Fortran/Cray.cmake b/cmake/modules/Fortran/Cray.cmake index a8772c00..430ac3e3 100644 --- a/cmake/modules/Fortran/Cray.cmake +++ b/cmake/modules/Fortran/Cray.cmake @@ -2,14 +2,18 @@ ## ## S E R I A L B O X ## -## This file is distributed under terms of BSD license. +## This file is distributed under terms of BSD license. ## See LICENSE.txt for more information. ## ##===------------------------------------------------------------------------------------------===## # General Flags (add to default) -set(CMAKE_Fortran_FLAGS - "${CMAKE_Fortran_FLAGS} -ffree -N255 -ec -eC -eI -eF -hnosecond_underscore -hflex_mp=conservative -Ofp1 -hadd_paren -ra") +set(CMAKE_Fortran_FLAGS + "${CMAKE_Fortran_FLAGS} -ffree -N255 -ec -eC -eI -eF -hflex_mp=conservative -Ofp1 -hadd_paren -ra") + +if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0.0) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -hnosecond_underscore ") +endif() # OpenACC flags set(OpenACC_FLAGS "-hnoacc") diff --git a/tools/cscs-scripts/build.sh b/tools/cscs-scripts/build.sh index da1cc774..dadc8642 100755 --- a/tools/cscs-scripts/build.sh +++ b/tools/cscs-scripts/build.sh @@ -70,6 +70,8 @@ elif [ "$(hostname | grep kesch)" != "" ] ; then MYHOST="kesch" elif [ "$(hostname | grep daint)" != "" ] ; then MYHOST="daint" +elif [ "$(hostname | grep arolla)" != "" ] ; then + MYHOST="arolla" elif [ "$(hostname | grep tave)" != "" ] ; then MYHOST="tave" else @@ -193,7 +195,7 @@ fi #NetCDF SERIALBOX_USE_NETCDF=OFF -if [ "${FC_COMPILER}" = "gfortran" ]; then +if [ "${FC_COMPILER}" = "gfortran" ] && [ "$MYHOST" != "arolla" ]; then SERIALBOX_USE_NETCDF=ON fi diff --git a/tools/cscs-scripts/env_arolla.sh b/tools/cscs-scripts/env_arolla.sh new file mode 100755 index 00000000..e670832c --- /dev/null +++ b/tools/cscs-scripts/env_arolla.sh @@ -0,0 +1,99 @@ +#!/bin/bash +##===-----------------------------------------------------------*- bash -*-===## +## +## S E R I A L B O X +## +## This file is distributed under terms of BSD license. +## See LICENSE.txt for more information. +## +##===----------------------------------------------------------------------===## + +## Print help statement and exit. +print_help() +{ + printf "Usage: $0 [options]\n\n" + printf "Options:\n" + + # --fc-compiler + printf " %-35s %s\n" \ + "-f, --fc-compiler FORTRAN_COMPILER" \ + "Fortran compiler to use (set to " + printf " %-35s %s\n" "" "environment variable FC)." + + # --help + printf " %-35s %s\n" "-h, --help" "Print this help statement." + printf "\n" + exit 0 +} + +## Convert to lower case and remove all whitespaces +to_lower_and_trim() +{ + if [ $# -ne 1 ]; then + echo "$0: internal error." ; exit 1 + fi + + local to_lower=$(echo "$1" | tr '[:upper:]' '[:lower:]') + local trim_whitespaces=${to_lower// /} + echo "${trim_whitespaces}" +} + +#------------------------------ Parse options ---------------------------------- +ENV_ARGS=$(getopt -o f:h:: -l fc-compiler,help:: -n 'env_kesch' -- "$@"); + +if [ $? -ne 0 ]; then + exit 1 +fi + +eval set -- "$ENV_ARGS" + +while true; do + case "$1" in + -h|--h*) print_help; exit 0;; + -f|--fc-compiler) ARG_FC_COMPILER=$(to_lower_and_trim $2); shift 2;; + --) shift; break ;; + *) echo "$0: internal error." ; exit 1 ;; + esac +done + +# Fortran Compiler +if [ -z ${ARG_FC_COMPILER+x} ]; then + echo "$0: error: fortran compiler is not set" + exit 1 +else + FC_COMPILER=${ARG_FC_COMPILER} +fi + +#------------------------------ Set environment -------------------------------- + +module load craype-x86-skylake +module load craype-network-infiniband +module load slurm +module load cmake/3.14.3 + +if [ "$FC_COMPILER" = "pgfortran" ]; then + module load PrgEnv-pgi/19.4 + module load gcc +elif [ "$FC_COMPILER" = "ftn" ]; then + module load PrgEnv-cray + module load gcc +elif [ "$FC_COMPILER" = "ifort" ]; then + echo "not defined" + exit 1 +else + module load PrgEnv-gnu +fi + +#module load netcdf-c++/4.3.0-gmvolf-18.12 +#module load hdf5/1.10.5-gmvolf-18.12 +#export NETCDF_ROOT=${EBROOTNETCDF} + +export CXX=$(which g++) +export CC=$(which gcc) +export FC=$(which $FC_COMPILER) + +export Boost_NO_SYSTEM_PATHS=true +export Boost_NO_BOOST_CMAKE=true + +export BOOST_ROOT=/project/c14/install/daint/boost/boost_1_67_0 +