-
Notifications
You must be signed in to change notification settings - Fork 3
/
cmake-flags
75 lines (60 loc) · 2.05 KB
/
cmake-flags
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
# Default flags to build optimized version
# assuming kmernator source is in ..
# i.e.
# tar -xvf Kmernator-1.0.tar
# cd Kmernator-1.0
# mkdir build
# cd build
#
Kmernator=..
# for normal build
cmake $Kmernator
# for build without MPI (if mpic++ exists and you do not want it for some reason)
cmake $Kmernator -DDISABLE_MPI
# for debug debug
cmake $Kmernator -DCMAKE_BUILD_TYPE=Debug
# for debug build without OpenMP
cmake $Kmernator -DDISABLE_OPENMP=1 -DCMAKE_BUILD_TYPE=Debug
# for build with non-standard g++, say if gcc-4.6.2 and both g++-4.6.2 exist in the PATH
ver=4.6.2
libdir=$(dirname $(g++-${ver} --print-file-name=libstdc++.so))
export CFLAGS="-Wl,-rpath,${libdir}"
export CXXFLAGS="$CFLAGS"
cmake $Kmernator -DCMAKE_CXX_COMPILER=`which g++-${ver}` -DCMAKE_C_COMPILER=`which gcc-${ver}`
# for NERSC hopper, using the suggested GNU compiler wrappers (cc and CC)
# and tricking CMake and Boost to recognize the native MPI compiler:
# For GNU on hopper
module load bzip2
module swap PrgEnv-pgi PrgEnv-gnu
module load cmake
module remove xt-shmem
module remove iobuf
mpilib=$(basename $MPICH_DIR/lib/libmpich_gnu*.a); mpilib=${mpilib%.a} ; mpilib2=${mpilib#lib}
export CFLAGS="-funroll-loops -Wall"
export CXXFLAGS="$CFLAGS"
# for Intel on hopper
unset CFLAGS
unset CXXFLAGS
module load bzip2
module swap PrgEnv-pgi PrgEnv-intel
module load cmake
module remove xt-shmem
module remove iobuf
mpilib=$(basename $MPICH_DIR/lib/libmpich_intel*.a); mpilib=${mpilib%.a} ; mpilib2=${mpilib#lib}
# run cmake && compile
cmake $Kmernator -DCMAKE_C_COMPILER=`which cc` -DCMAKE_CXX_COMPILER=`which CC` \
-DMPI_COMPILER=`which CC` -DMPI_LIBRARY="$mpilib2" \
-DMPI_INCLUDE_PATH="${MPICH_DIR}/include" \
-DBOOST_MPI_USER_CONFIG="using mpi : : <find-static-library>$mpilib ;" \
-DMPI_EXTRA_LIBRARY="" \
&& make -j18
# for NERSC carver
module unload pgi
module unload openmpi
module load gcc
module load openmpi-gnu
cmake $Kmernator -DCMAKE_C_COMPILER=`which gcc` -DCMAKE_CXX_COMPILER=`which g++`
# for profile
export CFLAGS="-g -pg"
export CXXFLAGS="$CFLAGS"
cmake $Kmernator