forked from aws/aws-ofi-nccl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
157 lines (126 loc) · 5.35 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
# -*- Autoconf -*-
#
# Copyright (c) 2018-2023, Amazon.com, Inc. or its affiliates. All rights reserved.
#
# See LICENSE.txt for license information
#
# Initialization
AC_INIT([aws-ofi-nccl], [GitHub-dev], [al-ofi-nccl-team@amazon.com], , [http://github.com/aws/aws-ofi-nccl])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/nccl_ofi_net.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])
AM_SILENT_RULES([yes])
AH_TOP([/*
* Copyright (c) 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
*/
#ifndef NCCL_OFI_CONFIG_H
#define NCCL_OFI_CONFIG_H
])
AH_BOTTOM([
#include "nccl_ofi_config_bottom.h"
#endif /* NCCL_OFI_CONFIG_H */
])
dnl AX_CHECK_ENABLE_DEBUG must be called before AC_PROG_CC or
dnl AM_PROG_AR
AX_CHECK_ENABLE_DEBUG([no])
dnl AM_PROG_AR must be called before LT_INIT
AM_PROG_AR
LT_INIT([shared disable-static pic-only])
NCCL_NET_OFI_DISTCHCK_CONFIGURE_FLAGS=
# Checks for programs
AC_PROG_CC
AM_PROG_CC_C_O
m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
AC_C_INLINE
dnl ac_check_enable_debug will make sure AC_PROG_CC doesn't add a
dnl bunch of debugging flags, so there's no ordering requirement
dnl between this and AC_PROG_CC.
AS_IF([test "${ax_enable_debug}" = "no"], [CFLAGS="${CFLAGS} -O3"])
CHECK_ENABLE_SANITIZER()
# Checks for header files
AC_HEADER_STDBOOL
AS_IF([test "${ac_cv_header_stdbool_h}" = "no"],
[AC_MSG_ERROR([NCCL OFI Plugin requires stdbool.h])])
AC_CHECK_HEADER([limits.h], [], [AC_MSG_ERROR([NCCL OFI Plugin rquires limits.h])])
AC_CHECK_HEADER([stdlib.h], [], [AC_MSG_ERROR([NCCL OFI Plugin rquires stdlib.h])])
AC_CHECK_HEADER([string.h], [], [AC_MSG_ERROR([NCCL OFI Plugin rquires string.h])])
AC_CHECK_HEADER([unistd.h], [], [AC_MSG_ERROR([NCCL OFI Plugin rquires unistd.h])])
AC_CHECK_HEADERS([linux/limits.h])
# Checks for types
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT64_T
# Checks for library functions
AC_FUNC_MALLOC
AC_CHECK_FUNC([memset], [], [AC_MSG_ERROR([NCCL OFI Plugin requires memset function.])])
AC_CHECK_FUNC([realpath], [], [AC_MSG_ERROR([NCCL OFI Plugin requires realpath function.])])
AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([NCCL OFI Plugin requires dlopen])])
AC_SEARCH_LIBS([pthread_getspecific], [pthread], [], [AC_MSG_ERROR([NCCL OFI Plugin requires pthreads.])])
AC_SEARCH_LIBS([log2], [m], [], [AC_MSG_ERROR([NCCL OFI Plugin requires the log2 library function.])])
# Checks for external packages
CHECK_PKG_LIBFABRIC([], [AC_MSG_ERROR([NCCL OFI Plugin could not find a working Libfabric install.])])
CHECK_PKG_NVTX()
CHECK_PKG_LTTNG()
have_device_interface=no
CHECK_PKG_NEURON([AS_IF([test -n "${want_cuda}"],
[AC_MSG_ERROR([Cannot enable both CUDA and neuron.])],
[want_cuda=no])
have_device_interface=neuron])
CHECK_PKG_CUDA([have_device_interface=cuda])
AS_IF([test "${have_device_interface}" = "no"],
[AC_MSG_ERROR([NCCL OFI Plugin requires either CUDA or Neuron runtime.])])
CHECK_PKG_HWLOC([],
[AC_MSG_ERROR([Could not find the hwloc library. Use --with-hwloc to provide the path to non-standard hwloc installation.])])
CHECK_PKG_VALGRIND()
CHECK_VAR_REDZONE()
# do we want our tests?
CHECK_PKG_MPI([found_mpi="yes"], [found_mpi="no"])
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--disable-tests], [Disable build of functional test binaries])])
AS_IF([test "${enable_tests}" != "no" -a "${enable_neuron}" = "yes"],
[AC_MSG_WARN([Disabling tests due to Neuron configuration.])
enable_tests=no],
[test "${enable_tests}" = "yes" -a "${found_mpi}" = "no"],
[AC_MSG_ERROR([Tests requested, but MPI not found. Aborting.])],
[test "${found_mpi}" = "no"],
[AC_MSG_WARN([Disabling tests due to no MPI.])
enable_tests=no])
AM_CONDITIONAL([ENABLE_TESTS], [test "$enable_tests" != "no"])
# Enable output at the TRACE level for unit tests.
AC_ARG_ENABLE([trace],
[AS_HELP_STRING([--enable-trace], [Enable printing trace messages in test programs])])
AC_MSG_CHECKING([whether to enable trace messages])
AS_IF([test "${enable_trace}" = "yes" ],
[trace=1
AC_MSG_RESULT(yes)],
[trace=0
AC_MSG_RESULT(no)])
AC_DEFINE_UNQUOTED([OFI_NCCL_TRACE], [${trace}], [Defined to 1 unit test output should include TRACE level])
AC_ARG_ENABLE([picky-compiler],
[AS_HELP_STRING([--disable-picky-compiler], [Disable adding picky compiler flags.])])
AS_IF([test "${enable_picky_compiler}" != "no"],
[picky_compiler_flags="-Wall -Wc++-compat -Werror=c++-compat"
AC_MSG_NOTICE([Adding ${picky_compiler_flags} to CFLAGS.])
CFLAGS="${CFLAGS} ${picky_compiler_flags}"
AS_UNSET([picky_compiler_flags])])
NCCL_OFI_PLATFORM="none"
AS_IF([test "${NCCL_OFI_PLATFORM}" = "none"], [AX_CHECK_PLATFORM_AWS()])
AC_SUBST([NCCL_NET_OFI_DISTCHCK_CONFIGURE_FLAGS])
AS_IF([test "${valgrind_enabled}" = "1" -a "${enable_asan}" = "yes"],
[AC_MSG_ERROR([Enabling ASAN and valgrind at the same time is not permitted])])
AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile
tests/Makefile
tests/functional/Makefile
tests/unit/Makefile
topology/Makefile])
AC_OUTPUT
echo "*"
echo "* AWS OFI NCCL plugin has been configured."
echo "*"
echo "* Platform-specific optimizations: ${NCCL_OFI_PLATFORM}"
echo "*"