forked from JeffersonLab/cpp_wilson_dslash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
397 lines (328 loc) · 11.7 KB
/
configure.ac
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
AC_INIT(sse_wilson_dslash, 1.0.0, [email protected])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
dnl initialise automake
AM_INIT_AUTOMAKE
dnl put defines in include sse/config.h
AC_CONFIG_HEADERS([include/dslash_config_internal.h])
dnl dnl **************************************************************
dnl dnl *** Get User Options ***
dnl dnl **************************************************************
dnl learn the parallel architecture
AC_ARG_ENABLE(parallel-arch,
AC_HELP_STRING([--enable-parallel-arch=<arch>],
[Build Assembler for parallel architecture <arch>]),
[ PARALLEL_ARCH="${enableval}"]
)
AC_ARG_ENABLE(testing,
AC_HELP_STRING([--enable-testing],
[Enable make check to automatically run tests, rather than just build them]), [ do_tests="${enableval}" ]
)
AC_ARG_ENABLE(site-tests,
AC_HELP_STRING([--enable-site-tests],
[Enable building of site-ops tests. These still use inline assembler so may not be suitable for all compilers ]),
[ site_tests="${enableval}"]
)
dnl check for QMP -- needed for parallel configures
AC_ARG_WITH(qmp,
AC_HELP_STRING(
[--with-qmp=DIR],
[Build Assembler on top of QMP, where QMP is installed in DIR.]
),
[QMP_HOME="${with_qmp}"]
)
dnl Use Jie Chens threads library
AC_ARG_WITH(qmt,
AC_HELP_STRING(
[--with-qmt=<DIR>],
[Enable use of QMT Threads library installed in DIR]
),
[ qmt_enabled="yes"
QMT_HOME=${with_qmt} ],
[ qmt_enabled="no" ]
)
dnl Use OpenMP threading
AC_ARG_ENABLE(openmp,
AC_HELP_STRING(
[--enable-openmp],
[Enable building of OpenMP dispatcher. Pass flags necessary for OpenMP on CFLAGS]
),
[ omp_enabled="yes" ],
[ omp_enabled="no" ]
)
AC_ARG_ENABLE(nocompute,
AC_HELP_STRING(
[--enable-nocompute],
[Disable the compute parts of dslash. This allows the timing of the routine with only communications.]
),
[ nocompute_enabled="yes" ],
[ nocompute_enabled="no" ]
)
AC_ARG_ENABLE(nocomms,
AC_HELP_STRING(
[--enable-nocomms],
[Disable the comms parts of dslash. This allows one to gauge the effect of communications.]
),
[ nocomms_enabled="yes" ],
[ nocomms_enabled="no" ]
)
AC_ARG_ENABLE(sse2,
AC_HELP_STRING(
[--enable-sse],
[Enables the SSE optimized code. This needs you to have a compiler which can cope with intel style xmmintrin intrinsics, and this option may not be suitable for non SSE Compatible platforms]
),
[ sse_enabled=${enableval} ],
[ sse_enabled="no"]
)
AC_ARG_ENABLE(sse3,
AC_HELP_STRING(
[--enable-sse],
[Enables the SSE optimized code. This needs you to have a compiler which can cope with intel style xmmintrin intrinsics, and this option may not be suitable for non SSE Compatible platforms]
),
[ sse3_enabled=${enableval} ],
[ sse3_enabled="no"]
)
dnl with QDP -- QDP will override everything else
dnl since a parallel QDP will know its architecture
dnl precition and have all the flags for QMP set already
dnl in its CXXFLAGS etc etc
dnl
dnl This flag and all the other flags are complimentary
dnl to each other therefore. Also --with-qdp is also
dnl passed down the command line when compiling Chroma,
dnl so a sub-configure will also work
dnl we can also put the QDP++ packers in here too...
AC_ARG_WITH(qdp,
AC_HELP_STRING(
[--with-qdp=DIR],
[ Build Assembler with QDP++, where QDP++ is installed in DIR. ]
),
[ QDPXX_HOME="${with_qdp}"
QDPXX_GIVEN="yes"
],
[ QDPXX_GIVEN="no" ]
)
dnl dnl ******************** DONE WITH USER INPUT *********************
dnl dnl *** Now Configuration ****
dnl dnl ***************************************************************
if test "X${site_tests}X" = "XyesX" ;
then
AC_MSG_NOTICE([ Building Site Tests ] )
else
AC_MSG_NOTICE([ Not building site tests ] )
fi
AM_CONDITIONAL(BUILD_SITE_TESTS, [ test "X${site_tests}X" == "XyesX" ] )
if test "X${do_tests}X" == "XyesX" ;
then
AC_MSG_NOTICE([ Enabling automatic running of tests for make check ])
else
AC_MSG_NOTICE([ make check will make but not run the tests ])
fi
AM_CONDITIONAL(RUN_TESTS, [ test "X${do_tests}X" == "XyesX" ] )
dnl
dnl ***************************************************************
dnl *** There are two distinct branches depending ***
dnl *** on whether we are compiling with QDP++ or not ***
dnl ***************************************************************
dnl
AM_CONDITIONAL(BUILD_QDP_TESTS, [ test "X${QDPXX_GIVEN}X" == "XyesX" ] )
if test "X${QDPXX_GIVEN}X" = "XyesX"; then
dnl Find the QDP++ config program
if test "X${QDPXX_HOME}X" = "XX" ;
then
AC_PATH_PROG(QDPXX_CONFIG, [qdp++-config], [])
else
AC_PATH_PROG(QDPXX_CONFIG, [qdp++-config], [], [${QDPXX_HOME}/bin:${PATH}])
fi
if test "X${QDPXX_CONFIG}X" = "XX" ; then
AC_MSG_ERROR([QDP++ configuration program qdp++-config not found.])
fi
AC_MSG_NOTICE([Found QDP++ configuration program ${QDPXX_CONFIG}])
AC_MSG_CHECKING([if QDP++ uses checkerboarded layout])
layout=`${QDPXX_CONFIG} --layout`
if test "X${layout}X" == "Xcb2X" -o "X${layout}X" == "Xcb3dX" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([This Dslash Operator only works for checkerboarded QDP++. Sorry])
fi
AC_SUBST(SSEXX_AUX_CFLAGS, "`${QDPXX_CONFIG} --cxxflags`")
AC_MSG_NOTICE([QDP++ compile flags: ${SSEXX_AUX_CFLAGS}])
AC_SUBST(SSEXX_AUX_LDFLAGS, "`${QDPXX_CONFIG} --ldflags`")
AC_MSG_NOTICE([QDP++ linking flags: ${SSEXX_AUX_LDFLAGS}])
AC_SUBST(SSEXX_AUX_LIBS, "`${QDPXX_CONFIG} --libs`")
AC_MSG_NOTICE([QDP++ libraries flags: ${SSEXX_AUX_LIBS}])
QDPXX_ND="`${QDPXX_CONFIG} --Nd`"
AC_MSG_NOTICE([QDP++ spacetime dimension: ${QDPXX_ND}])
QDPXX_NC="`${QDPXX_CONFIG} --Nc`"
AC_MSG_NOTICE([QDP++ number of colors: ${QDPXX_NC}])
QDPXX_NS="`${QDPXX_CONFIG} --Ns`"
AC_MSG_NOTICE([QDP++ number of spin components: ${QDPXX_NS}])
PARALLEL_ARCH="`${QDPXX_CONFIG} --parallel-arch`"
AC_MSG_NOTICE([QDP++ has parallel arch: ${PARALLEL_ARCH} ] )
dnl This function is defined in acinclude.m4
dnl it tries to try to compile the program
PAC_QDPXX_LINK_CXX_FUNC(
${SSEXX_AUX_CFLAGS},
${SSEXX_AUX_LDFLAGS},
${SSEXX_AUX_LIBS},
,
,
[qdpxx_link_ok=yes],
[qdpxx_link_ok=no]
)
AC_MSG_CHECKING([if we can compile/link a simple QDP++ program])
if test "X${qdpxx_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a program with QDP++.
Use --with-qdp++=<dir> to select a working version.])
fi
dnl *********************************************************
dnl *** end of section with QDP++ ***
dnl *********************************************************
else
dnl ***************************************************************
dnl *** Section without QDP++ -- Need to check for QMP possibly ***
dnl ***************************************************************
case "${PARALLEL_ARCH}" in
scalar)
AC_MSG_NOTICE([ Scalar Build! Not checking for QMP ])
AC_SUBST(SSEXX_AUX_CFLAGS)
AC_SUBST(SSEXX_AUX_LDFLAGS)
AC_SUBST(SSEXX_AUX_LIBS)
;;
parscalar)
AC_MSG_NOTICE([ Parscalar build! Checking for QMP ])
dnl look for qmp-config program
if test "X${QMP_HOME}X" = "XX" ; then
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [])
else
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [], [${QMP_HOME}/bin:${PATH}])
fi
dnl look for flags needed for QMP
if test "X${QMP_CONFIG}X" != "XX" ; then
AC_MSG_NOTICE([Found QMP configuration program ${QMP_CONFIG}])
AC_SUBST(SSEXX_AUX_CFLAGS, "`${QMP_CONFIG} --cflags`")
AC_MSG_NOTICE([QMP compile flags: ${SSEXX_AUX_CFLAGS}])
AC_SUBST(SSEXX_AUX_LDFLAGS, "`${QMP_CONFIG} --ldflags`")
AC_MSG_NOTICE([QMP linking flags: ${SSEXX_AUX_LDFLAGS}])
AC_SUBST(SSEXX_AUX_LIBS, "`${QMP_CONFIG} --libs`")
AC_MSG_NOTICE([QMP libraries flags: ${SSEXX_AUX_LIBS}])
else
AC_MSG_WARN([QMP configuration program qmp-config not found.])
AC_MSG_WARN([Set environment variables QMP_CFLAGS QMP_LDFAGS QMP_LIBS before configure])
fi
dnl verify we can compile and link against QMP, if needed
AC_PROG_CXX
PAC_QMP_LINK_CC_FUNC(
[${SSEXX_AUX_CFLAGS}],
[${SSEXX_AUX_LDFLAGS}],
[${SSEXX_AUX_LIBS}],
,
,
[qmp_link_ok=yes],
[qmp_link_ok=no]
)
AC_MSG_CHECKING([if we can compile/link of a simple QMP C program])
if test "X${qmp_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a basic QMP C program! Check QMP_CFLAGS, QMP_LDFLAGS, QMP_LIBS.])
fi
;;
*)
AC_MSG_ERROR([ Unknown value for --enable-parallel-arch ])
;;
esac
fi
case ${PARALLEL_ARCH} in
scalar|parscalar)
;;
*)
AC_MSG_ERROR([Unknown Parallel Architecture: ${PARALLEL_ARCH} ] )
;;
esac
dnl ************************************************************************
dnl **** Compile Defines to select right stuff. Always SSE now *
dnl ************************************************************************
case ${PARALLEL_ARCH} in
scalar)
AC_DEFINE_UNQUOTED(CPP_DSLASH_SCALAR, [1], [Scalar Arch])
;;
parscalar)
AC_DEFINE_UNQUOTED(CPP_DSLASH_PARSCALAR, [1], [Parscalar Arch])
;;
*)
AC_MSG_ERROR([Unsupported parallel arch])
;;
esac
AM_CONDITIONAL(SCALAR, [ test "X${PARALLEL_ARCH}X" == "XscalarX" ] )
AM_CONDITIONAL(PARSCALAR, [ test "X${PARALLEL_ARCH}X" == "XparscalarX" ] )
AM_CONDITIONAL(BUILD_QDP_PACKERS, [ test "X${QDPXX_GIVEN}X" == "XyesX" ])
dnl NOCOMPUTE DIagnostic
if test "X${nocompute_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Disabling The Compute Parts of the Dslash])
AC_DEFINE([SSEDSLASH_4D_NOCOMPUTE],[1],[Disable computation in 4D kernels])
fi
if test "X${nocomms_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Disabling the Comms in the Dslash])
AC_DEFINE([SSEDSLASH_4D_NOCOMMS],[1],[Disable computation in 4D kernels])
fi
dnl QMT Threads stuff
if test "X${qmt_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring QMT Threading])
if test "X${omp_enabled}X" == "XyesX";
then
AC_MSG_ERROR([Cannot have OpenMP and QMT threading defined simultaneously])
fi
AC_DEFINE([DSLASH_USE_QMT_THREADS], [1], [ Use QMT Threads library ])
AC_SUBST(QMT_CFLAGS, "-I${QMT_HOME}/include")
AC_SUBST(QMT_LDFLAGS, "-L${QMT_HOME}/lib")
AC_SUBST(QMT_LIBS, "-lqmt -lpthread -lm")
else
AC_SUBST(QMT_CFLAGS, "")
AC_SUBST(QMT_LDFLAGS, "")
AC_SUBST(QMT_LIBS, "")
fi
if test "X${omp_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring OpenMP Threading])
if test "X${qmt_enabled}X" == "XyesX";
then
AC_MSG_ERROR([Cannot have OpenMP and QMT threading defined simultaneously])
fi
AC_DEFINE([DSLASH_USE_OMP_THREADS], [1], [ Use OpenMP Threads ])
fi
if test "X${sse_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring SSE2 Code]);
AC_DEFINE([DSLASH_USE_SSE2],[1], [ Use SSE2 Code in kernels])
else
AC_MSG_NOTICE([Not Configuring SSE2 Code]);
fi
if test "X${sse3_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring SSE2 and SSE3 Code]);
AC_DEFINE([DSLASH_USE_SSE2],[1], [ Use SSE2 Code in kernels])
AC_DEFINE([DSLASH_USE_SSE2],[1], [ Use SSE3 Code in kernels])
else
AC_MSG_NOTICE([Not Configuring SSE3 Code]);
fi
AM_CONDITIONAL(BUILD_QMT, [test "x${qmt_enabled}x" = "xyesx" ])
AM_CONDITIONAL(BUILD_OMP, [test "x${omp_enabled}x" = "xyesx" ])
AM_CONDITIONAL(BUILD_NOTHREADS, [ test "x${omp_enabled}x" = "xnox" -a "x${qmt_enabled}x" = "xnox" ])
dnl dnl produce output
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(include/Makefile)
AC_CONFIG_FILES(lib/Makefile)
AC_CONFIG_FILES(tests/Makefile)
AC_OUTPUT