forked from linux-rdma/perftest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
executable file
·694 lines (609 loc) · 26 KB
/
configure.ac
File metadata and controls
executable file
·694 lines (609 loc) · 26 KB
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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# Copyright (C) 2001-2011 Mellanox Technologies Ltd. All rights reserved.
#
# This software is available to you under a choice of one of two
# licenses. You may choose to be licensed under the terms of the GNU
# General Public License (GPL) Version 2, available from the file
# COPYING in the main directory of this source tree, or the
# OpenIB.org BSD license below:
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# - Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# - Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
dnl Process this file with autoconf to produce a configure script.
AC_INIT([perftest],[6.29],[linux-rdma@vger.kernel.org])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_ARG_VAR(HAVE_OPENCL, opencl support)
AC_ARG_VAR(CUDA_H_PATH, help-string)
AC_ARG_ENABLE([cudart],
[AS_HELP_STRING([--enable-cudart],
[Enable CUDA runtime support (default: auto-detect)])
],
[],
[enable_cudart=check])
AC_ARG_VAR(RANLIB, ranlib tool)
AC_ARG_ENABLE([ibv_wr_api],
[AS_HELP_STRING([--disable-ibv_wr_api],
[Disable new post send API])])
AS_IF([test "x$enable_ibv_wr_api" = "xno"],
[USE_IBV_WR_API=no],
[USE_IBV_WR_API=yes])
AC_ARG_ENABLE([cq_ex],
[AS_HELP_STRING([--disable-cq_ex],
[Disable cq ex API])])
AS_IF([test "x$enable_cq_ex" = "xno"],
[USE_CQ_EX=no],
[USE_CQ_EX=yes])
AC_PREFIX_DEFAULT("/usr")
AC_PROG_CC
AC_PROG_CXX
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_RANLIB
AC_HEADER_STDC
AC_CHECK_HEADERS([infiniband/verbs.h],,[AC_MSG_ERROR([ibverbs header files not found])])
AC_CHECK_LIB([ibverbs], [ibv_get_device_list], [], [AC_MSG_ERROR([libibverbs not found])])
AC_CHECK_LIB([rdmacm], [rdma_create_event_channel], [], AC_MSG_ERROR([librdmacm-devel not found]))
AC_CHECK_LIB([ibumad], [umad_init], [LIBUMAD=-libumad], AC_MSG_ERROR([libibumad not found]))
AC_CHECK_LIB([m], [log], [LIBMATH=-lm], AC_MSG_ERROR([libm not found]))
AC_CHECK_LIB([ibverbs], [ibv_reg_dmabuf_mr], [HAVE_REG_DMABUF_MR=yes], [HAVE_REG_DMABUF_MR=no])
if test $HAVE_REG_DMABUF_MR = yes; then
AC_DEFINE([HAVE_REG_DMABUF_MR], [1], [Enable HAVE_REG_DMABUF_MR])
fi
AC_CHECK_LIB([ibverbs], [ibv_dm_export_dmabuf_fd], [HAVE_IB_DM_DMABUF=yes], [HAVE_IB_DM_DMABUF=no])
AM_CONDITIONAL([IB_DM_DMABUF], [test "x$HAVE_IB_DM_DMABUF" = "xyes"])
if test "x$HAVE_IB_DM_DMABUF" = "xyes"; then
AC_DEFINE([HAVE_IB_DM_DMABUF], [1], [Enable IB DM DMABUF export])
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[struct ibv_flow *t = ibv_create_flow(NULL,NULL);],[HAVE_RAW_ETH_REG=yes], [HAVE_RAW_ETH_REG=no])
AM_CONDITIONAL([HAVE_RAW_ETH_REG],[test "x$HAVE_RAW_ETH_REG" = "xyes"])
if test $HAVE_RAW_ETH_REG = yes; then
AC_DEFINE([HAVE_RAW_ETH_REG], [1], [Enable RAW_ETH_TEST_REG])
fi
AM_CONDITIONAL([HAVE_RAW_ETH],true)
if [test $HAVE_RAW_ETH_REG = yes]; then
AC_DEFINE([HAVE_RAW_ETH], [1], [Enable RAW_ETH_TEST])
else
AM_CONDITIONAL([HAVE_RAW_ETH],false)
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[struct ibv_xrcd *t = ibv_open_xrcd(NULL,NULL);],[HAVE_XRCD=yes], [HAVE_XRCD=no])
AM_CONDITIONAL([HAVE_XRCD],[test "x$HAVE_XRCD" = "xyes"])
if test $HAVE_XRCD = yes; then
AC_DEFINE([HAVE_XRCD], [1], [Enable XRCD feature])
fi
AC_TRY_LINK([
#if !defined(__FreeBSD__)
#include <endian.h>
#else
#include <sys/endian.h>
#endif],
[int x = htobe32(0);],[HAVE_ENDIAN=yes], [HAVE_ENDIAN=no])
AM_CONDITIONAL([HAVE_ENDIAN],[test "x$HAVE_ENDIAN" = "xyes"])
if test $HAVE_ENDIAN = yes; then
AC_DEFINE([HAVE_ENDIAN], [1], [Enable endian conversion])
fi
AC_TRY_LINK([],
[#if !defined(__FreeBSD__)
#error nope
#endif],
[IS_FREEBSD=yes], [IS_FREEBSD=no])
AM_CONDITIONAL([IS_FREEBSD],[test "x$IS_FREEBSD" = "xyes"])
if test $IS_FREEBSD = yes; then
AC_DEFINE([IS_FREEBSD], [1], [OS is FreeBSD])
LIBMLX5=-lmlx5
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[char *c = IBV_LINK_LAYER_SCIF;],[HAVE_SCIF=yes], [HAVE_SCIF=no])
AM_CONDITIONAL([HAVE_SCIF],[test "x$HAVE_SCIF" = "xyes"])
if test $HAVE_SCIF = yes; then
AC_DEFINE([HAVE_SCIF], [1], [Enable SCIF link Layer])
fi
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_QP_INIT_ATTR_SEND_OPS_FLAGS;],[HAVE_IBV_WR_API=yes],[HAVE_IBV_WR_API=no])
AM_CONDITIONAL([HAVE_IBV_WR_API],[test "x$HAVE_IBV_WR_API" = "xyes"])
# TODO: Add appropriate check. Currently we consider that if rdma-core
# has new post send, it also has ibv_query_gid_type
if [test $HAVE_IBV_WR_API = yes]; then
AC_DEFINE([HAVE_GID_TYPE], [1], [Have a way to check gid type])
fi
if [test $HAVE_IBV_WR_API = yes] && [test $USE_IBV_WR_API = yes]; then
AC_DEFINE([HAVE_IBV_WR_API], [1], [Have new post send API support])
else
HAVE_IBV_WR_API=no
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS;],[HAVE_MLX5DV=yes], [HAVE_MLX5DV=no])
AM_CONDITIONAL([HAVE_MLX5DV],[test "x$HAVE_MLX5DV" = "xyes"])
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = __devx_dw_off(32);],[HAVE_MLX5_DEVX=yes], [HAVE_MLX5_DEVX=no])
AM_CONDITIONAL([HAVE_MLX5_DEVX],[test "x$HAVE_MLX5_DEVX" = "xyes"])
if [test $HAVE_MLX5_DEVX = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_MLX5_DEVX], [1], [Have MLX5 DEVX support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_QP_INIT_ATTR_MASK_DCI_STREAMS;],[HAVE_DCS=yes], [HAVE_DCS=no])
AM_CONDITIONAL([HAVE_DCS],[test "x$HAVE_DCS" = "xyes"])
if [test $HAVE_DCS = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_DCS], [1], [Have DCS support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_CONTEXT_FLAGS_BLUEFLAME;],[HAVE_MLX5DV_BF_FLAG=yes], [HAVE_MLX5DV_BF_FLAG=no])
AM_CONDITIONAL([HAVE_MLX5DV_BF_FLAG],[test "x$HAVE_MLX5DV_BF_FLAG" = "xyes"])
if [test $HAVE_MLX5DV_BF_FLAG = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_MLX5DV_BF_FLAG], [1], [Have BF indication support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_CONTEXT_MASK_OOO_RECV_WRS;],[HAVE_OOO_RECV_WRS=yes], [HAVE_OOO_RECV_WRS=no])
AM_CONDITIONAL([HAVE_OOO_RECV_WRS],[test "x$HAVE_OOO_RECV_WRS" = "xyes"])
if [test $HAVE_OOO_RECV_WRS = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_OOO_RECV_WRS], [1], [Have DDP support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_REG_DMABUF_ACCESS_DATA_DIRECT;],[HAVE_DATA_DIRECT=yes], [HAVE_DATA_DIRECT=no])
AM_CONDITIONAL([HAVE_DATA_DIRECT],[test "x$HAVE_DATA_DIRECT" = "xyes"])
if [test $HAVE_DATA_DIRECT = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_DATA_DIRECT], [1], [Have Data Direct support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_CRYPTO_STANDARD_AES_XTS;],[HAVE_AES_XTS=yes], [HAVE_AES_XTS=no])
AM_CONDITIONAL([HAVE_AES_XTS],[test "x$HAVE_AES_XTS" = "xyes"])
if [test $HAVE_AES_XTS = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_AES_XTS], [1], [Have AES XTS support])
fi
AC_TRY_LINK([
#include <infiniband/mlx5dv.h>],
[int x = MLX5DV_CONTEXT_MASK_SIGNATURE_OFFLOAD;],[HAVE_SIG_OFFLOAD=yes], [HAVE_SIG_OFFLOAD=no])
AM_CONDITIONAL([HAVE_SIG_OFFLOAD],[test "x$HAVE_SIG_OFFLOAD" = "xyes"])
HAVE_SIG_OFFLOAD=no
if [test $HAVE_SIG_OFFLOAD = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_SIG_OFFLOAD], [1], [Have signutre offload support])
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[int c = IBV_GID_TYPE_ROCE_V1;],[HAVE_GID_TYPE_DECLARED=yes], [HAVE_GID_TYPE_DECLARED=no])
AM_CONDITIONAL([HAVE_GID_TYPE_DECLARED],[test "x$HAVE_GID_TYPE_DECLARED" = "xyes"])
if [test $HAVE_GID_TYPE_DECLARED = yes]; then
AC_DEFINE([HAVE_GID_TYPE_DECLARED], [1], [API GID compatibility])
fi
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_FLOW_SPEC_IPV6;],[HAVE_IPV6=yes], [HAVE_IPV6=no])
AM_CONDITIONAL([HAVE_IPV6],[test "x$HAVE_IPV6" = "xyes"])
if [test $HAVE_IPV6 = yes]; then
AC_DEFINE([HAVE_IPV6], [1], [Enable IPv6 Flow Specification])
fi
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_FLOW_SPEC_IPV4_EXT;],[HAVE_IPV4_EXT=yes], [HAVE_IPV4_EXT=no])
AM_CONDITIONAL([HAVE_IPV4_EXT],[test "x$HAVE_IPV4_EXT" = "xyes"])
if [test $HAVE_IPV4_EXT = yes]; then
AC_DEFINE([HAVE_IPV4_EXT], [1], [Enable IPv4 Extended Flow Specification])
fi
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_FLOW_ATTR_SNIFFER;],[HAVE_SNIFFER=yes], [HAVE_SNIFFER=no])
AM_CONDITIONAL([HAVE_SNIFFER],[test "x$HAVE_SNIFFER" = "xyes"])
if [test $HAVE_SNIFFER = yes]; then
AC_DEFINE([HAVE_SNIFFER], [1], [Enable Sniffer Flow Specification])
fi
if [test $IS_FREEBSD = no]; then
AC_CHECK_HEADERS([pci/pci.h],,[AC_MSG_ERROR([pciutils header files not found, consider installing pciutils-devel])])
AC_CHECK_LIB([pci], [pci_init], [LIBPCI=-lpci], AC_MSG_ERROR([libpci not found]))
CPU_IS_RO_COMPLIANT=yes
fi
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_ACCESS_RELAXED_ORDERING;],[HAVE_RO=yes], [HAVE_RO=no])
AM_CONDITIONAL([HAVE_RO],[test "x$HAVE_RO" = "xyes"])
if [test $HAVE_RO = yes] && [test "x$CPU_IS_RO_COMPLIANT" = "xyes"]; then
AC_DEFINE([HAVE_RO], [1], [Enable Relaxed Ordering])
LIBS=$LIBS" -lpci"
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[struct ibv_device_attr_ex *attr_ex; int x = attr_ex->comp_mask;],[HAVE_EX=yes], [HAVE_EX=no])
AM_CONDITIONAL([HAVE_EX],[test "x$HAVE_EX" = "xyes"])
if [test $HAVE_EX = yes]; then
AC_DEFINE([HAVE_EX], [1], [Have EX support])
fi
AC_ARG_ENABLE([rocm],
[AS_HELP_STRING([--enable-rocm],
[Enable ROCm benchmarks])
],
[],
[enable_rocm=no])
AC_ARG_ENABLE([rocm_dmabuf],
[AS_HELP_STRING([--enable-rocm-dmabuf],
[Enable ROCm DMABUF feature])
],
[],
[enable_rocm_dmabuf=no])
AC_ARG_WITH([rocm],
[AS_HELP_STRING([--with-rocm=@<:@ROCm installation path@:>@],
[Provide path to ROCm installation])
],
[AS_CASE([$with_rocm],
[yes|no], [],
[CPPFLAGS="-I$with_rocm/include -I$with_rocm/include/hsa $CPPFLAGS"
LDFLAGS="-L$with_rocm/lib64 -Wl,-rpath=$with_rocm/lib64 -L$with_rocm/lib -Wl,-rpath=$with_rocm/lib -lamdhip64 -lhsa-runtime64 $LDFLAGS"])
])
AS_IF([test "x$enable_rocm" = xyes], [
AC_DEFINE([__HIP_PLATFORM_AMD__], [1], [Enable ROCm])
AC_CHECK_HEADERS([hip/hip_runtime_api.h], [],
[AC_MSG_ERROR([cannot include hip/hip_runtime_api.h])])
AC_CHECK_HEADERS([hip/hip_version.h], [],
[AC_MSG_ERROR([cannot include hip_version.h])])
AC_SEARCH_LIBS([hipFree], [amdhip64], [],
[AC_MSG_ERROR([cannot link with -lamdhip64])])
AC_DEFINE([HAVE_ROCM], [1], [Enable ROCm])
])
AM_CONDITIONAL([ROCM], [test x$enable_rocm = xyes])
AS_IF([test "x$enable_rocm_dmabuf" = xyes], [
AS_IF([test "x$HAVE_REG_DMABUF_MR" = "xno"],
[AC_MSG_ERROR([rdma-core doesn't support dmabuf mr registration])])
AS_IF([test "x$enable_rocm" = "xno"],
[AC_MSG_ERROR([rocm not enabled/supported])])
AC_CHECK_HEADERS([hsa/hsa_ext_amd.h], [],
[AC_MSG_ERROR([cannot include hsa/hsa_ext_amd.h])])
AC_SEARCH_LIBS([hsa_amd_portable_export_dmabuf], [hsa-runtime64], [],
[AC_MSG_ERROR([cannot link with -lhsa-runtime64])])
AC_DEFINE([HAVE_ROCM_DMABUF], [1], [Enable ROCm DMABUF feature])
])
AC_TRY_LINK([
#include <infiniband/verbs.h>],
[int x = IBV_ACCESS_ON_DEMAND;],[HAVE_EX_ODP=yes], [HAVE_EX_ODP=no])
AM_CONDITIONAL([HAVE_EX_ODP],[test "x$HAVE_EX_ODP" = "xyes"])
if [test $HAVE_EX_ODP = yes] && [test $HAVE_EX = yes]; then
AC_DEFINE([HAVE_EX_ODP], [1], [Have Extended ODP support])
fi
AC_CHECK_LIB([dl], [dlclose],
[AC_MSG_RESULT([libdl found])
LIBS="$LIBS -ldl"],
[AC_MSG_ERROR([libdl not found. You need to install libdl for dynamic loading support])])
# Check for CUDA header file in common location
AC_MSG_CHECKING([for CUDA header file])
cuda_found=no
cuda_h_path=""
if test -f "/usr/local/cuda/include/cuda.h"; then
cuda_h_path="/usr/local/cuda/include/cuda.h"
cuda_found=yes
AC_MSG_RESULT([found at $cuda_h_path])
fi
# User defined cuda header path
if test -f "$CUDA_H_PATH"; then
cuda_h_path="$CUDA_H_PATH"
cuda_found=yes
AC_MSG_RESULT([found at $cuda_h_path])
fi
if test "$cuda_found" = "yes"; then
AC_DEFINE([HAVE_CUDA], [1], [Enable CUDA feature])
AC_DEFINE_UNQUOTED([CUDA_PATH], "$cuda_h_path" , [Enable CUDA feature])
AC_CHECK_LIB([cuda], [cuMemGetHandleForAddressRange], [HAVE_CUDA_CUMEMGETHANDLEFORADDRESSRANGE=yes], [HAVE_CUDA_CUMEMGETHANDLEFORADDRESSRANGE=no])
cuda_toolkit_version=`grep "define CUDA_VERSION" $cuda_h_path | cut -d' ' -f3`
AC_DEFINE_UNQUOTED([CUDA_VER], [$cuda_toolkit_version], [Define CUDA_VER])
AC_TRY_LINK([
#include <$cuda_h_path>],
[int x = CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD|CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED;],
[CUDA_DMA_BUF_PARAMETERS_SUPPORT=yes], [CUDA_DMA_BUF_PARAMETERS_SUPPORT=no])
if [test "x$HAVE_REG_DMABUF_MR" = "xyes"] && [test "x$HAVE_CUDA_CUMEMGETHANDLEFORADDRESSRANGE" = "xyes"] && [test "x$CUDA_DMA_BUF_PARAMETERS_SUPPORT" = "xyes"]; then
HAVE_CUDA_DMABUF=yes
AC_DEFINE([HAVE_CUDA_DMABUF], [1], [Enable CUDA DMABUF feature])
fi
AC_TRY_LINK([
#include <$cuda_h_path>],
[int x = CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE;],
[CUDA_DMA_BUF_MAPPING_TYPE_PCIE_SUPPORT=yes], [CUDA_DMA_BUF_MAPPING_TYPE_PCIE_SUPPORT=no])
if [test "x$CUDA_DMA_BUF_MAPPING_TYPE_PCIE_SUPPORT" = "xyes"] && [test "x$HAVE_REG_DMABUF_MR" = "xyes"]; then
AC_DEFINE([HAVE_DMABUF_MAPPING_TYPE_PCIE], [1], [Enable CUDA DMABUF handle mapping via PCIe BAR1])
fi
if [test "x$enable_cudart" != "xno"]; then
CUDA_TOOLKIT_PATH=$(dirname $(dirname $cuda_h_path))
CUDA_LIB_DIR=$(dirname $(dirname $cuda_h_path))/lib64
if [test ! -d "$CUDA_LIB_DIR"]; then
CUDA_LIB_DIR=$(dirname $(dirname $cuda_h_path))/lib
fi
# Probe for libcudart (don't pollute LIBS — only the plugin links it)
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="-L$CUDA_LIB_DIR $LDFLAGS"
AC_CHECK_LIB([cudart], [cudaMalloc], [have_cudart_lib=yes], [have_cudart_lib=no])
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
if [test "x$have_cudart_lib" = "xyes"]; then
enable_cudart=yes
elif [test "x$enable_cudart" = "xyes"]; then
AC_MSG_ERROR([--enable-cudart was given but libcudart not found])
else
AC_MSG_NOTICE([libcudart not found — GPU validation kernel will not be built])
enable_cudart=no
fi
fi
if [test "x$enable_cudart" = "xyes"]; then
AC_DEFINE([HAVE_CUDART], [1], [Enable CUDART features])
LIBS=$LIBS" -lstdc++"
CPPFLAGS="-I$(dirname $cuda_h_path)/include $CPPFLAGS"
LDFLAGS="-L$CUDA_LIB_DIR $LDFLAGS"
if [test "x${gpu_arch}" != "x"]; then
NVCCFLAGS="${NVCCFLAGS} -arch compute_${gpu_arch} -code compute_${gpu_arch},sm_${gpu_arch}"
AC_MSG_NOTICE([Setting GPU_ARCH = ${gpu_arch}])
fi
NVCCFLAGS="${NVCCFLAGS} -Xcompiler -fpermissive"
AC_CHECK_DECLS([CUDA_VERSION], [HAVE_CUDA_VERSION=yes], [HAVE_CUDA_VERSION=no], [[#include "$cuda_h_path"]])
if [test "x$HAVE_CUDA_VERSION" = "xyes"]; then
AS_VERSION_COMPARE([$cuda_toolkit_version], [11070], [HAVE_CUDA_DIAGSUPPRESS=no], [HAVE_CUDA_DIAGSUPPRESS=yes], [HAVE_CUDA_DIAGSUPPRESS=yes])
if [test "x$HAVE_CUDA_DIAGSUPPRESS" = "xyes"]; then
NVCCFLAGS="${NVCCFLAGS} -Xcompiler -fpermissive -diag-suppress 2464 -diag-suppress 815"
else
NVCCFLAGS="${NVCCFLAGS} -Xcompiler -fpermissive"
fi
fi
AC_DEFINE_UNQUOTED([CUDA_TOOLKIT_PATH], "$CUDA_TOOLKIT_PATH", [Path to the CUDA Toolkit])
AC_SUBST([NVCCFLAGS], ["${NVCCFLAGS}"])
AC_SUBST([NVCC], ["$CUDA_TOOLKIT_PATH/bin/nvcc"])
AC_SUBST([CUDA_LIB_DIR], ["$CUDA_LIB_DIR"])
AC_MSG_NOTICE([CUDA runtime support enabled — will build GPU validation kernel])
fi
else
if [test "x$enable_cudart" = "xyes"]; then
AC_MSG_ERROR([--enable-cudart was given but CUDA headers not found])
fi
enable_cudart=no
fi
AM_CONDITIONAL([CUDA_DMA_BUF_PARAMETERS_SUPPORT],[test "x$CUDA_DMA_BUF_PARAMETERS_SUPPORT" = "xyes"])
AM_CONDITIONAL([CUDA_DMA_BUF_MAPPING_TYPE_PCIE_SUPPORT],[test "x$CUDA_DMA_BUF_MAPPING_TYPE_PCIE_SUPPORT" = "xyes"])
AM_CONDITIONAL([CUDA], [test "$cuda_h_path"])
AM_CONDITIONAL([HAVE_CUDA], [test "$cuda_h_path"])
AM_CONDITIONAL([HAVE_CUDART], [test "x$enable_cudart" = "xyes"])
AC_ARG_ENABLE([neuron],
[AS_HELP_STRING([--enable-neuron],
[Enable Neuron benchmarks])
],
[],
[enable_neuron=no])
AC_ARG_WITH([neuron],
[AS_HELP_STRING([--with-neuron=@<:@NRT installation path@:>@],
[Provide path to NRT installation])
],
[AS_CASE([$with_neuron],
[yes|no], [],
[CPPFLAGS="-I$with_neuron/include $CPPFLAGS"
LDFLAGS="-L$with_neuron/lib -Wl,-rpath=$with_neuron/lib $LDFLAGS"])
])
AS_IF([test "x$enable_neuron" = xyes], [
AC_DEFINE([HAVE_NEURON], [1], [Enable Neuron benchmarks])
AC_CHECK_HEADERS([nrt/nrt.h], [],
[AC_MSG_ERROR([could not find nrt.h in include path])])
AC_SEARCH_LIBS([nrt_tensor_allocate], [nrt], [],
[AC_MSG_ERROR([could not find library, nrt])])
AC_SEARCH_LIBS([nrt_get_dmabuf_fd], [nrt],
[AC_DEFINE([HAVE_NEURON_DMABUF], [1], [Enable Neuron DMA buffers])],
[])
])
AM_CONDITIONAL([NEURON], [test x$enable_neuron = xyes])
AC_ARG_ENABLE([hl],
[AS_HELP_STRING([--enable-hl],
[Enable Habana Labs benchmarks])
],
[],
[enable_hl=no])
AC_ARG_WITH([hl],
[AS_HELP_STRING([--with-hl=@<:@habanalabs installation prefix@:>@],
[Provide Habana Labs installation prefix])
],
[AS_CASE([$with_hl],
[yes|no], [],
[CPPFLAGS="-I$with_hl/include/habanalabs -I/usr/include/drm -I/usr/include/libdrm $CPPFLAGS"
LDFLAGS="-L$with_hl/lib/habanalabs -Wl,-rpath=$with_hl/lib/habanalabs $LDFLAGS"])
])
AS_IF([test "x$enable_hl" = xyes], [
AC_DEFINE([HAVE_HL], [1], [Enable Habana Labs benchmarks])
AS_IF([test "x$HAVE_REG_DMABUF_MR" = "xno"],
[AC_MSG_ERROR([rdma-core doesn't support dmabuf mr registration])])
AC_CHECK_HEADERS([misc/habanalabs.h hlthunk.h synapse_api.h], [],
[AC_MSG_ERROR([could not find hl headers in include path])])
AC_SEARCH_LIBS([hlthunk_device_memory_export_dmabuf_fd], [hl-thunk], [],
[AC_MSG_ERROR([could not find library, hl-thunk])])
AC_SEARCH_LIBS([synDeviceMalloc], [Synapse], [],
[AC_MSG_ERROR([could not find library, Synapse])])
])
AM_CONDITIONAL([HABANALABS], [test x$enable_hl = xyes])
AC_ARG_ENABLE([mlu],
[AS_HELP_STRING([--enable-mlu],
[Enable MLU benchmarks])
],
[],
[enable_mlu=no])
AC_ARG_WITH([mlu],
[AS_HELP_STRING([--with-mlu=@<:@MLU installation path@:>@],
[Provide path to MLU installation])
],
[AS_CASE([$with_mlu],
[yes|no], [],
[CPPFLAGS="-I$with_mlu/include $CPPFLAGS"
LDFLAGS="-L$with_mlu/lib64 -Wl,-rpath=$with_mlu/lib64 -lcndrv $LDFLAGS"])
])
AS_IF([test "x$enable_mlu" = xyes], [
AC_DEFINE([HAVE_MLU], [1], [Enable MLU benchmarks])
AC_CHECK_HEADERS([cn_api.h], [],
[AC_MSG_ERROR([could not find cn_api.h in include path])])
AC_SEARCH_LIBS([cnMalloc], [cndrv], [],
[AC_MSG_ERROR([could not find library, cndrv])])
AC_SEARCH_LIBS([cnMemGetHandleForAddressRange], [cndrv],
[AC_DEFINE([HAVE_MLU_DMABUF], [1], [Enable MLU DMA buffers])],
[])
])
AM_CONDITIONAL([MLU], [test x$enable_mlu = xyes])
AC_TRY_LINK([#include <infiniband/verbs.h>],
[struct ibv_qp_attr *attr; int x = attr->rate_limit;],[HAVE_PACKET_PACING=yes], [HAVE_PACKET_PACING=no])
AM_CONDITIONAL([HAVE_PACKET_PACING],[test "x$HAVE_PACKET_PACING" = "xyes"])
if [test $HAVE_PACKET_PACING = yes]; then
AC_DEFINE([HAVE_PACKET_PACING], [1], [Have PACKET_PACING support])
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[int x = IBV_OOO_RW_DATA_PLACEMENT;], [HAVE_OOO_ATTR=yes], [HAVE_OOO_ATTR=no])
AM_CONDITIONAL([HAVE_OOO_ATTR], [test "x$HAVE_OOO_ATTR" = "xyes"])
if [test $HAVE_OOO_ATTR = yes]; then
AC_DEFINE([HAVE_OOO_ATTR], [1], [Have Out of order data placement support])
fi
if [test $HAVE_IBV_WR_API = yes]; then
AC_CHECK_LIB([efa], [efadv_create_qp_ex], [HAVE_SRD=yes], [HAVE_SRD=no])
AC_TRY_LINK([#include <infiniband/efadv.h>],
[int x = EFADV_DEVICE_ATTR_CAPS_RDMA_READ;], [HAVE_RDMA_READ_SRD=yes], [HAVE_RDMA_READ_SRD=no])
if [test $HAVE_RDMA_READ_SRD = yes]; then
AC_DEFINE([HAVE_SRD_WITH_RDMA_READ], [1], [Have SRD with RDMA read support])
fi
AC_TRY_LINK([#include <infiniband/efadv.h>],
[int x = EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE;], [HAVE_RDMA_WRITE_SRD=yes], [HAVE_RDMA_WRITE_SRD=no])
if [test $HAVE_RDMA_WRITE_SRD = yes]; then
AC_DEFINE([HAVE_SRD_WITH_RDMA_WRITE], [1], [Have SRD with RDMA write support])
fi
AC_TRY_LINK([#include <infiniband/efadv.h>],
[int x = EFADV_DEVICE_ATTR_CAPS_UNSOLICITED_WRITE_RECV;], [HAVE_UNSOLICITED_WRITE_RECV_SRD=yes], [HAVE_UNSOLICITED_WRITE_RECV_SRD=no])
if [test $HAVE_UNSOLICITED_WRITE_RECV_SRD = yes]; then
AC_DEFINE([HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV], [1], [Have SRD with unsolicited RDMA write with imm. support])
fi
AC_TRY_LINK([#include <infiniband/efadv.h>],
[struct efadv_qp_init_attr *efa_attr; int x = efa_attr->sl;], [HAVE_SRD_QP_SL_SUPPORT=yes], [HAVE_SRD_QP_SL_SUPPORT=no])
if [test $HAVE_SRD_QP_SL_SUPPORT = yes]; then
AC_DEFINE([HAVE_SRD_QP_SL], [1], [Have SRD QP SL support])
fi
else
AC_CHECK_LIB([efa], [efadv_create_driver_qp], [HAVE_SRD=yes], [HAVE_SRD=no])
fi
AM_CONDITIONAL([HAVE_SRD], [test "x$HAVE_SRD" = "xyes"])
if [test $HAVE_SRD = yes]; then
AC_DEFINE([HAVE_SRD], [1], [Have SRD support])
AC_SUBST([LIBEFA], [-lefa])
fi
AC_CHECK_LIB([mlx5], [mlx5dv_create_qp], [HAVE_MLX5DV_LIB=yes LIBMLX5=-lmlx5], [HAVE_MLX5DV_LIB=no])
AM_CONDITIONAL([HAVE_MLX5DV_LIB], [test "x$HAVE_MLX5DV_LIB" = "xyes"])
if [test $HAVE_MLX5DV_LIB = yes] && [test $HAVE_MLX5DV = yes]; then
AC_DEFINE([HAVE_MLX5DV], [1], [Have Direct Verbs support])
AC_SUBST([LIBMLX5])
fi
AC_CHECK_LIB([hns], [hnsdv_query_device], [HAVE_HNSDV=yes LIBHNS=-lhns], [HAVE_HNSDV=no])
AM_CONDITIONAL([HAVE_HNSDV], [test "x$HAVE_HNSDV" = "xyes"])
if [test $HAVE_HNSDV = yes]; then
AC_DEFINE([HAVE_HNSDV], [1], [Have hns Direct Verbs support])
AC_SUBST([LIBHNS])
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[ibv_cq_ex_to_cq], [HAVE_CQ_EX=yes], [HAVE_CQ_EX=no])
AM_CONDITIONAL([HAVE_CQ_EX], [test "x$HAVE_CQ_EX" = "xyes"])
if [test $HAVE_CQ_EX = yes] && [test $USE_CQ_EX = yes]; then
AC_DEFINE([HAVE_CQ_EX], [1], [Have CQ EX API support])
else
HAVE_CQ_EX=no
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[ibv_alloc_td], [HAVE_TD_API=yes], [HAVE_TD_API=no])
AM_CONDITIONAL([HAVE_TD_API], [test "x$HAVE_TD_API" = "xyes"])
if [test $HAVE_TD_API = yes]; then
AC_DEFINE([HAVE_TD_API], [1], [Have TD API support])
fi
AC_TRY_LINK([#include <infiniband/verbs.h>],
[ibv_reg_mr_ex], [HAVE_REG_MR_EX=yes], [HAVE_REG_MR_EX=no])
AM_CONDITIONAL([HAVE_REG_MR_EX], [test "x$HAVE_REG_MR_EX" = "xyes"])
if [test $HAVE_REG_MR_EX = yes]; then
AC_DEFINE([HAVE_REG_MR_EX], [1], [Have reg mr extended API support])
fi
# Check for SIMD support (for host data validation)
AC_MSG_CHECKING([for AVX2 support])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mavx2"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <immintrin.h>
int main() {
__m256i v = _mm256_setzero_si256();
__m256i r = _mm256_cmpeq_epi8(v, v);
(void)r;
return 0;
}]])],
[HAVE_AVX2=yes
AC_DEFINE([HAVE_AVX2], [1], [Have AVX2 SIMD support])
SIMD_CFLAGS="-mavx2"
AC_MSG_RESULT([yes])],
[HAVE_AVX2=no
AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
if test "$HAVE_AVX2" = "no"; then
AC_MSG_CHECKING([for SSE4.2 support])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -msse4.2"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <nmmintrin.h>
int main() {
__m128i v = _mm_setzero_si128();
__m128i r = _mm_cmpeq_epi8(v, v);
(void)r;
return 0;
}]])],
[HAVE_SSE42=yes
AC_DEFINE([HAVE_SSE42], [1], [Have SSE4.2 SIMD support])
SIMD_CFLAGS="-msse4.2"
AC_MSG_RESULT([yes])],
[HAVE_SSE42=no
AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
fi
# Check for ARM NEON support
AC_MSG_CHECKING([for ARM NEON support])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <arm_neon.h>
int main() {
uint8x16_t v = vdupq_n_u8(0);
uint8x16_t r = vceqq_u8(v, v);
(void)r;
return 0;
}]])],
[HAVE_NEON=yes
AC_DEFINE([HAVE_NEON], [1], [Have ARM NEON SIMD support])
AC_MSG_RESULT([yes])],
[HAVE_NEON=no
AC_MSG_RESULT([no])])
AC_SUBST([SIMD_CFLAGS])
CFLAGS="-g -Wall -D_GNU_SOURCE -O3 $CFLAGS"
LDFLAGS="$LDFLAGS"
LIBS=$LIBS" -lpthread"
AM_CONDITIONAL([OPENCL], [test "$HAVE_OPENCL"])
if [test $HAVE_OPENCL = yes]; then
AC_DEFINE([HAVE_OPENCL], [1], [Enable OPENCL feature])
AC_CHECK_LIB([OpenCL], [clGetDeviceIDs], [], [AC_MSG_ERROR([libOpenCL not found])])
fi
AC_SUBST([LIBUMAD])
AC_SUBST([LIBMATH])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_COMMANDS([man], [${MKDIR_P} man])
AC_OUTPUT