diff --git a/Makefile.am b/Makefile.am index fb517b996bd..bae2328d6a2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,8 @@ SUBDIRS = \ src/ucm \ src/ucs \ src/uct \ - src/ucp + src/ucp \ + stubs if HAVE_UCG SUBDIRS += $(UCG_SUBDIR) diff --git a/config/m4/cuda.m4 b/config/m4/cuda.m4 index 0194c8a4724..014f664955b 100644 --- a/config/m4/cuda.m4 +++ b/config/m4/cuda.m4 @@ -232,4 +232,10 @@ AS_IF([test "x$cuda_checked" != "xyes"], UCX_CUDA_CHECK_NVCC ]) # "x$cuda_checked" != "xyes" + # Set stubs include path for pkg-config + # e.g. UCX Device API headers include + # from a separate package. Stubs provide fallback when not installed. + STUB_CFLAGS="-I\${includedir}/stubs" + AC_SUBST([STUB_CFLAGS]) + ]) # UCX_CHECK_CUDA diff --git a/configure.ac b/configure.ac index 30926b15c23..5985ffa8cf9 100644 --- a/configure.ac +++ b/configure.ac @@ -367,6 +367,7 @@ AC_SUBST([build_bindings], [${build_bindings}]) # Final output # AC_CONFIG_FILES([Makefile + stubs/Makefile docs/doxygen/header.tex src/uct/api/version.h ]) diff --git a/stubs/Makefile.am b/stubs/Makefile.am new file mode 100644 index 00000000000..df8fcc4d649 --- /dev/null +++ b/stubs/Makefile.am @@ -0,0 +1,13 @@ +# +# Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2025. ALL RIGHTS RESERVED. +# See file LICENSE for terms. +# + +# Stub headers: provide fallback if required package not installed. + +stubincludedir = $(includedir)/stubs + +# install gdaki stub headers in case of ucx-ib-mlx5-gda not installed. +nobase_stubinclude_HEADERS = \ + uct/ib/mlx5/gdaki/gdaki.cuh \ + uct/ib/mlx5/gdaki/gdaki_dev.h diff --git a/stubs/uct/ib/mlx5/gdaki/gdaki.cuh b/stubs/uct/ib/mlx5/gdaki/gdaki.cuh new file mode 100644 index 00000000000..b7a63a515c4 --- /dev/null +++ b/stubs/uct/ib/mlx5/gdaki/gdaki.cuh @@ -0,0 +1,100 @@ +/** + * Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2025. ALL RIGHTS RESERVED. + * See file LICENSE for terms. + */ + +#ifndef UCT_GDAKI_CUH_H +#define UCT_GDAKI_CUH_H + +/* + * Stub implementation for GDAKI (GPU Direct Async Kernel Interface). + * This file provides stub functions when DOCA GPUNetIO package is not available. + * If DOCA GPUNetIO is installed, the real implementation from that package + * will be used instead (via higher priority include path). + */ + +#include "gdaki_dev.h" +#include +#include + +/** + * Stub implementation: put_single operation + * Returns UCS_ERR_UNSUPPORTED as GDAKI is not available + */ +template +UCS_F_DEVICE ucs_status_t uct_rc_mlx5_gda_ep_put_single( + uct_device_ep_h tl_ep, const uct_device_mem_element_t *tl_mem_elem, + const void *address, uint64_t remote_address, size_t length, + uint64_t flags, uct_device_completion_t *comp) +{ + return UCS_ERR_UNSUPPORTED; +} + +/** + * Stub implementation: atomic_add operation + * Returns UCS_ERR_UNSUPPORTED as GDAKI is not available + */ +template +UCS_F_DEVICE ucs_status_t uct_rc_mlx5_gda_ep_atomic_add( + uct_device_ep_h tl_ep, const uct_device_mem_element_t *tl_mem_elem, + uint64_t value, uint64_t remote_address, uint64_t flags, + uct_device_completion_t *comp) +{ + return UCS_ERR_UNSUPPORTED; +} + +/** + * Stub implementation: put_multi operation + * Returns UCS_ERR_UNSUPPORTED as GDAKI is not available + */ +template +UCS_F_DEVICE ucs_status_t uct_rc_mlx5_gda_ep_put_multi( + uct_device_ep_h tl_ep, const uct_device_mem_element_t *tl_mem_list, + unsigned mem_list_count, void *const *addresses, + const uint64_t *remote_addresses, const size_t *lengths, + uint64_t counter_inc_value, uint64_t counter_remote_address, + uint64_t flags, uct_device_completion_t *tl_comp) +{ + return UCS_ERR_UNSUPPORTED; +} + +/** + * Stub implementation: put_multi_partial operation + * Returns UCS_ERR_UNSUPPORTED as GDAKI is not available + */ +template +UCS_F_DEVICE ucs_status_t uct_rc_mlx5_gda_ep_put_multi_partial( + uct_device_ep_h tl_ep, const uct_device_mem_element_t *tl_mem_list, + const unsigned *mem_list_indices, unsigned mem_list_count, + void *const *addresses, const uint64_t *remote_addresses, + const size_t *local_offsets, const size_t *remote_offsets, + const size_t *lengths, unsigned counter_index, + uint64_t counter_inc_value, uint64_t counter_remote_address, + uint64_t flags, uct_device_completion_t *tl_comp) +{ + return UCS_ERR_UNSUPPORTED; +} + +/** + * Stub implementation: endpoint progress + * No-op as GDAKI is not available + */ +template +UCS_F_DEVICE void uct_rc_mlx5_gda_ep_progress(uct_device_ep_h tl_ep) +{ + /* No-op stub */ +} + +/** + * Stub implementation: check completion + * Returns UCS_ERR_UNSUPPORTED as GDAKI is not available + */ +template +UCS_F_DEVICE ucs_status_t uct_rc_mlx5_gda_ep_check_completion( + uct_device_ep_h tl_ep, uct_device_completion_t *tl_comp) +{ + return UCS_ERR_UNSUPPORTED; +} + +#endif /* UCT_GDAKI_CUH_H */ + diff --git a/stubs/uct/ib/mlx5/gdaki/gdaki_dev.h b/stubs/uct/ib/mlx5/gdaki/gdaki_dev.h new file mode 100644 index 00000000000..d730b004fa8 --- /dev/null +++ b/stubs/uct/ib/mlx5/gdaki/gdaki_dev.h @@ -0,0 +1,14 @@ +/** + * Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2025. ALL RIGHTS RESERVED. + * See file LICENSE for terms. + */ + +#ifndef UCT_GDAKI_DEV_H +#define UCT_GDAKI_DEV_H + +#include + +typedef struct { +} uct_rc_gda_completion_t; + +#endif /* UCT_GDAKI_DEV_H */ diff --git a/ucx.pc.in b/ucx.pc.in index 703a5950bf5..026f508e802 100644 --- a/ucx.pc.in +++ b/ucx.pc.in @@ -13,7 +13,7 @@ includedir = @includedir@ Name: @PACKAGE@ Description: Unified Communication X Library Version: @VERSION@ -Cflags: -I${includedir} +Cflags: -I${includedir} @STUB_CFLAGS@ Libs: -L${libdir} -lucp Libs.private: -Wl,--undefined=ucp_global_init Requires: @PACKAGE@-uct, @PACKAGE@-ucs diff --git a/ucx.spec.in b/ucx.spec.in index 0a25847e20d..dd57ff19421 100644 --- a/ucx.spec.in +++ b/ucx.spec.in @@ -166,6 +166,7 @@ rm -f %{buildroot}%{_libdir}/ucx/lib*.so %files devel %{_includedir}/uc* +%{_includedir}/stubs %{_libdir}/lib*.so %{_libdir}/pkgconfig/ucx.pc %{_libdir}/pkgconfig/ucx-uct.pc