-
Notifications
You must be signed in to change notification settings - Fork 1
/
00_PRE_GENERIC.conf
122 lines (111 loc) · 4.18 KB
/
00_PRE_GENERIC.conf
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#! /bin/bash
shopt -s expand_aliases
# This file define the default comportment
# If you want to do the install code_saturne manually
# the only step important here is STEP3
STEP0(){
MACHINE=${MACHINE:=LOCAL}
PREFIX=${PREFIX:=$PWD}
}
#===================================== libs and compilator collection
STEP1(){
COMP="GCC"
OPENMP="NO"
DOWN="YES"
}
#============================================================== Setup
#======================================================== Environment
# Make directories if non-existant
STEP2(){
if [ ! -d "$PREFIX/pkg" ] ; then mkdir -p "$PREFIX/pkg" ; fi
if [ ! -d "$PREFIX/src" ] ; then mkdir -p "$PREFIX/src" ; fi
if [ ! -d "$PREFIX/lib" ] ; then mkdir -p "$PREFIX/lib" ; fi
if [ ! -d "$PREFIX/code_saturne" ] ; then mkdir -p "$PREFIX/code_saturne" ; fi
}
#======================================================== Compilators
#============================================================ Options
# prefer to use ICC if available
# prefer to use system lib if available
# To do the process manually just:
# export CC="mpicc" ; export FC="mpif90" ; export F77="mpif77" ; export CXX="mpicxx"
# for gcc
# export CFLAGS="-O3 -march=native -funroll-loops -Wno-unused-variable -fopenmp"
# export FCFLAGS="-O3 -march=native -funroll-loops -Wno-unused-variable -fopenmp"
# export CXXFLAGS="-O3 -march=native -funroll-loops -Wno-unused-variable -fopenmp"
# export LDFLAGS=""
# for icc
# export CFLAGS="-O3 -xhost -axavx -fp-model strict -w -vec_report0 -opt-prefetch -fomit-frame-pointer -openmp -parallel"
# export FCFLAGS="-O3 -xhost -axavx -fp-model strict -w -vec_report0 -opt-prefetch -fomit-frame-pointer -openmp -parallel"
# export CXXFLAGS="-O3 -xhost -axavx -fp-model strict -w -vec_report0 -opt-prefetch -fomit-frame-pointer -openmp -parallel"
# export LDFLAGS=""
STEP3(){
#SEQUENTIAL
if [ "$COMP" = "GCC" ]; then
#Sequential C compilator
S_CC="gcc"
#Sequential FORTRAN compilator
S_FC="gfortran"
#Sequential FORTRAN 77 compilator
S_F77="gfortran"
#Sequential C++ compilator
S_CXX="g++"
elif [ "$COMP" = "ICC" ]; then
#Sequential C compilator
S_CC="icc"
#Sequential FORTRAN compilator
S_FC="ifort"
#Sequential FORTRAN 77 compilator
S_F77="ifort"
#Sequential C++ compilator
S_CXX="icpc"
fi
#PARALLEL
if [ "$OPENMPI" = "SYS" ]; then
#Parallel C compilator
P_CC="mpicc"
#Parallel FORTRAN compilator
P_FC="mpif90"
#Parallel FORTRAN 77 compilator
P_F77="mpif77"
#Parallel C++ compilator
P_CXX="mpicxx"
else
#Parallel C compilator
P_CC="$BIN_OPENMPI/bin/mpicc"
#Parallel FORTRAN compilator
P_FC="$BIN_OPENMPI/bin/mpif90"
#Parallel FORTRAN 77 compilator
P_F77="$BIN_OPENMPI/bin/mpif77"
#Parallel C++ compilator
P_CXX="$BIN_OPENMPI/bin/mpicxx"
fi
# FLAGS
if [ "$COMP" = "GCC" ]; then
FLAGS_WARNING="-Wno-unused-variable"
FLAGS_OPTIM="-O3 -march=native -funroll-loops -fPIC" # -ffast-math not working
FLAGS_DEBUG="-O0 -g -Warray-bounds -fbounds-check"
FLAGS_OPENMP="-fopenmp"
FLAGS_C=""
# FLAGS_FORTRAN="-Wno-unused-dummy-argument -fstack-arrays"
elif [ "$COMP" = "ICC" ]; then
FLAGS_WARNING=""
FLAGS_OPTIM="-O3 -xhost -axavx -fp-model strict -w -vec_report0 -opt-prefetch -fomit-frame-pointeri -fPIC"
FLAGS_DEBUG="-O0 -g"
FLAGS_OPENMP="-openmp -parallel"
FLAGS_C=""
# FLAGS_FORTRAN="-heap-arrays"
fi
export LDFLAGS="-lz"
}
#======================================================== Debriefing
STEP9(){
echo
echo "add this to your bashrc"
[[ -n "$MODULES_LIST" ]] && echo && echo "$MODULES_LIST" | sed 's:\ :\n:g' | sed 's/.*/module load &/'
echo "export PATH=\"$BIN_SATURNE/bin:\$PATH\""
echo "$PATH" | sed 's#:#\n#g' | sed 's/.*/export PATH="&:$PATH"/'| grep --color=never "$PREFIX"
echo "$LD_LIBRARY_PATH" | sed 's#:#\n#g' | sed 's/.*/export LD_LIBRARY_PATH="&:$LD_LIBRARY_PATH"/'| grep --color=never "$PREFIX"
[[ "$OPENMP" == "YES" ]] && echo "export OMP_NUM_THREADS=1"
echo
}
STEP$1 2>/dev/null