File: build.sh

package info (click to toggle)
gridtools 2.3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,480 kB
  • sloc: cpp: 228,792; python: 17,561; javascript: 9,164; ansic: 4,101; sh: 850; makefile: 231; f90: 201
file content (79 lines) | stat: -rw-r--r-- 2,457 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
# Abort on error
set -e

HOST=$(hostname)
test -n "${CSCS_ACCOUNT}" || CSCS_ACCOUNT=d75

if [[ "$HOST" == kesch* || "$HOST" == escha* ]]; then
    module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5
    module load PE/17.06
    module load craype-haswell
    module load craype-network-infiniband
    module load PrgEnv-gnu/17.02
    module load cudatoolkit/8.0.61
    export BOOST_ROOT=/project/c14/install/kesch/boost/boost_1_67_0
    export CUDATOOLKIT_HOME=$CUDA_PATH
    export CUDA_ARCH=sm_37
    export FC=`which gfortran`
    RUN_PREFIX="srun -p pp-short -c 12 --time=00:30:00"

elif [[ "$HOST" == tave* ]]; then
    module switch PrgEnv-cray PrgEnv-gnu
    module rm CMake
    module load /users/jenkins/easybuild/tave/modules/all/CMake/3.14.5
    export BOOST_ROOT=/project/c14/install/kesch/boost/boost_1_67_0
    RUN_PREFIX=""

elif [[ "$HOST" == daint* ]]; then
    module load daint-gpu
    module load cudatoolkit/9.2.148_3.19-6.0.7.1_2.1__g3d9acc8
    module switch PrgEnv-cray PrgEnv-gnu
    module rm CMake
    module load /users/jenkins/easybuild/daint/haswell/modules/all/CMake/3.14.5
    export BOOST_ROOT=/project/c14/install/daint/boost/boost_1_67_0
    export CUDA_ARCH=sm_60
    RUN_PREFIX="srun -C gpu -p cscsci --account=$CSCS_ACCOUNT --time=00:30:00"

else
    echo "Unknown host ${HOST}, using current environment."
fi

cwd=$(pwd)

# install cpp_bindgen
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${cwd}/install -DCPP_BINDGEN_REQUIRE_TEST_C=ON -DCPP_BINDGEN_REQUIRE_TEST_Fortran=ON
nice make -j8 install
$RUN_PREFIX ctest .

# compile example using the config from build tree (test for export(package))
cd ${cwd}/example/simple
mkdir -p build && cd build
cmake .. -Dcpp_bindgen_DIR=${cwd}/build
nice make -j8
./driver

# compile examples using the installation
# simple example using installation
cd ${cwd}/example/simple
mkdir -p build && cd build
cmake .. -Dcpp_bindgen_DIR=${cwd}/install/lib/cmake
nice make -j8
./driver

# simple example using FetchContent
cd ${cwd}/example/simple_fetch_content
mkdir -p build && cd build
cmake ..
nice make -j8
./driver

# test gt legacy mode (don't run it on kesch because CUDA 8 is not supported in legacy mode)
if [[ "$HOST" != kesch* ]]; then
    cd ${cwd}
    mkdir -p build_legacy && cd build_legacy
    cmake .. -DCMAKE_INSTALL_PREFIX=${cwd}/install -DCPP_BINDGEN_GT_LEGACY=ON
    nice make -j8 install
    $RUN_PREFIX ctest .
fi