Skip to content

Commit 26de949

Browse files
authored
Cleanup Serialbox CMake config + add arolla env (#217)
- Removes some boost settings which are hopefully outdated (as we are not using any compiled boost libraries by default). - Adds arolla to the testing
1 parent 83bc38e commit 26de949

File tree

4 files changed

+126
-33
lines changed

4 files changed

+126
-33
lines changed

Diff for: cmake/SerialboxConfig.cmake.in

+17-29
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
##
33
## S E R I A L B O X
44
##
5-
## This file is distributed under terms of BSD license.
5+
## This file is distributed under terms of BSD license.
66
## See LICENSE.txt for more information.
77
##
88
##===------------------------------------------------------------------------------------------===##
@@ -71,7 +71,7 @@ function( serialbox_alias_targets )
7171
# serialbox_alias_targets( alias target_shared target_static align )
7272
#
7373
# Creates ALIAS target for given targets. Prefer target_shared if availabe
74-
#
74+
#
7575
set( _alias ${ARGV0} )
7676
set( _target_shared ${ARGV1} )
7777
set( _target_static ${ARGV2} )
@@ -107,7 +107,7 @@ endfunction()
107107
# Find Serialbox libraries
108108
#====--------------------------------------------------------------------------------------------===
109109

110-
# Import library targets
110+
# Import library targets
111111
if( NOT @PROJECT_NAME@_TARGETS_EXPORTED )
112112
include("${CMAKE_CURRENT_LIST_DIR}/SerialboxTargets.cmake")
113113
set( ${PROJECT_NAME}_TARGETS_EXPORTED TRUE )
@@ -151,57 +151,46 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS))
151151
#
152152
# Pthreads
153153
#
154-
message( STATUS "Serialbox: find_depencency( Threads )" )
154+
message( STATUS "Serialbox: find_dependency(Threads)" )
155155
find_dependency(Threads)
156156

157-
#
158-
# Boost (Serialbox always uses the shared Boost libraries)
159-
#
160-
get_property(SHARED_LIB_SUPPORT GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
161-
if (SHARED_LIB_SUPPORT)
162-
set(Boost_USE_STATIC_LIBS OFF)
163-
set(Boost_USE_STATIC_RUNTIME OFF)
164-
set(Boost_USE_MULTITHREADED ON)
165-
endif()
166-
167157
set(BOOST_LIBRARYDIR "${SERIALBOX_BOOST_LIBRARY_DIRS}")
168158
set(BOOST_INCLUDEDIR "${SERIALBOX_BOOST_INCLUDE_DIRS}")
169159
set(Boost_NO_SYSTEM_PATHS "ON") # Force boost to search locations specified above
170160

171-
message( STATUS "Serialbox: find_depencency( Boost ${SERIALBOX_BOOST_VERSION} EXACT COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS}}")
172-
find_dependency(Boost
173-
${SERIALBOX_BOOST_VERSION} EXACT COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})
161+
message( STATUS "Serialbox: find_dependency(Boost ${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})")
162+
find_dependency(Boost
163+
${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})
174164
if(Boost_FOUND)
175165
list(APPEND SERIALBOX_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
176166
else()
177-
178167
# Give some diagnostic infos
179168
set(WARN_STR "Serialbox: Boost (${SERIALBOX_BOOST_VERSION}) NOT found!")
180-
169+
181170
if(DEFINED Boost_LIB_VERSION)
182171
string(REPLACE "_" "." FOUND_BOOST_VERSION ${Boost_LIB_VERSION})
183-
list(APPEND WARN_STR " (Found Boost ${FOUND_BOOST_VERSION})")
172+
list(APPEND WARN_STR " (Found Boost ${FOUND_BOOST_VERSION})")
184173
endif()
185-
174+
186175
list(APPEND WARN_STR "\nRequired components:")
187-
176+
188177
foreach(component ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})
189178
list(APPEND WARN_STR "\n - ${component}")
190179
endforeach()
191-
180+
192181
message(WARNING ${WARN_STR} "\n")
193182
endif()
194-
183+
195184
#
196185
# OpenSSL
197186
#
198187
if(SERIALBOX_HAS_OPENSSL)
199188
find_package(OpenSSL QUIET)
200-
if(NOT OpenSSL_FOUND)
189+
if(NOT OpenSSL_FOUND)
201190
message(WARNING "Serialbox depends on the OpenSSL libraries")
202191
endif()
203192
endif()
204-
193+
205194
#
206195
# NetCDF
207196
#
@@ -210,7 +199,7 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS))
210199
if(NETCDF_ROOT_ENV)
211200
set(NETCDF_ROOT ${NETCDF_ROOT_ENV} CACHE PATH "NetCDF install path.")
212201
endif()
213-
202+
214203
if(NOT(DEFINED NETCDF_ROOT))
215204
find_path(NETCDF_ROOT NAMES include/netcdf.h)
216205
else()
@@ -222,7 +211,7 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS))
222211
if(NETCDF_LIBRARIES)
223212
mark_as_advanced(NETCDF_LIBRARIES)
224213
else()
225-
message(WARNING
214+
message(WARNING
226215
"Serialbox depends on the NetCDF-4 libraries. (Try setting NETCDF_ROOT in the env)")
227216
endif()
228217
endif()
@@ -233,4 +222,3 @@ endif()
233222
#====--------------------------------------------------------------------------------------------===
234223
find_file(SERIALBOX_PPSER pp_ser.py @PACKAGE_PYTHON_INSTALL_DIR@/pp_ser)
235224
include(@PACKAGE_CMAKE_INSTALL_DIR@/SerialboxTooling.cmake)
236-

Diff for: cmake/modules/Fortran/Cray.cmake

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
##
33
## S E R I A L B O X
44
##
5-
## This file is distributed under terms of BSD license.
5+
## This file is distributed under terms of BSD license.
66
## See LICENSE.txt for more information.
77
##
88
##===------------------------------------------------------------------------------------------===##
99

1010
# General Flags (add to default)
11-
set(CMAKE_Fortran_FLAGS
12-
"${CMAKE_Fortran_FLAGS} -ffree -N255 -ec -eC -eI -eF -hnosecond_underscore -hflex_mp=conservative -Ofp1 -hadd_paren -ra")
11+
set(CMAKE_Fortran_FLAGS
12+
"${CMAKE_Fortran_FLAGS} -ffree -N255 -ec -eC -eI -eF -hflex_mp=conservative -Ofp1 -hadd_paren -ra")
13+
14+
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0.0)
15+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -hnosecond_underscore ")
16+
endif()
1317

