Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/uct/ib/mlx5/gdaki/gpunetio"]
path = src/uct/ib/mlx5/gdaki/gpunetio
path = extern/gpunetio
url = https://github.com/NVIDIA-DOCA/gpunetio
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ EXTRA_DIST += debian/copyright
EXTRA_DIST += debian/control
EXTRA_DIST += debian/ucx.install
EXTRA_DIST += debian/ucx-cuda.install
EXTRA_DIST += debian/ucx-ib-mlx5-gda.install
EXTRA_DIST += debian/rules
EXTRA_DIST += debian/source/format
EXTRA_DIST += ucx.pc.in
Expand Down
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ done
rm -rf autom4te.cache
mkdir -p config/m4 config/aux

git submodule update --init src/uct/ib/mlx5/gdaki/gpunetio
git submodule update --init extern/gpunetio

autoreconf -v --install || exit 1
rm -rf autom4te.cache
8 changes: 6 additions & 2 deletions bindings/java/src/test/java/org/openucx/jucx/UcxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ public UcpMemory getMemory() {

public void setData(String data) throws Exception {
if (memory.getMemType() == UcsConstants.MEMORY_TYPE.UCS_MEMORY_TYPE_CUDA) {
ByteBuffer srcBuffer = ByteBuffer.allocateDirect(data.length() * 2);
ByteBuffer srcBuffer = ByteBuffer.allocateDirect((int)memory.getLength());
Comment thread
tvegas1 marked this conversation as resolved.
Resolved
while (srcBuffer.hasRemaining()) {
srcBuffer.put((byte) 0);
}
srcBuffer.clear();
srcBuffer.asCharBuffer().put(data);
UcpRequest send = selfEp.sendTaggedNonBlocking(srcBuffer, 0, null);
worker.progressRequest(worker.recvTaggedNonBlocking(memory.getAddress(),
data.length() * 2L, 0, 0, null));
memory.getLength(), 0, 0, null));
worker.progressRequest(send);
} else {
buffer.asCharBuffer().put(data);
Expand Down
49 changes: 35 additions & 14 deletions config/m4/cuda.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# See file LICENSE for terms.
#

NVCC_CUDA_MIN_REQUIRED_MAJOR=10
NVCC_CUDA_MIN_REQUIRED_MINOR=2
NVCC_CUDA_MIN_REQUIRED=10.2

ARCH9_CODE="-gencode=arch=compute_70,code=sm_70"
ARCH10_CODE="-gencode=arch=compute_75,code=sm_75"
Expand Down Expand Up @@ -48,13 +47,19 @@ AC_DEFUN([AC_LANG_COMPILER(CUDA)], [
# Check for nvcc compiler support
AC_DEFUN([UCX_CUDA_CHECK_NVCC], [
AS_IF([test "x$NVCC" != "x"], [
CUDA_MAJOR_VERSION=`$NVCC --version | grep release | sed 's/.*release //' | sed 's/\,.*//' | cut -d "." -f 1`
CUDA_MINOR_VERSION=`$NVCC --version | grep release | sed 's/.*release //' | sed 's/\,.*//' | cut -d "." -f 2`
AC_MSG_RESULT([Detected CUDA version: $CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION])
AS_IF([test $CUDA_MAJOR_VERSION -lt $NVCC_CUDA_MIN_REQUIRED_MAJOR -o \( $CUDA_MAJOR_VERSION -eq $NVCC_CUDA_MIN_REQUIRED_MAJOR -a $CUDA_MINOR_VERSION -lt $NVCC_CUDA_MIN_REQUIRED_MINOR \)],
[AC_MSG_WARN([Minimum required CUDA version for device code: $NVCC_CUDA_MIN_REQUIRED_MAJOR.$NVCC_CUDA_MIN_REQUIRED_MINOR])
NVCC=""
])
CUDA_VERSION=$($NVCC --version | grep release | sed 's/.*release //' | sed 's/\,.*//')
CUDA_MAJOR_VERSION=$(echo $CUDA_VERSION | cut -d "." -f 1)
CUDA_MINOR_VERSION=$(echo $CUDA_VERSION | cut -d "." -f 2)
AC_MSG_RESULT([Detected CUDA version: $CUDA_VERSION])
AS_VERSION_COMPARE([$CUDA_VERSION], [$NVCC_CUDA_MIN_REQUIRED], [],
Comment thread
tvegas1 marked this conversation as resolved.
Resolved
[AC_MSG_WARN([Minimum required CUDA version for device code: $NVCC_CUDA_MIN_REQUIRED])
NVCC=""])

NVCC_CXX_DIALECT=c++17
cxx_dialect_ver=201703L
AS_VERSION_COMPARE([$CUDA_VERSION], [13.0], [],
[NVCC_CXX_DIALECT=c++11
cxx_dialect_ver=201103L])

AS_IF([test "x$NVCC" != "x"], [
AC_ARG_WITH([nvcc-gencode],
Expand All @@ -77,25 +82,26 @@ AC_DEFUN([UCX_CUDA_CHECK_NVCC], [
[NVCC_ARCH="${ARCH9_CODE} ${ARCH10_CODE} ${ARCH110_CODE} ${ARCH111_CODE} ${ARCH120_CODE} ${ARCH124_CODE} ${ARCH128_CODE} ${ARCH128_PTX}"])],

[11],
[AS_CASE([$CUDA_MINOR_VERSION],
[AS_CASE([$CUDA_MINOR_VERSION],
[0],
[NVCC_ARCH="${ARCH9_CODE} ${ARCH10_CODE} ${ARCH110_CODE} ${ARCH110_PTX}"],
[*],
[NVCC_ARCH="${ARCH9_CODE} ${ARCH10_CODE} ${ARCH110_CODE} ${ARCH111_CODE} ${ARCH111_PTX}"])],
[*],
[NVCC_ARCH="${ARCH9_CODE} ${ARCH9_PTX}"])],
[NVCC_ARCH="$with_nvcc_gencode"])

BASE_NVCCFLAGS="$BASE_NVCCFLAGS $NVCC_ARCH"
AC_MSG_CHECKING([$NVCC needs explicit c++11 option])
AC_MSG_CHECKING([$NVCC needs explicit $NVCC_CXX_DIALECT option])
AC_LANG_PUSH([CUDA])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if __cplusplus < 201103L
#error missing C++11
#if __cplusplus < $cxx_dialect_ver
#error missing $NVCC_CXX_DIALECT
#endif
]])],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])
BASE_NVCCFLAGS="$BASE_NVCCFLAGS -std=c++11"])
BASE_NVCCFLAGS="$BASE_NVCCFLAGS -std=$NVCC_CXX_DIALECT"])
AC_LANG_POP

