File: ompi_check_ucx.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (141 lines) | stat: -rw-r--r-- 6,360 bytes parent folder | download | duplicates (2)
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
# -*- shell-script -*-
#
# Copyright (C) 2015-2017 Mellanox Technologies, Inc.
#                         All rights reserved.
# Copyright (c) 2015      Research Organization for Information Science
#                         and Technology (RIST). All rights reserved.
# Copyright (c) 2016      Los Alamos National Security, LLC. All rights
#                         reserved.
# Copyright (c) 2016 Cisco Systems, Inc.  All rights reserved.
# Copyright (c) 2022      Amazon.com, Inc. or its affiliates.  All Rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# OMPI_CHECK_UCX(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if UCX support can be found.  sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_UCX],[
    OPAL_VAR_SCOPE_PUSH([ompi_check_ucx_happy ompi_check_ucx_CPPFLAGS_save ompi_check_ucx_LDFLAGS_save ompi_check_ucx_LIBS_save])

    m4_ifblank([$1], [m4_fatal([First argument to OMPI_CHECK_UCX cannot be blank])])

    AC_ARG_WITH([ucx],
                [AS_HELP_STRING([--with-ucx(=DIR)],
                                [Build with Unified Communication X library support])])
    AC_ARG_WITH([ucx-libdir],
                [AS_HELP_STRING([--with-ucx-libdir=DIR],
                                [Search for Unified Communication X libraries in DIR])])

    OAC_CHECK_PACKAGE([ucx],
                      [$1],
                      [ucp/api/ucp.h],
                      [ucp -luct -lucm -lucs],
                      [ucp_cleanup],
                      [ompi_check_ucx_happy="yes"],
                      [ompi_check_ucx_happy="no"])

    ompi_check_ucx_CPPFLAGS_save=${CPPFLAGS}
    ompi_check_ucx_LDLAGS_save=${LDFLAGS}
    ompi_check_ucx_LIBS_save=${LIBS}

    OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${$1_CPPFLAGS}])
    OPAL_FLAGS_APPEND_UNIQ([LDFLAGS], [${$1_LDFLAGS}])
    OPAL_FLAGS_APPEND_MOVE([LIBS], [${$1_LIBS}])

    AS_IF([test "$ompi_check_ucx_happy" = yes],
          [AC_CACHE_CHECK([for UCX version header],
               [ompi_check_ucx_cv_have_version_header],
               [AC_REQUIRE_CPP
                AC_COMPILE_IFELSE(
                   [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])],
                   [ompi_check_ucx_cv_have_version_header="yes"],
                   [ompi_check_ucx_cv_have_version_header="no"])])
           AS_IF([test "${ompi_check_ucx_cv_have_version_header}" != "yes"],
                 [ompi_check_ucx_happy=no])])

    AS_IF([test "$ompi_check_ucx_happy" = yes],
          [# Turn off UCX version v1.8 due to issue #8321
           AC_CACHE_CHECK([UCX version > 1.9.x],
               [ompi_check_ucx_cv_have_version_gt_1_9],
               [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
#include <ucp/api/ucp_version.h>
                                 ]], [[
#if (UCP_API_MAJOR < 1) || ((UCP_API_MAJOR == 1) && (UCP_API_MINOR < 9))
#error "Version too low"
#endif
                                 ]])],
                             [ompi_check_ucx_cv_have_version_gt_1_9=yes],
                             [ompi_check_ucx_cv_have_version_gt_1_9=no
                              ompi_check_ucx_happy=no])])])

    AS_IF([test "$ompi_check_ucx_happy" = yes],
          [AC_CHECK_DECLS([ucp_tag_send_nbr],
                          [AC_DEFINE([HAVE_UCP_TAG_SEND_NBR],[1],
                                     [have ucp_tag_send_nbr()])], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([ucp_ep_flush_nb, ucp_worker_flush_nb,
                           ucp_request_check_status, ucp_put_nb, ucp_get_nb,
                           ucp_put_nbx, ucp_get_nbx, ucp_atomic_op_nbx,
                           ucp_ep_flush_nbx],
                          [], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([ucm_test_events,
                           ucm_test_external_events],
                          [], [],
                          [#include <ucm/api/ucm.h>])
           AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND,
                           UCP_ATOMIC_POST_OP_OR,
                           UCP_ATOMIC_POST_OP_XOR,
                           UCP_ATOMIC_FETCH_OP_FAND,
                           UCP_ATOMIC_FETCH_OP_FOR,
                           UCP_ATOMIC_FETCH_OP_FXOR,
                           UCP_PARAM_FIELD_ESTIMATED_NUM_PPN,
                           UCP_WORKER_FLAG_IGNORE_REQUEST_LEAK,
                           UCP_OP_ATTR_FLAG_MULTI_SEND,
                           UCP_MEM_MAP_SYMMETRIC_RKEY,
                           UCS_MEMORY_TYPE_RDMA],
                          [], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS],
                          [AC_DEFINE([HAVE_UCP_WORKER_ADDRESS_FLAGS], [1],
                                     [have worker address attribute])], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([UCP_ATTR_FIELD_MEMORY_TYPES],
                          [AC_DEFINE([HAVE_UCP_ATTR_MEMORY_TYPES], [1],
                                     [have memory types attribute])], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([UCP_EP_ATTR_FIELD_TRANSPORTS],
                          [], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_DECLS([ucp_tag_send_nbx,
                           ucp_tag_send_sync_nbx,
                           ucp_tag_recv_nbx,
                           ucp_rkey_compare],
                          [], [],
                          [#include <ucp/api/ucp.h>])
           AC_CHECK_TYPES([ucp_request_param_t],
                          [], [],
                          [[#include <ucp/api/ucp.h>]])
           ])

    CPPFLAGS=${ompi_check_ucx_CPPFLAGS_save}
    LDFLAGS=${ompi_check_ucx_LDLAGS_save}
    LIBS=${ompi_check_ucx_LIBS_save}

    OPAL_SUMMARY_ADD([Transports], [Open UCX], [], [$ompi_check_ucx_happy])

    AS_IF([test "$ompi_check_ucx_happy" = "yes"],
          [$2],
          [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "no"],
                 [AC_MSG_ERROR([UCX support requested but not found.  Aborting])])
           $3])

    OPAL_VAR_SCOPE_POP
])