1418
# OpenACC flags
1519
set(OpenACC_FLAGS "-hnoacc")

Diff for: tools/cscs-scripts/build.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ elif [ "$(hostname | grep kesch)" != "" ] ; then
7070
MYHOST="kesch"
7171
elif [ "$(hostname | grep daint)" != "" ] ; then
7272
MYHOST="daint"
73+
elif [ "$(hostname | grep arolla)" != "" ] ; then
74+
MYHOST="arolla"
7375
elif [ "$(hostname | grep tave)" != "" ] ; then
7476
MYHOST="tave"
7577
else
@@ -193,7 +195,7 @@ fi
193195

194196
#NetCDF
195197
SERIALBOX_USE_NETCDF=OFF
196-
if [ "${FC_COMPILER}" = "gfortran" ]; then
198+
if [ "${FC_COMPILER}" = "gfortran" ] && [ "$MYHOST" != "arolla" ]; then
197199
SERIALBOX_USE_NETCDF=ON
198200
fi
199201

Diff for: tools/cscs-scripts/env_arolla.sh

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
##===-----------------------------------------------------------*- bash -*-===##
3+
##
4+
## S E R I A L B O X
5+
##
6+
## This file is distributed under terms of BSD license.
7+
## See LICENSE.txt for more information.
8+
##
9+
##===----------------------------------------------------------------------===##
10+
11+
## Print help statement and exit.
12+
print_help()
13+
{
14+
printf "Usage: $0 [options]\n\n"
15+
printf "Options:\n"
16+
17+
# --fc-compiler
18+
printf " %-35s %s\n" \
19+
"-f, --fc-compiler FORTRAN_COMPILER" \
20+
"Fortran compiler to use (set to "
21+
printf " %-35s %s\n" "" "environment variable FC)."
22+
23+
# --help
24+
printf " %-35s %s\n" "-h, --help" "Print this help statement."
25+
printf "\n"
26+
exit 0
27+
}
28+
29+
## Convert to lower case and remove all whitespaces
30+
to_lower_and_trim()
31+
{
32+
if [ $# -ne 1 ]; then
33+
echo "$0: internal error." ; exit 1
34+
fi
35+
36+
local to_lower=$(echo "$1" | tr '[:upper:]' '[:lower:]')
37+
local trim_whitespaces=${to_lower// /}
38+
echo "${trim_whitespaces}"
39+
}
40+
41+
#------------------------------ Parse options ----------------------------------
42+
ENV_ARGS=$(getopt -o f:h:: -l fc-compiler,help:: -n 'env_kesch' -- "$@");
43+
44+
if [ $? -ne 0 ]; then
45+
exit 1
46+
fi
47+
48+
eval set -- "$ENV_ARGS"
49+
50+
while true; do
51+
case "$1" in
52+
-h|--h*) print_help; exit 0;;
53+
-f|--fc-compiler) ARG_FC_COMPILER=$(to_lower_and_trim $2); shift 2;;
54+
--) shift; break ;;
55+
*) echo "$0: internal error." ; exit 1 ;;
56+
esac
57+
done
58+
59+
# Fortran Compiler
60+
if [ -z ${ARG_FC_COMPILER+x} ]; then
61+
echo "$0: error: fortran compiler is not set"
62+
exit 1
63+
else
64+
FC_COMPILER=${ARG_FC_COMPILER}
65+
fi
66+
67+
#------------------------------ Set environment --------------------------------
68+
69+
module load craype-x86-skylake
70+
module load craype-network-infiniband
71+
module load slurm
72+
module load cmake/3.14.3
73+
74+
if [ "$FC_COMPILER" = "pgfortran" ]; then
75+
module load PrgEnv-pgi/19.4
76+
module load gcc
77+
elif [ "$FC_COMPILER" = "ftn" ]; then
78+
module load PrgEnv-cray
79+
module load gcc
80+
elif [ "$FC_COMPILER" = "ifort" ]; then
81+
echo "not defined"
82+
exit 1
83+
else
84+
module load PrgEnv-gnu
85+
fi
86+
87+
#module load netcdf-c++/4.3.0-gmvolf-18.12
88+
#module load hdf5/1.10.5-gmvolf-18.12
89+
#export NETCDF_ROOT=${EBROOTNETCDF}
90+
91+
export CXX=$(which g++)
92+
export CC=$(which gcc)
93+
export FC=$(which $FC_COMPILER)
94+
95+
export Boost_NO_SYSTEM_PATHS=true
96+
export Boost_NO_BOOST_CMAKE=true
97+
98+
export BOOST_ROOT=/project/c14/install/daint/boost/boost_1_67_0
99+

0 commit comments

Comments
 (0)