From ca635a98a7020117e9e7c6f40572e98e3fb1eaf8 Mon Sep 17 00:00:00 2001 From: Nicholas Sielicki Date: Mon, 12 Aug 2024 12:48:37 -0700 Subject: [PATCH] cuda: cxx: use decltype instead of typeof for cxx --- src/nccl_ofi_cuda.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/nccl_ofi_cuda.c b/src/nccl_ofi_cuda.c index 2e90168a6..0e6b2954d 100644 --- a/src/nccl_ofi_cuda.c +++ b/src/nccl_ofi_cuda.c @@ -25,6 +25,7 @@ void *nccl_net_ofi_cuFlushGPUDirectRDMAWrites = NULL; #define STRINGIFY(sym) # sym +#ifndef __cplusplus #define LOAD_SYM(sym) \ nccl_net_ofi_##sym = (typeof(sym) *)dlsym(cudadriver_lib, STRINGIFY(sym)); \ if (nccl_net_ofi_##sym == NULL) { \ @@ -32,6 +33,16 @@ void *nccl_net_ofi_cuFlushGPUDirectRDMAWrites = NULL; ret = -ENOTSUP; \ goto error; \ } +#else +#define LOAD_SYM(sym) \ + nccl_net_ofi_##sym = (decltype(sym) *)dlsym(cudadriver_lib, STRINGIFY(sym)); \ + if (nccl_net_ofi_##sym == NULL) { \ + NCCL_OFI_WARN("Failed to load symbol " STRINGIFY(sym)); \ + ret = -ENOTSUP; \ + goto error; \ + } +#endif + int nccl_net_ofi_cuda_init(void)