-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
349 lines (292 loc) · 12 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
dnl This is an autoconf script.
dnl To rebuild the `configure' script from this, execute the command
dnl autoconf
dnl in the directory containing this script.
dnl
AC_INIT([atrip],[0.0.0],[https://gihtub.com/alejandrogallo/atrip])
AC_CONFIG_SRCDIR([configure.ac])
AC_PREREQ(2.69)
AC_CONFIG_MACRO_DIRS([./etc/m4])
AC_CONFIG_AUX_DIR([./etc/autotools])
AM_INIT_AUTOMAKE([foreign -Wall])
dnl -----------------------------------------------------------------------
dnl Configure switches
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared],
[enable loading compiled
files (default=YES)]),
[], [enable_shared=yes])
AC_ARG_ENABLE([docs],
[AS_HELP_STRING([--enable-docs],
[Enable building docs])],
[build_docs=YES], [build_docs=NO])
dnl LIBCTTF library options
AC_ARG_WITH(ctf,
[AS_HELP_STRING([--with-ctf],
[prefix for CTF includes and libraries] )],
[LIBCTF_PATH="`readlink -f $withval`";
LIBCTF_CPATH="`readlink -f $withval`/include";
LIBCTF_LD_LIBRARY_PATH="`readlink -f $withval`/lib";
BUILD_CTF=NO],
[BUILD_CTF=YES
LIBCTF_PATH="$ac_pwd"/extern/ctf
LIBCTF_CPATH="${LIBCTF_PATH}/include"
LIBCTF_LD_LIBRARY_PATH="${LIBCTF_PATH}/lib"
])
AC_ARG_WITH([clang-check],
[AS_HELP_STRING([--with-clang-check],
[Check with clang-check])],
[clang_check=YES;
AC_CHECK_PROG([CLANG_CHECK], [clang-check])],
[clang_check=NO])
AM_CONDITIONAL([WITH_CLANG_CHECK], [test x${clang_check} = xYES])
dnl CUDA ----
AC_ARG_ENABLE([cuda],
[AS_HELP_STRING([--enable-cuda],
[Build with cuda])],
[WITH_CUDA=yes],
[WITH_CUDA=no])
AC_ARG_VAR([NVCC], [Path to the nvidia cuda compiler.])
AC_ARG_VAR([CUDA_LDFLAGS], [LDFLAGS to find libraries -lcuda, -lcudart, -lcublas.])
AC_ARG_VAR([CUDA_CXXFLAGS], [CXXFLAGS to find the CUDA headers])
dnl HIP ----
AC_ARG_ENABLE([hip],
[AS_HELP_STRING([--enable-hip],
[Build with hip])],
[WITH_HIP=yes],
[WITH_HIP=no])
AC_ARG_VAR([HIPCC], [Path to the nvidia hip compiler.])
AC_ARG_VAR([HIP_LDFLAGS], [LDFLAGS for the HIPCC compiler])
AC_ARG_VAR([HIP_CXXFLAGS], [CXXFLAGS to find the HIP headers])
dnl profile ----
AC_ARG_ENABLE([profiler],
[AS_HELP_STRING([--enable-profiler],
[Enable profiler tools for HIP or CUDA])],
[WITH_PROFILER=yes],
[WITH_PROFILER=no])
AC_ARG_VAR([PROFILER_PATH], [Path to the profiler include and lib directories])
dnl -----------------------------------------------------------------------
dnl ATRIP CPP DEFINES
dnl -----------------------------------------------------------------------
AC_ARG_WITH([atrip-debug],
[AS_HELP_STRING([--with-atrip-debug],
[Debug level for atrip, possible values:
1, 2, 3, 4])],
[AC_DEFINE([ATRIP_DEBUG],[atrip-debug],[Atrip debug level])],
[AC_DEFINE([ATRIP_DEBUG],[1],[Atrip debug level])])
AC_ARG_ENABLE([atrip_dgemm],
[AS_HELP_STRING([--disable-dgemm],
[Disable using dgemm for the doubles equations])],
[],
[AC_DEFINE([ATRIP_USE_DGEMM],
1,
[Use dgemm for the doubles equations])])
ATRIP_DEF([slice], [disable],
[ATRIP_DONT_SLICE],
[Disable the step of slicing tensors for CTF, this is useful
for example for benchmarking or testing.])
ATRIP_DEF([only-dgemm], [enable],
[ATRIP_ONLY_DGEMM],
[Run only the parts of atrip that involve dgemm calls, this
is useful for benchmarking and testing the code, it is
intended for developers of Atrip.])
ATRIP_DEF([naive-slow], [enable],
[ATRIP_NAIVE_SLOW],
[Run slow but correct code for the mapping of (iteration,
rank) to tuple of the naive tuple distribution.])
ATRIP_DEF([sources-in-gpu], [enable],
[ATRIP_SOURCES_IN_GPU],
[When using CUDA, activate storing all sources (slices of
the input tensors) in the GPU. This means that a lot of GPUs
will be needed.])
ATRIP_DEF([cuda-aware-mpi], [enable],
[ATRIP_CUDA_AWARE_MPI],
[When using MPI, assume support for CUDA aware mpi by the
given MPI implementation.])
ATRIP_DEF([mpi-staging-buffers], [enable],
[ATRIP_MPI_STAGING_BUFFERS],
[Enable mpi staging buffers int the GPU code. Every source
will first be copied to this buffer and then subsequently
sent.
You should probably enable ATRIP_ALLOCATE_ADDITIONAL_FREE_POINTERS
since the additional buffers are free pointers and they might
run out, so dynamic allocation of free buffers is necessary.])
ATRIP_DEF([allocate-additional-free-pointers], [enable],
[ATRIP_ALLOCATE_ADDITIONAL_FREE_POINTERS],
[Enable the allocation of additional free buffers at runtime
if the free buffer pool runs empty.])
ATRIP_DEF([print-tuples], [enable],
[ATRIP_PRINT_TUPLES],
[Print the tuple energies for each (abc) tuple at then end of the run.])
dnl -----------------------------------------------------------------------
ATRIP_LDFLAGS="-L$PWD/src -latrip"
AC_SUBST(ATRIP_LDFLAGS)
dnl -----------------------------------------------------------------------
dnl CTF EXPORT ------------------------------------------------------------
dnl -----------------------------------------------------------------------
AM_CONDITIONAL([WITH_BUILD_CTF], [test x${BUILD_CTF} = xYES])
CTF_COMMIT="53ae5daad851bf3b198ebe1fa761c13b12291116"
AC_SUBST([CTF_COMMIT])
AC_SUBST(LIBCTF_PATH)
AC_SUBST(LIBCTF_CPATH)
AC_SUBST(LIBCTF_LD_LIBRARY_PATH)
dnl -----------------------------------------------------------------------
AC_MSG_NOTICE([
CHECKING YOUR OVERALL SYSTEM ...
])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl Guess compilers
AC_LANG([C++])
AC_MSG_NOTICE([
CHECKING COMPILERS...
])
AC_PROG_CXX
AX_MPI([], [AC_MSG_FAILURE([No MPI C++ compiler found.])])
AX_COMPILER_VENDOR
CXX="${MPICXX}"
ATRIP_MPI=$(${MPICXX} -show | awk '{$1=""; print $NL}' | sed "s/^ //")
AC_SUBST([ATRIP_MPI])
AM_PROG_AR
AC_PROG_CPP dnl sets variable CPP
AC_PROG_RANLIB dnl sets variable RANLIB
AC_PROG_INSTALL dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
AC_PROG_LN_S dnl sets variable LN_S
AC_PROG_MAKE_SET dnl set $(MAKE) if needed
AC_PROG_RANLIB dnl set variable RANLIB
AC_CHECK_TOOL([AR],[ar]) dnl set variable AR to appropriate `ar' program
dnl -----------------------------------------------------------------------
AC_OPENMP
AX_APPEND_COMPILE_FLAGS([-pedantic -Wall -Wpedantic -Wextra])
AX_APPEND_COMPILE_FLAGS([-pthread])
CXXFLAGS="${CXXFLAGS} ${OPENMP_CXXFLAGS}"
LDFLAGS="${LDFLAGS} ${OPENMP_CXXFLAGS}"
dnl -----------------------------------------------------------------------
AX_BLAS([LIBS="${LIBS} ${BLAS_LIBS}"],
[AC_MSG_FAILURE([Could not find BLAS library.])])
AX_LAPACK([LIBS="${LIBS} ${LAPACK_LIBS}"],
[AC_MSG_FAILURE([Could not find LAPACK library.])])
SISI_SCALAPACK([LIBS="${LIBS} ${SCALAPACK_LIBS}"],
[AC_MSG_FAILURE([could not find a working scalapack installation.])])
dnl -----------------------------------------------------------------------
dnl CXX checks
dnl
AX_CXX_STATIC_CAST
AX_CXX_TEMPLATES
AX_CXX_TYPENAME
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
AC_TYPE_SIZE_T
dnl -----------------------------------------------------------------------
dnl CHECK CTF
if test xYES = x${BUILD_CTF}; then
AC_MSG_WARN([
You will have to do make ctf before building the project.
])
else
CPPFLAGS="$CPPFLAGS -I${LIBCTF_CPATH}"
LDFLAGS="$LDFLAGS -L${LIBCTF_LD_LIBRARY_PATH} -lctf"
AC_CHECK_HEADER([ctf.hpp],
[],
[AC_MSG_ERROR([no ctf.hpp])])
fi
dnl CUDA NVIDIA -----------------------------------------------------------
AM_CONDITIONAL([WITH_CUDA], [test x${WITH_CUDA} = xyes])
if test x${WITH_CUDA} = xyes; then
AC_MSG_RESULT([
CUDA SUPPORT IS ENABLED (NVIDIA)
--------------------------------
])
AC_CHECK_PROGS([NVCC], [nvcc])
AC_SUBST([CUDA_LDFLAGS])
AC_DEFINE([HAVE_CUDA],1,[AMD CUDA support flag])
# TODO: make sure to find cuda and cudart
# AC_SEARCH_LIBS([cudaMalloc], [cuda cudart], [FOUND_CUDA=yes])
ATRIP_CUBLAS
fi
dnl HIP AMD -----------------------------------------------------------
AM_CONDITIONAL([WITH_HIP], [test x${WITH_HIP} = xyes])
if test x${WITH_HIP} = xyes; then
AC_MSG_RESULT([
HIP SUPPORT IS ENABLED AMD
--------------------------
])
AC_SUBST([HIPBLAS])
AC_CHECK_PROGS([HIPCC], [hipcc])
AC_SUBST([HIP_LDFLAGS])
CPPFLAGS="$CPPFLAGS -I$HIPBLAS/include"
LDFLAGS="$LDFLAGS -lamdhip64 -lhipblas"
AC_DEFINE([HAVE_HIP],1,[Wether we are using HIP])
AC_DEFINE([HOP_TARGET_HIP],1,[Wether we are using HIP])
fi
dnl PROFILER -----------------------------------------------------------
if test x${WITH_PROFILER} = xyes; then
AC_DEFINE([WITH_PROFILER],1,[Use profiler for HIP or CUDA])
AC_MSG_RESULT([
Checking profilers
------------------
])
if test x${WITH_HIP} = xyes; then
LDFLAGS="$LDFLAGS -L${PROFILER_PATH}/lib"
AC_CHECK_HEADER([omnitrace/user.h],
[],
[AC_MSG_ERROR([No omnitrace/user.h header library found, set the PROFILER_PATH variable maybe])])
AC_CHECK_LIB([omnitrace-user],
[omnitrace_user_push_region],
[],
[AC_MSG_ERROR([No omnitrace-user library found, set the PROFILER_PATH variable maybe])])
fi
fi
dnl HIP AMD -----------------------------------------------------------
if test x${WITH_CUDA} = xyes -o x${WITH_HIP} = xyes; then
WITH_ACC=yes
else
WITH_ACC=no
fi
AM_CONDITIONAL([WITH_ACC], [test x${WITH_ACC} = xyes])
if test x${WITH_ACC} = xyes; then
AC_DEFINE([HAVE_ACC],
1,
[Code with accelerator support])
fi
dnl -----------------------------------------------------------------------
dnl Docs
if test x${build_docs} = xYES; then
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AC_CHECK_PROGS([DOT], [dot])
AX_PROG_EMACS
AX_ELISP_CHECK_FEATURE([org])
AX_ELISP_CHECK_FBOUNDP([package-initialize], [package])
AX_ELISP_CHECK_FBOUNDP([package-install], [package])
AX_ELISP_CHECK_FBOUNDP([string-join], [subr-x])
AX_ELISP_CHECK_BOUNDP([org-babel-post-tangle-hook], [ob])
fi
dnl -----------------------------------------------------------------------
AC_CONFIG_FILES([Makefile
src/Makefile
.dir-locals.el:tools/dir-locals.el.in
bench/Makefile
extern/Makefile
extern/ctf/Makefile
test/Makefile
integration-tests/Makefile
integration-tests/run-h2o.sh
docs/Makefile
docs/conf.py:docs/conf.py
docs/Doxyfile:docs/Doxyfile
])
AC_CONFIG_HEADERS([config.h])
AC_MSG_RESULT([
AUTOMATIC CONFIGURATION
-----------------------
Vendor = $ax_cv_cxx_compiler_vendor
CXX = $CXX
MPICXX = $MPICXX
CXXFLAGS = $CXXFLAGS
CPPFLAGS = $CPPFLAGS
LDFLAGS = $LDFLAGS
ATRIP_LDFLAGS = $ATRIP_LDFLAGS
SCALAPACK = ${SCALAPACK_LIBS}
BLAS = ${BLAS_LIBS}
LIBS = ${LIBS}
])
AC_OUTPUT