Cray-PrgEnv-cross-compile.sh 2.27 KB
Newer Older
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
#!/bin/bash

if [ $# -ne 4 ]
then
  echo "Usage: $0 gnu|intel /path/to/cmake download_dir install_dir"
  exit 1
fi

COMP=$1
CMAKE=$2
DOWN=$3
INST=$4
SRC=$(readlink -f $(dirname $BASH_SOURCE)/../..)


# Old cray environments use the ASYNCPE_VERSION env var and need slightly
# different modules
#
# Note: substitute craype-mc8 or craype-haswell with whatever CPU module
# your compute nodes need
if [ "x${ASYNCPE_VERSION}x" != "xx" ]
then
  echo "Loading modules for (older) Cray Programming Environment"
  CPU=${CRAY_CPU_TARGET}
elif [ "x${CRAYPE_VERSION}x" != "xx" ]
then
  echo "Loading modules for (newer) Cray Programming Environment"
  CPU=${CRAY_CPU_TARGET}
  EXTRA_MODULES=craype
else
  echo "Error: can't identify the right Cray OS version to load modules for"
  exit 2
fi

. /opt/modules/default/init/bash
36

37
module purge 1>/dev/null 2>/dev/null
38
module load modules gcc
39

40
41
42
export CC=$(which gcc)
export CXX=$(which g++)
export FC=$(which gfortran)
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

mkdir tools
cd tools
${CMAKE} \
  -DCROSS_BUILD_STAGE:STRING=TOOLS -Dcross_target:STRING=cray_prgenv \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DBUILD_TESTING:BOOL=FALSE \
  -DParaView_FROM_GIT:BOOL=OFF \
  -DENABLE_paraview:BOOL=TRUE \
  -DENABLE_boost:BOOL=TRUE \
  -DENABLE_python:BOOL=TRUE \
  -DENABLE_zlib:BOOL=TRUE \
  -DUSE_SYSTEM_zlib:BOOL=TRUE \
  -DENABLE_png:BOOL=TRUE \
  -DUSE_SYSTEM_png:BOOL=TRUE \
  -DENABLE_bzip2:BOOL=TRUE \
  -DUSE_SYSTEM_bzip2:BOOL=TRUE \
  -Ddownload_location:PATH=${DOWN} \
61
  -DPV_MAKE_NCPUS=12 \
62
63
64
  ${SRC}
make

65
66
67
68
69
70
71
72
73
74
75
module purge 1>/dev/null 2>/dev/null
module load modules ${EXTRA_MODULES} PrgEnv-${COMP} craype-${CPU} cray-mpich cray-hdf5
if [ "${COMP}" = "intel" ]
then
  # We still need the gcc module with the Intel compiler so we can get C++11 headers
  module load gcc

  # Use a newer Intel compiler
  module swap intel intel/15.0.5.223
fi

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
unset CC
unset CXX
unset FC
cd ..
mkdir cross
cd cross
${CMAKE} \
  -DCMAKE_INSTALL_PREFIX=${INST} \
  -DCROSS_BUILD_STAGE:STRING=CROSS -Dcross_target:STRING=cray_prgenv \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DBUILD_TESTING:BOOL=OFF \
  -DParaView_FROM_GIT:BOOL=OFF \
  -DENABLE_paraview:BOOL=TRUE \
  -DENABLE_paraviewsdk:BOOL=TRUE \
  -DENABLE_python:BOOL=TRUE \
  -DENABLE_mesa:BOOL=TRUE \
  -Ddownload_location:PATH=${DOWN} \
  -DPV_MAKE_NCPUS=12 \
  ${SRC}
make
make install