|
21 | 21 | # LDFLAGS, LIBS} as needed and runs action-if-found if there is
|
22 | 22 | # support, otherwise executes action-if-not-found
|
23 | 23 | AC_DEFUN([OMPI_CHECK_UCX],[
|
24 |
| - OPAL_VAR_SCOPE_PUSH([ompi_check_ucx_dir]) |
| 24 | + OPAL_VAR_SCOPE_PUSH([ompi_check_ucx_happy ompi_check_ucx_CPPFLAGS_save ompi_check_ucx_LDFLAGS_save ompi_check_ucx_LIBS_save]) |
25 | 25 |
|
26 |
| - AS_IF([test -z "$ompi_check_ucx_happy"], |
27 |
| - [AC_ARG_WITH([ucx], |
28 |
| - [AS_HELP_STRING([--with-ucx(=DIR)], |
29 |
| - [Build with Unified Communication X library support])]) |
30 |
| - OPAL_CHECK_WITHDIR([ucx], [$with_ucx], [include/ucp/api/ucp.h]) |
31 |
| - AC_ARG_WITH([ucx-libdir], |
32 |
| - [AS_HELP_STRING([--with-ucx-libdir=DIR], |
33 |
| - [Search for Unified Communication X libraries in DIR])]) |
34 |
| - OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*]) |
| 26 | + m4_ifblank([$1], [m4_fatal([First argument to OMPI_CHECK_UCX cannot be blank])]) |
35 | 27 |
|
36 |
| - AS_IF([test "$with_ucx" != "no"], |
37 |
| - [AS_IF([test -n "$with_ucx" && test "$with_ucx" != "yes"], |
38 |
| - [ompi_check_ucx_dir="$with_ucx"], |
39 |
| - [PKG_CHECK_MODULES_STATIC([ucx],[ucx], |
40 |
| - [ompi_check_ucx_dir=`$PKG_CONFIG --variable=prefix ucx` |
41 |
| - AS_IF([test "$ompi_check_ucx_dir" = "/usr"], |
42 |
| - [ompi_check_ucx_dir=])], |
43 |
| - [true])]) |
44 |
| - ompi_check_ucx_happy="no" |
45 |
| - AS_IF([test -z "$ompi_check_ucx_dir"], |
46 |
| - [OPAL_CHECK_PACKAGE([ompi_check_ucx], |
47 |
| - [ucp/api/ucp.h], |
48 |
| - [ucp], |
49 |
| - [ucp_cleanup], |
50 |
| - [-luct -lucm -lucs], |
51 |
| - [], |
52 |
| - [], |
53 |
| - [ompi_check_ucx_happy="yes"], |
54 |
| - [ompi_check_ucx_happy="no"]) |
55 |
| - AS_IF([test "$ompi_check_ucx_happy" = yes], |
56 |
| - [AC_MSG_CHECKING(for UCX version compatibility) |
57 |
| - AC_REQUIRE_CPP |
58 |
| - AC_COMPILE_IFELSE( |
59 |
| - [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
60 |
| - [ompi_check_ucx_happy="yes"], |
61 |
| - [ompi_check_ucx_happy="no"]) |
| 28 | + AC_ARG_WITH([ucx], |
| 29 | + [AS_HELP_STRING([--with-ucx(=DIR)], |
| 30 | + [Build with Unified Communication X library support])]) |
| 31 | + AC_ARG_WITH([ucx-libdir], |
| 32 | + [AS_HELP_STRING([--with-ucx-libdir=DIR], |
| 33 | + [Search for Unified Communication X libraries in DIR])]) |
62 | 34 |
|
63 |
| - AC_MSG_RESULT([$ompi_check_ucx_happy])]) |
64 |
| - AS_IF([test "$ompi_check_ucx_happy" = "no"], |
65 |
| - [ompi_check_ucx_dir=/opt/ucx])]) |
66 |
| - AS_IF([test "$ompi_check_ucx_happy" != yes], |
67 |
| - [AS_IF([test -n "$with_ucx_libdir"], |
68 |
| - [ompi_check_ucx_libdir="$with_ucx_libdir"], |
69 |
| - [files=`ls $ompi_check_ucx_dir/lib64/libucp.* 2> /dev/null | wc -l` |
70 |
| - AS_IF([test "$files" -gt 0], |
71 |
| - [ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib64], |
72 |
| - [ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib])]) |
| 35 | + OAC_CHECK_PACKAGE([ucx], |
| 36 | + [$1], |
| 37 | + [ucp/api/ucp.h], |
| 38 | + [ucp -luct -lucm -lucs], |
| 39 | + [ucp_cleanup], |
| 40 | + [ompi_check_ucx_happy="yes"], |
| 41 | + [ompi_check_ucx_happy="no"]) |
73 | 42 |
|
74 |
| - ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS" |
75 |
| - ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS" |
76 |
| - ompi_check_ucx_$1_save_LIBS="$LIBS" |
| 43 | + ompi_check_ucx_CPPFLAGS_save=${CPPFLAGS} |
| 44 | + ompi_check_ucx_LDLAGS_save=${LDFLAGS} |
| 45 | + ompi_check_ucx_LIBS_save=${LIBS} |
77 | 46 |
|
78 |
| - OPAL_CHECK_PACKAGE([ompi_check_ucx], |
79 |
| - [ucp/api/ucp.h], |
80 |
| - [ucp], |
81 |
| - [ucp_cleanup], |
82 |
| - [-luct -lucm -lucs], |
83 |
| - [$ompi_check_ucx_dir], |
84 |
| - [$ompi_check_ucx_libdir], |
85 |
| - [ompi_check_ucx_happy="yes"], |
86 |
| - [ompi_check_ucx_happy="no"]) |
| 47 | + OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${$1_CPPFLAGS}]) |
| 48 | + OPAL_FLAGS_APPEND_UNIQ([LDFLAGS], [${$1_LDFLAGS}]) |
| 49 | + OPAL_FLAGS_APPEND_MOVE([LIBS], [${$1_LIBS}]) |
87 | 50 |
|
88 |
| - CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS" |
89 |
| - LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS" |
90 |
| - LIBS="$ompi_check_ucx_$1_save_LIBS" |
| 51 | + AS_IF([test "$ompi_check_ucx_happy" = yes], |
| 52 | + [AC_CACHE_CHECK([for UCX version header], |
| 53 | + [ompi_check_ucx_cv_have_version_header], |
| 54 | + [AC_REQUIRE_CPP |
| 55 | + AC_COMPILE_IFELSE( |
| 56 | + [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
| 57 | + [ompi_check_ucx_cv_have_version_header="yes"], |
| 58 | + [ompi_check_ucx_cv_have_version_header="no"])]) |
| 59 | + AS_IF([test "${ompi_check_ucx_cv_have_version_header}" != "yes"], |
| 60 | + [ompi_check_ucx_happy=no])]) |
91 | 61 |
|
92 |
| - AS_IF([test "$ompi_check_ucx_happy" = yes], |
93 |
| - [AC_MSG_CHECKING(for UCX version compatibility) |
94 |
| - AC_REQUIRE_CPP |
95 |
| - old_CPPFLAGS="$CPPFLAGS" |
96 |
| - CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include" |
97 |
| - AC_COMPILE_IFELSE( |
98 |
| - [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
99 |
| - [ompi_check_ucx_happy="yes"], |
100 |
| - [ompi_check_ucx_happy="no"]) |
| 62 | + AS_IF([test "$ompi_check_ucx_happy" = yes], |
| 63 | + [# Turn off UCX version v1.8 due to issue #8321 |
| 64 | + AC_CACHE_CHECK([UCX version 1.8.x], |
| 65 | + [ompi_check_ucx_cv_have_version_1_8], |
| 66 | + [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ |
| 67 | +#include <ucp/api/ucp_version.h> |
| 68 | + ]], [[ |
| 69 | +#if (UCP_API_MAJOR == 1) && (UCP_API_MINOR == 8) |
| 70 | +#error "Invalid version" |
| 71 | +#endif |
| 72 | + ]])], |
| 73 | + [ompi_check_ucx_cv_have_version_1_8=no], |
| 74 | + [ompi_check_ucx_cv_have_version_1_8=yes])]) |
| 75 | + AS_IF([test "${ompi_check_ucx_cv_have_version_1_8}" = "yes"], |
| 76 | + [AC_MSG_WARN([UCX support skipped because version 1.8.x was found, which has a known catastrophic issue.]) |
| 77 | + AC_MSG_WARN([Please upgrade to UCX version 1.9 or higher.]) |
| 78 | + ompi_check_ucx_happy=no])]) |
101 | 79 |
|
102 |
| - AC_MSG_RESULT([$ompi_check_ucx_happy]) |
103 |
| - CPPFLAGS=$old_CPPFLAGS])]) |
| 80 | + AS_IF([test "$ompi_check_ucx_happy" = yes], |
| 81 | + [AC_CHECK_DECLS([ucp_tag_send_nbr], |
| 82 | + [AC_DEFINE([HAVE_UCP_TAG_SEND_NBR],[1], |
| 83 | + [have ucp_tag_send_nbr()])], [], |
| 84 | + [#include <ucp/api/ucp.h>]) |
| 85 | + AC_CHECK_DECLS([ucp_ep_flush_nb, ucp_worker_flush_nb, |
| 86 | + ucp_request_check_status, ucp_put_nb, ucp_get_nb, |
| 87 | + ucp_put_nbx, ucp_get_nbx, ucp_atomic_op_nbx, |
| 88 | + ucp_ep_flush_nbx], |
| 89 | + [], [], |
| 90 | + [#include <ucp/api/ucp.h>]) |
| 91 | + AC_CHECK_DECLS([ucm_test_events, |
| 92 | + ucm_test_external_events], |
| 93 | + [], [], |
| 94 | + [#include <ucm/api/ucm.h>]) |
| 95 | + AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND, |
| 96 | + UCP_ATOMIC_POST_OP_OR, |
| 97 | + UCP_ATOMIC_POST_OP_XOR, |
| 98 | + UCP_ATOMIC_FETCH_OP_FAND, |
| 99 | + UCP_ATOMIC_FETCH_OP_FOR, |
| 100 | + UCP_ATOMIC_FETCH_OP_FXOR, |
| 101 | + UCP_PARAM_FIELD_ESTIMATED_NUM_PPN, |
| 102 | + UCP_WORKER_FLAG_IGNORE_REQUEST_LEAK, |
| 103 | + UCP_OP_ATTR_FLAG_MULTI_SEND], |
| 104 | + [], [], |
| 105 | + [#include <ucp/api/ucp.h>]) |
| 106 | + AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS], |
| 107 | + [AC_DEFINE([HAVE_UCP_WORKER_ADDRESS_FLAGS], [1], |
| 108 | + [have worker address attribute])], [], |
| 109 | + [#include <ucp/api/ucp.h>]) |
| 110 | + AC_CHECK_DECLS([UCP_ATTR_FIELD_MEMORY_TYPES], |
| 111 | + [AC_DEFINE([HAVE_UCP_ATTR_MEMORY_TYPES], [1], |
| 112 | + [have memory types attribute])], [], |
| 113 | + [#include <ucp/api/ucp.h>]) |
| 114 | + AC_CHECK_DECLS([ucp_tag_send_nbx, |
| 115 | + ucp_tag_send_sync_nbx, |
| 116 | + ucp_tag_recv_nbx], |
| 117 | + [], [], |
| 118 | + [#include <ucp/api/ucp.h>]) |
| 119 | + AC_CHECK_TYPES([ucp_request_param_t], |
| 120 | + [], [], |
| 121 | + [[#include <ucp/api/ucp.h>]]) |
| 122 | + ]) |
104 | 123 |
|
105 |
| - old_CPPFLAGS="$CPPFLAGS" |
106 |
| - AS_IF([test -n "$ompi_check_ucx_dir"], |
107 |
| - [CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include"]) |
108 |
| - # Turn off UCX version v1.8 due to issue #8321 |
109 |
| - AC_MSG_CHECKING([UCX version]) |
110 |
| - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <ucp/api/ucp_version.h> |
111 |
| - #if (UCP_API_MAJOR == 1) && (UCP_API_MINOR == 8) |
112 |
| - #error "Invalid version" |
113 |
| - #endif], [])], |
114 |
| - [AC_MSG_RESULT([ok (not 1.8.x)])], |
115 |
| - [AC_MSG_RESULT([bad (1.8.x)]) |
116 |
| - AC_MSG_WARN([UCX support skipped because version 1.8.x was found, which has a known catastrophic issue.]) |
117 |
| - AC_MSG_WARN([Please upgrade to UCX version 1.9 or higher.]) |
118 |
| - ompi_check_ucx_happy=no]) |
119 |
| - AS_IF([test "$ompi_check_ucx_happy" = yes], |
120 |
| - [ |
121 |
| - AC_CHECK_DECLS([ucp_tag_send_nbr], |
122 |
| - [AC_DEFINE([HAVE_UCP_TAG_SEND_NBR],[1], |
123 |
| - [have ucp_tag_send_nbr()])], [], |
124 |
| - [#include <ucp/api/ucp.h>]) |
125 |
| - AC_CHECK_DECLS([ucp_ep_flush_nb, ucp_worker_flush_nb, |
126 |
| - ucp_request_check_status, ucp_put_nb, ucp_get_nb, |
127 |
| - ucp_put_nbx, ucp_get_nbx, ucp_atomic_op_nbx, |
128 |
| - ucp_ep_flush_nbx], |
129 |
| - [], [], |
130 |
| - [#include <ucp/api/ucp.h>]) |
131 |
| - AC_CHECK_DECLS([ucm_test_events, |
132 |
| - ucm_test_external_events], |
133 |
| - [], [], |
134 |
| - [#include <ucm/api/ucm.h>]) |
135 |
| - AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND, |
136 |
| - UCP_ATOMIC_POST_OP_OR, |
137 |
| - UCP_ATOMIC_POST_OP_XOR, |
138 |
| - UCP_ATOMIC_FETCH_OP_FAND, |
139 |
| - UCP_ATOMIC_FETCH_OP_FOR, |
140 |
| - UCP_ATOMIC_FETCH_OP_FXOR, |
141 |
| - UCP_PARAM_FIELD_ESTIMATED_NUM_PPN, |
142 |
| - UCP_WORKER_FLAG_IGNORE_REQUEST_LEAK, |
143 |
| - UCP_OP_ATTR_FLAG_MULTI_SEND], |
144 |
| - [], [], |
145 |
| - [#include <ucp/api/ucp.h>]) |
146 |
| - AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS], |
147 |
| - [AC_DEFINE([HAVE_UCP_WORKER_ADDRESS_FLAGS], [1], |
148 |
| - [have worker address attribute])], [], |
149 |
| - [#include <ucp/api/ucp.h>]) |
150 |
| - AC_CHECK_DECLS([UCP_ATTR_FIELD_MEMORY_TYPES], |
151 |
| - [AC_DEFINE([HAVE_UCP_ATTR_MEMORY_TYPES], [1], |
152 |
| - [have memory types attribute])], [], |
153 |
| - [#include <ucp/api/ucp.h>]) |
154 |
| - AC_CHECK_DECLS([ucp_tag_send_nbx, |
155 |
| - ucp_tag_send_sync_nbx, |
156 |
| - ucp_tag_recv_nbx], |
157 |
| - [], [], |
158 |
| - [#include <ucp/api/ucp.h>]) |
159 |
| - AC_CHECK_TYPES([ucp_request_param_t], |
160 |
| - [], [], |
161 |
| - [[#include <ucp/api/ucp.h>]]) |
162 |
| - ]) |
163 |
| - CPPFLAGS=$old_CPPFLAGS |
| 124 | + CPPFLAGS=${ompi_check_ucx_CPPFLAGS_save} |
| 125 | + LDFLAGS=${ompi_check_ucx_LDLAGS_save} |
| 126 | + LIBS=${ompi_check_ucx_LIBS_save} |
164 | 127 |
|
165 |
| - OPAL_SUMMARY_ADD([Transports], [Open UCX], [], [$ompi_check_ucx_happy])])]) |
| 128 | + OPAL_SUMMARY_ADD([Transports], [Open UCX], [], [$ompi_check_ucx_happy]) |
166 | 129 |
|
167 | 130 | AS_IF([test "$ompi_check_ucx_happy" = "yes"],
|
168 |
| - [$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS" |
169 |
| - $1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS" |
170 |
| - $1_LIBS="[$]$1_LIBS $ompi_check_ucx_LIBS" |
171 |
| - $2], |
| 131 | + [$2], |
172 | 132 | [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "no"],
|
173 | 133 | [AC_MSG_ERROR([UCX support requested but not found. Aborting])])
|
174 | 134 | $3])
|
|
0 commit comments