AC_MSG_CHECKING([$NVCC can compile])
Expand All @@ -109,6 +115,21 @@ AC_DEFUN([UCX_CUDA_CHECK_NVCC], [
[AC_MSG_RESULT([no])
NVCC=""])
AC_LANG_POP

save_NVCCFLAGS="$NVCCFLAGS"
NVCCFLAGS="$NVCCFLAGS -DCCCL_IGNORE_DEPRECATED_CPP_DIALECT"
AC_MSG_CHECKING([checking cuda/atomic support])
AC_LANG_PUSH([CUDA])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <cuda/atomic>
int v;
cuda::atomic_ref<int> ref{v};
]])],
[AC_MSG_RESULT([yes])
have_cuda_atomic_support=yes],
[AC_MSG_RESULT([no])])
AC_LANG_POP
NVCCFLAGS="$save_NVCCFLAGS"
])
])

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ AS_IF([test "x$with_docs_only" = xyes],
AM_CONDITIONAL([HAVE_CUDA_STATIC], [false])
AM_CONDITIONAL([HAVE_NVCC], [false])
AM_CONDITIONAL([HAVE_GDR_COPY], [false])
AM_CONDITIONAL([HAVE_GPUNETIO], [false])
AM_CONDITIONAL([HAVE_GDA], [false])
AM_CONDITIONAL([HAVE_ROCM], [false])
AM_CONDITIONAL([HAVE_HIP], [false])
AM_CONDITIONAL([HAVE_XPMEM], [false])
Expand Down
2 changes: 1 addition & 1 deletion debian/rules.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

CUDA_OPT = $(shell echo ${DEB_BUILD_PROFILES} | grep -qw cuda \
CUDA_OPT = $(shell echo ${DEB_BUILD_PROFILES} | grep -qw cuda\\\|gda \
Comment thread
yosefe marked this conversation as resolved.
Resolved
&& echo --with-cuda=/usr/local/cuda || echo --without-cuda)

XPMEM_OPT = $(shell echo ${DEB_BUILD_PROFILES} | grep -qw xpmem \
Expand Down
3 changes: 2 additions & 1 deletion debian/ucx-ib-mlx5-gda.install
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
+usr/lib/ucx/libuct_ib_mlx5_gda.*
Comment thread
yosefe marked this conversation as resolved.
Resolved
usr/lib/ucx/libuct_ib_mlx5_gda.*
usr/include/uct/ib/mlx5/gdaki/*
4 changes: 2 additions & 2 deletions src/tools/perf/cuda/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ libucx_perftest_cuda_la_LIBADD = $(CUDART_LIBS)
libucx_perftest_cuda_la_SOURCES = cuda_alloc.c

if HAVE_NVCC
if HAVE_GPUNETIO # temporarily all device code depends on doca
if HAVE_GDA # temporarily all device code depends on GDA
Comment thread
yosefe marked this conversation as resolved.
Resolved
Comment thread
yosefe marked this conversation as resolved.
Resolved

NVCC_EXTRA_FLAGS = $(CUDA_CPPFLAGS) $(GPUNETIO_CFLAGS)
NVCC_EXTRA_FLAGS = $(CUDA_CPPFLAGS)

libucx_perftest_cuda_la_LIBADD += \
$(abs_top_builddir)/src/tools/perf/lib/libucxperf.la \
Expand Down
8 changes: 8 additions & 0 deletions src/ucs/sys/device_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
#define UCS_DEVICE_NUM_THREADS_IN_WARP 32


/* nvcc does not provide __builtin_ia32_prefetch used by GCC's x86 intrinsic headers.
Redirect to the generic __builtin_prefetch so those headers compile. */
#if defined(__NVCC__) && !defined(__builtin_ia32_prefetch)
#define __builtin_ia32_prefetch(_p, _rw, _loc, _cache) \
__builtin_prefetch((_p), (_rw), (_loc))
#endif


/**
* @brief Cooperation level when calling device functions.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/uct/ib/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ AS_IF([test "x$with_ib" = "xyes"],
AC_CHECK_MEMBERS([struct mlx5_cqe64.ib_stride_index],
[], [], [[#include <infiniband/$mlx5_include>]])

AC_CHECK_DECLS([mlx5dv_devx_umem_reg_ex],
[have_mlx5dv_devx_umem=yes], [], [[#include <infiniband/$mlx5_include>]])

AC_DEFINE([HAVE_IB], 1, [IB support])

AS_IF([test "x$with_dc" != xno -a "x$have_dc_dv" = xyes -a "x$have_mlx5" = "xyes"], [
Expand Down
16 changes: 13 additions & 3 deletions src/uct/ib/mlx5/gdaki/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
# See file LICENSE for terms.
#

if HAVE_GPUNETIO
if HAVE_GDA
Comment thread
yosefe marked this conversation as resolved.
Resolved

module_LTLIBRARIES = libuct_ib_mlx5_gda.la
libuct_ib_mlx5_gda_la_CPPFLAGS = $(BASE_CPPFLAGS) $(IBVERBS_CPPFLAGS) \
$(CUDA_CPPFLAGS)
libuct_ib_mlx5_gda_la_CFLAGS = $(BASE_CFLAGS) $(LT_CFLAGS) $(CUDA_CFLAGS) \
$(GPUNETIO_CFLAGS)
libuct_ib_mlx5_gda_la_CFLAGS = $(BASE_CFLAGS) $(LT_CFLAGS) $(CUDA_CFLAGS)
libuct_ib_mlx5_gda_la_LDFLAGS = $(IBVERBS_LDFLAGS) $(CUDA_LDFLAGS) \
-version-info $(SOVERSION)
libuct_ib_mlx5_gda_la_LIBADD = $(top_builddir)/src/ucs/libucs.la \
Expand All @@ -27,6 +26,17 @@ nobase_dist_libuct_ib_mlx5_gda_la_HEADERS = \
gdaki.cuh \
gdaki_dev.h

gpunetio_commondir = $(includedir)/uct/ib/mlx5/gdaki/common
Comment thread
yosefe marked this conversation as resolved.
Resolved
dist_gpunetio_common_HEADERS = \
common/doca_gpunetio_verbs_def.h \
common/doca_gpunetio_verbs_dev.h

gpunetio_devicedir = $(includedir)/uct/ib/mlx5/gdaki/device
dist_gpunetio_device_HEADERS = \
device/doca_gpunetio_dev_verbs_common.cuh \
device/doca_gpunetio_dev_verbs_qp.cuh \
device/doca_gpunetio_dev_verbs_cq.cuh

noinst_HEADERS = \
gdaki.h

Expand Down
1 change: 1 addition & 0 deletions src/uct/ib/mlx5/gdaki/common
57 changes: 19 additions & 38 deletions src/uct/ib/mlx5/gdaki/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,38 @@
# See file LICENSE for terms.
#

AC_ARG_WITH([doca-gpunetio],
[AS_HELP_STRING([--with-doca-gpunetio=(DIR)],
[Use DOCA gpunetio (Default is guess)])],
[with_doca_gpunetio=$withval],
[with_doca_gpunetio=guess])

UCX_CHECK_CUDA

AS_IF([test "x$cuda_happy" = "xyes"],
have_cuda_12_2=yes
AS_VERSION_COMPARE([$CUDA_VERSION], [12.2], [], [have_cuda_12_2=no])
AS_IF([test "x$cuda_happy" = "xyes"] && [test "x$have_mlx5" = "xyes"] &&
Comment thread
yosefe marked this conversation as resolved.
Resolved
[test "x$have_cuda_12_2" = "xyes"] &&
[test "x$have_mlx5dv_devx_umem" = "xyes"] &&
Comment thread
yosefe marked this conversation as resolved.
Resolved
[test "x$have_cuda_atomic_support" = "xyes"],
[
# Default value
GPUNETIO_CFLAGS=""
AS_IF([test "x$with_doca_gpunetio" != "xno"],
AS_IF([test "x$NVCC_CXX_DIALECT" != "xc++17"],
[
AS_IF([test "x$with_doca_gpunetio" = "xguess"],
[
AS_IF([$PKG_CONFIG --exists doca-gpunetio],
[GPUNETIO_CFLAGS=$(pkg-config --cflags doca-gpunetio)])
],
[
GPUNETIO_CFLAGS="-I${with_doca_gpunetio}/include"
]) # "x$with_doca_gpunetio" != "xguess"
]) # "x$with_doca_gpunetio" != "xno"
NVCCFLAGS="$NVCCFLAGS -DCCCL_IGNORE_DEPRECATED_CPP_DIALECT"
])

AS_IF([test "x$CUDA_MAJOR_VERSION" = "x12" -a "x$CUDA_MINOR_VERSION" = "x9"],
have_cuda_12_9=yes
AS_VERSION_COMPARE([$CUDA_VERSION], [12.9], [], [have_cuda_12_9=no])
AS_IF([test "x$have_cuda_12_9" = "xyes"],
[
GPUNETIO_CFLAGS="$GPUNETIO_CFLAGS -D_LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE"
NVCCFLAGS="$NVCCFLAGS -D_LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE"
])

save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $CUDA_CFLAGS $GPUNETIO_CFLAGS"
# TODO check submodule version

gpunetio_happy=yes
AC_CHECK_HEADERS([doca_gpunetio.h], [], [gpunetio_happy=no])

CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
gda_happy=yes
],
[gpunetio_happy=no])

AS_IF([test "x$gpunetio_happy" = "xyes"],
[gda_happy=no])
AS_IF([test "x$gda_happy" = "xyes"],
[
uct_ib_mlx5_modules="${uct_ib_mlx5_modules}:gda"
AC_SUBST(GPUNETIO_CFLAGS)
],
[
# gpunetio was requested but not found
AS_IF([test "x$with_doca_gpunetio" != "xno" -a "x$with_doca_gpunetio" != "xguess"],
Comment thread
tvegas1 marked this conversation as resolved.
Resolved
[AC_MSG_ERROR([doca_gpunetio not found (cuda found: $cuda_happy)])])
])

AM_CONDITIONAL([HAVE_GPUNETIO], [test x$gpunetio_happy = xyes])
AM_CONDITIONAL([HAVE_GDA], [test x$gda_happy = xyes])
AC_CONFIG_FILES([src/uct/ib/mlx5/gdaki/Makefile
src/uct/ib/mlx5/gdaki/ucx-ib-mlx5-gda.pc])

Comment thread
tvegas1 marked this conversation as resolved.
Resolved
1 change: 1 addition & 0 deletions src/uct/ib/mlx5/gdaki/device
Loading
Loading