-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup
executable file
·129 lines (122 loc) · 3.19 KB
/
setup
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
122
123
124
125
126
127
128
#! /bin/sh
# Setup script for the Elk Code
# generic values
MAKE="make"
F90="f90"
F90_OPTS="-O3"
F77=$F90
F77_OPTS=$F90_OPTS
AR="ar"
LIB_SYS=""
LIB_LPK="lapack.a blas.a"
LIB_FFT="fftlib.a"
SRC_OMP=""
# get system type from user
GETSYS ()
{
clear
echo "Choose compiler:"
echo
echo " 1. Intel Fortran (ifort) with OpenMP"
echo " 2. GNU Fortran (gfortran) with OpenMP"
echo " 3. Portland Group Fortran (pgf90) with OpenMP"
echo " 4. G95 (g95)"
echo " 5. NAG Fortran (nagfor)"
echo " 6. IBM Fortran (xlf90_r) with OpenMP"
echo
echo " 20. Intel Fortran profiling (debug only)"
echo " 21. GNU Fortran code check (debug only)"
echo " 22. G95 code check (debug only)"
echo
echo " o. Other x. Exit"
echo
read SYS
if [ "$SYS" = x ] ; then
exit 0
elif [ "$SYS" = o ] ; then
echo "Enter Fortran 90 compiler command:"
read F90
echo "Enter Fortran 90 compiler options:"
read F90_OPTS
echo "Enter Fortran 77 compiler command:"
read F77
echo "Enter Fortran 77 compiler options:"
read F77_OPTS
elif [ "$SYS" = 1 ] ; then
F90="ifort"
F90_OPTS="-O3 -ip -unroll -no-prec-div -qopenmp"
F77=$F90
F77_OPTS="$F90_OPTS -assume protect_parens"
elif [ "$SYS" = 2 ] ; then
F90="gfortran"
F90_OPTS="-O3 -ffast-math -funroll-loops -fopenmp"
F77=$F90
F77_OPTS=$F90_OPTS
elif [ "$SYS" = 3 ] ; then
F90="pgf90"
F90_OPTS="-O3 -mp -lpthread"
F77=$F90
F77_OPTS=$F90_OPTS
elif [ "$SYS" = 4 ] ; then
F90="g95"
F90_OPTS="-O3 -fno-second-underscore"
F77=$F90
F77_OPTS=$F90_OPTS
SRC_OMP="omp_stub.f90"
elif [ "$SYS" = 5 ] ; then
F90="nagfor"
F90_OPTS="-O4 −openmp -kind=byte -dusty -dcfuns"
F77=$F90
F77_OPTS=$F90_OPTS
elif [ "$SYS" = 6 ] ; then
F90="xlf90_r"
F90_OPTS="-O3 -qsmp=omp"
F77=$F90
F77_OPTS=$F90_OPTS
elif [ "$SYS" = 20 ] ; then
F90="ifort"
F90_OPTS="-O3 -ip -unroll -no-prec-div -g -p"
F77=$F90
F77_OPTS="$F90_OPTS -assume protect_parens"
SRC_OMP="omp_stub.f90"
elif [ "$SYS" = 21 ] ; then
F90="gfortran"
F90_OPTS="-O3 -fcheck=all -finit-real=snan -Wextra -Wall"
F77=$F90
F77_OPTS=$F90_OPTS
SRC_OMP="omp_stub.f90"
elif [ "$SYS" = 22 ] ; then
F90="g95"
F90_OPTS="-O3 -Wall -std=f95 -pedantic -fbounds-check -fno-second-underscore -ftrace=full"
F77=$F90
F77_OPTS="-O3 -fno-second-underscore"
SRC_OMP="omp_stub.f90"
else
GETSYS
fi
}
GETSYS
# produce the make.inc file
echo > make.inc
echo "MAKE = $MAKE" >> make.inc
echo "F90 = $F90" >> make.inc
echo "F90_OPTS = $F90_OPTS" >> make.inc
echo "F77 = $F77" >> make.inc
echo "F77_OPTS = $F77_OPTS" >> make.inc
echo "AR = $AR" >> make.inc
echo "LIB_SYS = $LIB_SYS" >> make.inc
echo "# LAPACK and BLAS libraries" >> make.inc
echo "LIB_LPK = $LIB_LPK" >> make.inc
echo "LIB_FFT = $LIB_FFT" >> make.inc
echo "SRC_OMP = $SRC_OMP" >> make.inc
cat make.def >> make.inc
echo
echo "You can now edit the compiler options in 'make.inc' to use optimised"
echo "BLAS/LAPACK/FFT libraries, MPI parallelisation and Libxc."
echo "See the Elk manual for details."
echo
echo "Then run 'make' to compile the code."
echo
echo
echo "To enable syntax highlighting in vim run 'make vim'"
echo