-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathconfigure.ac
396 lines (340 loc) · 10.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
AC_PREREQ([2.69])
AC_INIT([neko],[0.9.99])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_LANG(Fortran)
AC_PROG_INSTALL
AC_PROG_SED
AC_PROG_MAKE_SET
LT_INIT([disable-shared])
LT_LANG([Fortran])
AC_ARG_ENABLE(contrib,
AS_HELP_STRING([--enable-contrib],[Compile various tools]),
[enable_contrib=${enableval}], [enable_contrib=yes])
AC_ARG_ENABLE(real,
AS_HELP_STRING([--enable-real=Xp Specify working precision of REAL types:
ssp -- REAL(kind=4) xp -- sp
sp -- REAL(kind=4) xp -- dp
dp -- REAL(kind=8) xp -- dp (default)
qp -- REAL(kind=16) xp -- qp]),
[enable_real=${enableval}], [enable_real=dp])
AC_ARG_ENABLE(blk_size,
AS_HELP_STRING([--enable-blk_size=number of values Specify size of fast memory]),
[blk_size=${enableval}], [blk_size="10000"])
AC_ARG_ENABLE(device-mpi,
AS_HELP_STRING([--enable-device-mpi],[Enable device aware MPI]),
[enable_device_mpi=${enableval}], [enable_device_mpi=no])
AC_ARG_ENABLE(openmp, AC_HELP_STRING([--enable-openmp], [Enable OpenMP]),
[enable_openmp=${enableval}], [enable_openmp=no])
# Test for a sane fortran environment (^-^)
AC_LANG(Fortran)
AC_PROG_FC(,90)
AX_COARRAY
AX_DTYPE_IO
AX_REAL128
# Test for a working MPI compiler
AX_MPI([have_mpi=yes], [have_mpi=no])
if test "x${have_mpi}" != xno; then
FC="$MPIFC"
LIBS="$MPILIBS $LIBS"
AC_LANG(C)
AX_MPI([have_mpi=yes],[have_mpi=no])
if test "x${have_mpi}" != xno; then
CC="$MPICC"
else
AC_MSG_ERROR([Can't find a suitable C MPI compiler])
fi
AC_LANG(C++)
AX_MPI([have_mpi=yes],[have_mpi=no])
if test "x${have_mpi}" != xno; then
CXX="$MPICXX"
fi
AC_LANG(Fortran)
else
AC_MSG_ERROR([Can't find a suitable MPI compiler])
fi
AX_MPIF08
AX_MPI_DTYPE
# Test for OpenMP (if requested)
if test "x${enable_openmp}" != xno; then
AX_OPENMP([have_openmp=yes], [have_openmp=no])
if test "x${have_openmp}" != xno; then
FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
AC_LANG(C)
AX_OPENMP([have_openmp=yes], [have_openmp=no])
if test "x${have_openmp}" != xno; then
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
fi
AC_LANG(Fortran)
fi
fi
AC_FC_PP_SRCEXT([F90])
AX_COMPILER_VENDOR
# Checks for platform headers
AC_LANG_PUSH([C])
AC_CHECK_HEADERS([cpuid.h])
AC_LANG_POP([C])
# Set necessary flags to fix issues with various compilers
if test "x$ax_cv_fc_compiler_vendor" = xportland; then
FCFLAGS="$FCFLAGS -Mbackslash"
fi
if test "x$ax_cv_fc_compiler_vendor" = xnvhpc; then
FCFLAGS="$FCFLAGS -Mbackslash"
fi
# Store build information (date, host, FC)
AC_SUBST(NEKO_BUILD_INFO,
["(build: $(date +%Y-%m-%d) on $host using $ax_cv_fc_compiler_vendor)"], [])
# Checks for Doxygen
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -n "$DOXYGEN"; then
AC_CHECK_PROGS([DOXYGEN_DEPS], [dot])
fi
AM_CONDITIONAL([ENABLE_DOXYGEN], [test -n "$DOXYGEN_DEPS"])
# Checks for makedepf90
AC_CHECK_PROGS([MAKEDEPF90], [makedepf90])
AM_CONDITIONAL([ENABLE_MAKEDEPF90], [test -n "$MAKEDEPF90"])
# Checks for flinter
AC_CHECK_PROGS([FLINT], [flint])
AM_CONDITIONAL([ENABLE_FLINT], [test -n "$FLINT"])
# Checks for various platforms
AX_CRAY
AX_HPE_CRAY
AX_SX
# Checks for pFUnit
AX_PFUNIT
# Check for blas and lapack
AS_IF([test "x${is_cray}" = xyes || test "x${is_hpe_cray}" = xyes],
AX_CRAY_LIBSCI
if test "x${have_cray_libsci}" = xyes; then
have_blas_lapack="yes"
else
have_blas_lapack="no"
fi, have_blas_lapack="no")
if test "x${have_blas_lapack}" != xyes; then
AX_LAPACK
if test "x${ax_lapack_ok}" != xno; then
LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS"
have_blas_lapack=yes
else
have_blas_lapack=no
fi
fi
if test "x${have_blas_lapack}" != xyes; then
AC_MSG_ERROR([Can't find a suitable BLAS/LAPACK library])
fi
if test "x${have_darshan}" != xyes; then
AX_DARSHAN
if test "x${ax_darshan_ok}" != xno; then
LIBS="$DARSHAN_LIBS $LIBS"
have_darshan=yes
else
have_darshan=no
fi
fi
found_domain_decomp="no"
# Checks for ParMetis
if test "x${is_cray}" = xyes; then
AX_CRAY_PARMETIS
if test "x${have_cray_parmetis}" = xyes; then
found_domain_decomp="yes"
fi
fi
if test "x${found_domain_decomp}" != xyes; then
AX_PARMETIS
if test "${PARMETIS_LIBS}"; then
LIBS="$PARMETIS_LIBS $LIBS"
found_domain_decomp="yes"
fi
fi
# Checks for ADIOS2
AX_ADIOS2
# Checks for gslib
AX_GSLIB
# Select Working precision of REAL
if test "x$enable_real" = xssp; then
AC_SUBST(NEKO_REAL_TYPE, "sp")
AC_SUBST(NEKO_C_REAL_TYPE, "c_float")
AC_SUBST(NEKO_MPI_REAL_TYPE, "MPI_REAL")
AC_SUBST(NEKO_DEV_REAL_TYPE, "float")
AC_SUBST(NEKO_XREAL_TYPE, "sp")
AC_SUBST(NEKO_C_XREAL_TYPE, "c_float")
AC_SUBST(NEKO_MPI_XREAL_TYPE, "MPI_REAL")
AC_SUBST(NEKO_DEV_XREAL_TYPE, "float")
elif test "x$enable_real" = xsp; then
AC_SUBST(NEKO_REAL_TYPE, "sp")
AC_SUBST(NEKO_C_REAL_TYPE, "c_float")
AC_SUBST(NEKO_MPI_REAL_TYPE, "MPI_REAL")
AC_SUBST(NEKO_DEV_REAL_TYPE, "float")
AC_SUBST(NEKO_XREAL_TYPE, "dp")
AC_SUBST(NEKO_C_XREAL_TYPE, "c_double")
AC_SUBST(NEKO_MPI_XREAL_TYPE, "MPI_DOUBLE_PRECISION")
AC_SUBST(NEKO_DEV_XREAL_TYPE, "double")
elif test "x$enable_real" = xdp; then
AC_SUBST(NEKO_REAL_TYPE, "dp")
AC_SUBST(NEKO_C_REAL_TYPE, "c_double")
AC_SUBST(NEKO_MPI_REAL_TYPE, "MPI_DOUBLE_PRECISION")
AC_SUBST(NEKO_DEV_REAL_TYPE, "double")
AC_SUBST(NEKO_XREAL_TYPE, "dp")
AC_SUBST(NEKO_C_XREAL_TYPE, "c_double")
AC_SUBST(NEKO_MPI_XREAL_TYPE, "MPI_DOUBLE_PRECISION")
AC_SUBST(NEKO_DEV_XREAL_TYPE, "double")
elif test "x$enable_real" = xqp; then
AC_SUBST(NEKO_REAL_TYPE, "qp")
AC_SUBST(NEKO_C_REAL_TYPE, "c_long_double")
AC_SUBST(NEKO_MPI_REAL_TYPE, "MPI_REAL16")
AC_SUBST(NEKO_DEV_REAL_TYPE, "long double")
AC_SUBST(NEKO_XREAL_TYPE, "qp")
AC_SUBST(NEKO_C_XREAL_TYPE, "c_long_double")
AC_SUBST(NEKO_MPI_XREAL_TYPE, "MPI_REAL16")
AC_SUBST(NEKO_DEV_XREAL_TYPE, "long double")
else
AC_MSG_ERROR([Invalid working precision])
fi
if test "x$have_real128" = xyes; then
AC_SUBST(NEKO_REAL128_TYPE, "REAL128")
else
AC_SUBST(NEKO_REAL128_TYPE, "selected_real_kind(1)")
if test "x$enable_real" = xqp; then
AC_MSG_ERROR([REAL128 not supported])
fi
fi
AC_SUBST(blk_size, ${blk_size})
# Checks for libxsmm backend
AX_LIBXSMM
# Checks for HIP backend
if test "x${is_hpe_cray}" = xyes; then
AX_CRAY_ROCM
else
AX_HIP
fi
# Checks for CUDA backend
if test "x${is_cray}" = xyes; then
AX_CRAY_CUDATOOLKIT
else
AX_CUDA
fi
# Checks for OpenCL backend
AX_OPENCL
# Check if device aware MPI is requested
if (test "x${have_cuda}" = xyes ||
test "x${have_hip}" = xyes ||
test "x${have_opencl}" = xyes); then
if test "x${enable_device_mpi}" = xyes; then
# Check that necessary accelerator modules are loaded
if (test "x${is_cray}" = xyes || test "x${is_hpe_cray}" = xyes); then
AX_CRAY_ACCEL
fi
AC_SUBST(device_mpi, .true.)
AC_DEFINE(HAVE_DEVICE_MPI, 1, [Define if device MPI is requested.])
if test "x${have_cuda}" = xyes; then
CUDA_CFLAGS="$CUDA_CFLAGS -DHAVE_DEVICE_MPI=1"
# Make sure we have support for atomicAdd
AS_IF([test "$CUDA_ARCH"],[],[CUDA_ARCH="-arch sm_60"])
fi
if test "x${have_hip}" = xyes; then
HIP_HIPCC_FLAGS="$HIP_HIPCC_FLAGS -DHAVE_DEVICE_MPI=1"
fi
else
AC_SUBST(device_mpi, .false.)
fi
else
AC_SUBST(device_mpi, .false.)
fi
# Checks for NCCL backend
AX_NCCL
# Checks for RCCL backend
AX_RCCL
# Checks for NVTX profiling
AX_NVTX
# Checks for ROCTX profiling
AX_ROCTX
# Checks for HDF5
if (test "x${is_cray}" = xyes || test "x${is_hpe_cray}" = xyes); then
AX_CRAY_HDF5_PARALLEL
else
AX_HDF5
fi
# JSON-Fortran
PKG_CHECK_MODULES([JSON_Fortran],[json-fortran >= 7.1.0])
LIBS="$JSON_Fortran_LIBS $LIBS"
FCFLAGS="$JSON_Fortran_CFLAGS $FCFLAGS"
AM_CONDITIONAL([ENABLE_PARMETIS], [test "x$found_domain_decomp" = xyes])
AM_CONDITIONAL([ENABLE_ADIOS2], [test "x${have_adios2}" = xyes])
AM_CONDITIONAL([ENABLE_CUDA], [test "x${have_cuda}" = xyes])
AM_CONDITIONAL([ENABLE_HIP], [test "x${have_hip}" = xyes])
AM_CONDITIONAL([ENABLE_OPENCL], [test "x${have_opencl}" = xyes])
AM_CONDITIONAL([ENABLE_CONTRIB], [test "x${enable_contrib}" = xyes])
# Set device dependent flags
AC_SUBST(CUDA_ARCH)
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(HIP_HIPCC_FLAGS)
# Set device backend if requested (and found)
if (test "x${have_cuda}" = xyes ||
test "x${have_hip}" = xyes ||
test "x${have_opencl}" = xyes); then
AC_SUBST(device_bcknd, "1")
else
AC_SUBST(device_bcknd, "0")
fi
AC_CONFIG_FILES([Makefile\
src/Makefile\
tests/unit/Makefile\
src/comm/comm.F90\
src/config/neko_config.f90\
src/config/num_types.f90\
src/device/device_config.h\
src/scripts/cltostring.sh\
makeneko\
neko.pc])
# Config tests/unit
AC_CONFIG_FILES([tests/unit/stack/Makefile\
tests/unit/tuple/Makefile\
tests/unit/point/Makefile\
tests/unit/htable/Makefile\
tests/unit/uset/Makefile\
tests/unit/quad/Makefile\
tests/unit/hex/Makefile\
tests/unit/tet/Makefile\
tests/unit/tri/Makefile\
tests/unit/math/Makefile\
tests/unit/mesh/Makefile\
tests/unit/space/Makefile\
tests/unit/dofmap/Makefile\
tests/unit/field/Makefile\
tests/unit/mean_field/Makefile\
tests/unit/mean_sqr_field/Makefile\
tests/unit/gather_scatter/Makefile\
tests/unit/krylov/Makefile\
tests/unit/bc/Makefile\
tests/unit/signal/Makefile\
tests/unit/jobctrl/Makefile\
tests/unit/device/Makefile\
tests/unit/device_math/Makefile\
tests/unit/mathops/Makefile\
tests/unit/device_mathops/Makefile\
tests/unit/octree/Makefile\
tests/unit/vector/Makefile\
tests/unit/matrix/Makefile\
tests/unit/scratch_registry/Makefile\
tests/unit/fast3d/Makefile\
tests/unit/time_scheme/Makefile\
tests/unit/time_scheme_controller/Makefile\
tests/unit/time_based_controller/Makefile\
tests/unit/point_interpolation/Makefile])
if test "x${enable_contrib}" = xyes; then
AC_CONFIG_FILES([contrib/Makefile\
contrib/rea2nbin/Makefile\
contrib/genmeshbox/Makefile\
contrib/average_fields_in_time/Makefile\
contrib/calc_lift_from_field/Makefile\
contrib/postprocess_fluid_stats/Makefile\
contrib/average_field_in_space/Makefile\
contrib/map_to_equidistant_1d/Makefile\
contrib/mesh_checker/Makefile\
contrib/prepart/Makefile])
fi
# Doxygen
AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])
AC_OUTPUT