-
Notifications
You must be signed in to change notification settings - Fork 1
/
compilers.mk
206 lines (170 loc) · 5.2 KB
/
compilers.mk
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#=================================================================================
# gfortran (osx and linux)
#=================================================================================
ifeq ($(FFC),gfortran)
# optimization management (default without optimization)
ifeq ($(OOPT),1)
FFLAGS = -O5 -g -fbacktrace -funroll-loops -ftree-vectorize -falign-loops=16
CFLAGS = -O5 -g -funroll-loops -ftree-vectorize -falign-loops=16
else
FFLAGS = -Og -g -fbacktrace -fcheck=all -fwhole-file -fcheck=pointer -Wuninitialized -finit-real=nan -finit-integer=nan
CFLAGS = -O0 -g -fwhole-file -Wuninitialized
endif
# integer kind management
ifeq ($(INT),8)
FFLAGS += -fdefault-integer-8
endif
# where to store .mod files
FFLAGS +=-J$(MOD_DIR)
# where to look .mod files (add -I$(MOD_DIR) for nagfor)
FFLAGS += -I$(MOD_DIR) $(EXTMod)
# omp management (default with openmp)
ifeq ($(OOMP),1)
FFLAGS += -fopenmp
CFLAGS += -fopenmp
endif
# lapack management with cpreprocessing
FFLAGS += -cpp -D__LAPACK="$(LLAPACK)"
# lapack management
ifeq ($(LLAPACK),1)
ifeq ($(OS),Darwin) # OSX
# OSX libs (included lapack+blas)
FLIB = -framework Accelerate
else # Linux
# linux libs
FLIB = -llapack -lblas
endif
endif
FC_VER = $(shell $(FFC) --version | head -1 )
endif
#=================================================================================
# lfortran (it does not work)
#=================================================================================
ifeq ($(FFC),lfortran)
# optimization management (default without optimization)
ifeq ($(OOPT),1)
FFLAGS = --fast --realloc-lhs
else
FFLAGS = --realloc-lhs
endif
# integer kind management
ifeq ($(INT),8)
FFLAGS += -fdefault-integer-8
endif
# where to store .mod files
FFLAGS +=-J$(MOD_DIR)
# where to look .mod files (add -I$(MOD_DIR) for nagfor)
FFLAGS += -I$(MOD_DIR) $(EXTMod)
# omp management (default with openmp)
ifeq ($(OOMP),1)
FFLAGS += --openmp
endif
# lapack management with cpreprocessing
FFLAGS += -cpp -D__LAPACK="$(LLAPACK)"
# lapack management
ifeq ($(LLAPACK),1)
ifeq ($(OS),Darwin) # OSX
# OSX libs (included lapack+blas)
FLIB = -framework Accelerate
else # Linux
# linux libs
FLIB = -llapack -lblas
endif
endif
FC_VER = $(shell $(FFC) --version | head -1 )
endif
#=================================================================================
# ifort and ifx compillation v17 v18 with/without mkl
#=================================================================================
ifeq ($(FFC),$(filter $(FFC),ifort ifx))
# opt management + add/remove some flag to ifort/ifx (mainly to avoid bugs with ifx)
ifeq ($(OOPT),1)
FFLAGS = -O -g -traceback
CFLAGS = -O -g -traceback
ifeq ($(FFC),ifort)
FFLAGS += -heap-arrays
endif
else
FFLAGS = -O0 -g -traceback
CFLAGS = -O0 -g -traceback
ifeq ($(FFC),ifort)
FFLAGS += -heap-arrays -check all
else
FFLAGS += -check all,nouninit
endif
endif
# integer kind management
ifeq ($(INT),8)
FFLAGS += -i8
endif
# where to store the modules
FFLAGS +=-module $(MOD_DIR)
# where to look .mod files (add -I$(MOD_DIR) for nagfor)
FFLAGS += -I$(MOD_DIR) $(EXTMod)
# omp management
ifeq ($(OOMP),1)
ifeq ($(FFC),ifort)
FFLAGS += -qopenmp -parallel
CFLAGS += -qopenmp -parallel
else # ifx
FFLAGS += -qopenmp
CFLAGS += -qopenmp
endif
endif
# lapack management with cpreprocessing
FFLAGS += -cpp -D__LAPACK="$(LLAPACK)"
ifeq ($(LLAPACK),1)
ifeq ($(FFC),ifort)
FLIB += -mkl -lpthread
else # ifx
FLIB += -qmkl -lpthread
endif
else
FLIB += -lpthread
endif
FC_VER = $(shell $(FFC) --version | head -1 )
endif
#===============================================================================
# nag compillation (nagfor)
#===============================================================================
ifeq ($(FFC),nagfor)
# opt management
ifeq ($(OOPT),1)
FFLAGS = -O4 -o -compatible -kind=byte -Ounroll=4 -s
else
ifeq ($(OOMP),0)
ifeq ($(LLAPACK),0)
FFLAGS = -O0 -g -gline -kind=byte -C -C=alias -C=intovf -C=undefined
else
FFLAGS = -O0 -g -gline -kind=byte -C -C=alias -C=intovf
endif
else
FFLAGS = -O0 -g -kind=byte -C -C=alias -C=intovf
endif
endif
# integer kind management
ifeq ($(INT),8)
FFLAGS += -i8
endif
# where to store the .mod files
FFLAGS +=-mdir $(MOD_DIR)
# where to look .mod files (add -I$(MOD_DIR) for nagfor)
FFLAGS += -I$(MOD_DIR) $(EXTMod)
# omp management
ifeq ($(OOMP),1)
FFLAGS += -openmp
endif
# lapack management with cpreprocessing
FFLAGS += -fpp -D__LAPACK="$(LLAPACK)"
# lapact management (default with openmp), with cpreprocessing
ifeq ($(LLAPACK),1)
ifeq ($(OS),Darwin) # OSX
# OSX libs (included lapack+blas)
FLIB = -framework Accelerate
else # Linux
# linux libs
FLIB = -llapack -lblas
endif
endif
FC_VER = $(shell $(FFC) -V 3>&1 1>&2 2>&3 | head -1 )
endif