diff --git a/.github/workflows/distcheck.yaml b/.github/workflows/distcheck.yaml index ce5d91b74..59ab9ea2c 100644 --- a/.github/workflows/distcheck.yaml +++ b/.github/workflows/distcheck.yaml @@ -85,7 +85,7 @@ jobs: - name: Install hwloc, utilities. run: | - yum -y install hwloc-devel autoconf automake libtool gcc g++ git make + yum -y install hwloc-devel autoconf automake libtool gcc gcc-c++ git make - name: Install CUDA if: matrix.sdk == 'cuda' diff --git a/configure.ac b/configure.ac index a29074660..c0617e521 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,7 @@ NCCL_NET_OFI_DISTCHCK_CONFIGURE_FLAGS= # Checks for programs AC_PROG_CC AM_PROG_CC_C_O +AC_PROG_CXX m4_version_prereq([2.70], [], [AC_PROG_CC_STDC]) AC_C_INLINE @@ -55,12 +56,18 @@ dnl between this and AC_PROG_CC. AS_IF([test "${ax_enable_debug}" = "no"], [ dnl Enable O3 optimization CFLAGS="${CFLAGS} -O3" + CXXFLAGS="${CXXFLAGS} -O3" + + dnl use C++17, disable exceptions, and disable runtime type information + CXXFLAGS="-std=c++17 -fno-rtti -fno-exceptions" dnl dead code elim CFLAGS="${CFLAGS} -ffunction-sections -fdata-sections" + CXXFLAGS="${CXXFLAGS} -ffunction-sections -fdata-sections" dnl https://maskray.me/blog/2021-05-09-fno-semantic-interposition CFLAGS="${CFLAGS} -fno-semantic-interposition -fvisibility=hidden" + CXXFLAGS="${CXXFLAGS} -fno-semantic-interposition -fvisibility=hidden " LDFLAGS="${LDFLAGS} -Bsymbolic" ]) CHECK_ENABLE_SANITIZER() @@ -175,10 +182,15 @@ AS_IF([test "${enable_trace}" = "yes" ], AC_DEFINE_UNQUOTED([OFI_NCCL_TRACE], [${trace}], [Defined to 1 unit test output should include TRACE level]) picky_cflags="" +picky_cxxflags="" AC_DEFUN([ADD_PICKY_FLAGS],[ AC_LANG_PUSH([C]) AX_CHECK_COMPILE_FLAG([$1], [picky_cflags="${picky_cflags} $1"], [], [-Werror]) AC_LANG_POP() + + AC_LANG_PUSH([C++]) + AX_CHECK_COMPILE_FLAG([$1], [picky_cxxflags="${picky_cxxflags} $1"], [], [-Werror -x c++]) + AC_LANG_POP() ]) dnl standard and normal @@ -220,6 +232,8 @@ AC_ARG_ENABLE([picky-compiler], AS_IF([test "${enable_picky_compiler}" != "no"], [AC_MSG_NOTICE([Adding ${picky_cflags} to CFLAGS.]) CFLAGS="${CFLAGS} ${picky_cflags}" + CXXFLAGS="${CXXFLAGS} ${picky_cxxflags}" + AS_UNSET([picky_cxxflags]) AS_UNSET([picky_cflags])]) werror_flags="-Werror" @@ -227,10 +241,12 @@ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [(Developer) Enable setting -Werror. Off by default, unless building from Git tree.])]) AS_IF([test -d "${srcdir}/.git" -a -z "${enable_werror}"], [AC_MSG_NOTICE([Found .git directory. Adding ${werror_flags} to CFLAGS.]) - CFLAGS="${werror_flags} ${CFLAGS}"], + CXXFLAGS="${werror_flags} ${CXXFLAGS} " + CFLAGS="${werror_flags} ${CFLAGS} "], [test "${enable_werror}" = "yes"], [AC_MSG_NOTICE([Adding ${werror_flags} to CFLAGS.]) - CFLAGS="${werror_flags} ${CFLAGS}"]) + CXXFLAGS="${werror_flags} ${CXXFLAGS} " + CFLAGS="${werror_flags} ${CFLAGS} "]) AC_SUBST([NCCL_NET_OFI_DISTCHCK_CONFIGURE_FLAGS]) diff --git a/include/nccl_ofi_config_bottom.h b/include/nccl_ofi_config_bottom.h index 4c0defc56..4a2b6d2ff 100644 --- a/include/nccl_ofi_config_bottom.h +++ b/include/nccl_ofi_config_bottom.h @@ -5,6 +5,8 @@ #ifndef NCCL_OFI_CONFIG_BOTTOM_H #define NCCL_OFI_CONFIG_BOTTOM_H +#define NCCL_OFI_N_NVTX_DOMAIN_PER_COMM 8 + /* configure aborts if __buildin_expect() isn't available */ #define OFI_LIKELY(x) __builtin_expect((x), 1) #define OFI_UNLIKELY(x) __builtin_expect((x), 0) diff --git a/include/nccl_ofi_mr.h b/include/nccl_ofi_mr.h index 055732ec8..4059c6376 100644 --- a/include/nccl_ofi_mr.h +++ b/include/nccl_ofi_mr.h @@ -33,14 +33,15 @@ enum nccl_ofi_mr_ckey_type { typedef enum nccl_ofi_mr_ckey_type nccl_ofi_mr_ckey_type_t; struct nccl_ofi_mr_ckey { - const union { - const struct iovec iovec; + union { + struct iovec iovec; #if HAVE_DECL_FI_MR_DMABUF - const struct fi_mr_dmabuf fi_mr_dmabuf; + struct fi_mr_dmabuf fi_mr_dmabuf; #endif }; - const enum nccl_ofi_mr_ckey_type type; + enum nccl_ofi_mr_ckey_type type; }; + typedef struct nccl_ofi_mr_ckey nccl_ofi_mr_ckey_t; typedef struct nccl_ofi_mr_ckey const *const nccl_ofi_mr_ckey_ref; @@ -118,30 +119,24 @@ static inline void nccl_ofi_mr_ckey_round(size_t *len, void **base_addr, const c #if HAVE_DECL_FI_MR_DMABUF static inline nccl_ofi_mr_ckey_t nccl_ofi_mr_ckey_mk_dmabuf(int fd, uint64_t offset, size_t len, void *base_addr) { - return (nccl_ofi_mr_ckey_t){ - .fi_mr_dmabuf = - { - .fd = fd, - .offset = offset, - .len = len, - .base_addr = base_addr, - }, - .type = NCCL_OFI_MR_CKEY_DMABUF, - }; + nccl_ofi_mr_ckey_t cache_key = {}; + cache_key.fi_mr_dmabuf.fd = fd; + cache_key.fi_mr_dmabuf.offset = offset; + cache_key.fi_mr_dmabuf.len = len; + cache_key.fi_mr_dmabuf.base_addr = base_addr; + cache_key.type = NCCL_OFI_MR_CKEY_DMABUF; + return cache_key; } #endif static inline nccl_ofi_mr_ckey_t nccl_ofi_mr_ckey_mk_vec(void *iov_base, size_t iov_len) { nccl_ofi_mr_ckey_round(&iov_len, &iov_base, "iovec"); - return (nccl_ofi_mr_ckey_t){ - .iovec = - { - .iov_base = iov_base, - .iov_len = iov_len, - }, - .type = NCCL_OFI_MR_CKEY_IOVEC, - }; + nccl_ofi_mr_ckey_t cache_key = {}; + cache_key.iovec.iov_base = iov_base; + cache_key.iovec.iov_len = iov_len; + cache_key.type = NCCL_OFI_MR_CKEY_IOVEC; + return cache_key; } static inline void nccl_ofi_mr_ckey_fill_mr_attrs(nccl_ofi_mr_ckey_ref ckey, struct fi_mr_attr *attrs, uint64_t *flags) diff --git a/include/nccl_ofi_rdma.h b/include/nccl_ofi_rdma.h index dd8f25008..4cad1a7cd 100644 --- a/include/nccl_ofi_rdma.h +++ b/include/nccl_ofi_rdma.h @@ -9,18 +9,22 @@ extern "C" { #endif +#include "config.h" + #include #include "nccl_ofi.h" -#include "nccl_ofi_log.h" -#include "nccl_ofi_scheduler.h" -#include "nccl_ofi_msgbuff.h" -#include "nccl_ofi_topo.h" #include "nccl_ofi_deque.h" +#include "nccl_ofi_ep_addr_list.h" #include "nccl_ofi_freelist.h" #include "nccl_ofi_idpool.h" -#include "nccl_ofi_tracepoint.h" -#include "nccl_ofi_ep_addr_list.h" +#include "nccl_ofi_log.h" +#include "nccl_ofi_msgbuff.h" +#include "nccl_ofi_scheduler.h" +#include "nccl_ofi_topo.h" +#if HAVE_NVTX_TRACING +#include +#endif /* Maximum number of rails supported. This defines the size of * messages exchanged during connection establishment (linear diff --git a/include/tracing_impl/nvtx.h b/include/tracing_impl/nvtx.h index 76620bc24..3fe22fda9 100644 --- a/include/tracing_impl/nvtx.h +++ b/include/tracing_impl/nvtx.h @@ -8,8 +8,6 @@ #if HAVE_NVTX_TRACING #include -#define NCCL_OFI_N_NVTX_DOMAIN_PER_COMM 8 - static inline void nvtx_mark_domain(nvtxDomainHandle_t domain, const char* name, uint32_t color) { nvtxEventAttributes_t eventAttrib = {}; diff --git a/m4/check_pkg_mpi.m4 b/m4/check_pkg_mpi.m4 index a89333ad9..1b57b552d 100644 --- a/m4/check_pkg_mpi.m4 +++ b/m4/check_pkg_mpi.m4 @@ -31,6 +31,7 @@ AC_DEFUN([CHECK_PKG_MPI], [ LDFLAGS="${MPI_LDFLAGS} ${LDFLAGS}"]) MPICC=${mpi_bindir}mpicc + MPICXX=${mpi_bindir}mpicxx AC_MSG_CHECKING([for working mpicc]) ${MPICC} --help >& AS_MESSAGE_LOG_FD @@ -38,6 +39,7 @@ AC_DEFUN([CHECK_PKG_MPI], [ [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) MPICC="${CC}" + MPICXX="${CXX}" AS_IF([test "${check_pkg_found}" = "yes"], [AC_CHECK_HEADERS([mpi.h], [], [check_pkg_found=no])]) @@ -49,6 +51,7 @@ AC_DEFUN([CHECK_PKG_MPI], [ [$2]) AC_SUBST([MPICC]) + AC_SUBST([MPICXX]) AC_SUBST([MPI_CPPFLAGS]) AC_SUBST([MPI_LDFLAGS]) AC_SUBST([MPI_LIBS]) diff --git a/tests/functional/Makefile.am b/tests/functional/Makefile.am index 7238e6c35..7a4c0986d 100644 --- a/tests/functional/Makefile.am +++ b/tests/functional/Makefile.am @@ -12,13 +12,14 @@ AM_CPPFLAGS += $(MPI_CPPFLAGS) $(CUDA_CPPFLAGS) AM_LDFLAGS = $(MPI_LDFLAGS) $(CUDA_LDFLAGS) LDADD = $(top_builddir)/src/libinternal_net_plugin.la $(MPI_LIBS) $(CUDA_LIBS) CC = $(MPICC) +CXX = $(MPICXX) if ENABLE_FUNC_TESTS -noinst_HEADERS = test-common.h +noinst_HEADERS = test-common.hpp bin_PROGRAMS = nccl_connection nccl_message_transfer ring -nccl_connection_SOURCES = nccl_connection.c -nccl_message_transfer_SOURCES = nccl_message_transfer.c -ring_SOURCES = ring.c +nccl_connection_SOURCES = nccl_connection.cc +nccl_message_transfer_SOURCES = nccl_message_transfer.cc +ring_SOURCES = ring.cc endif diff --git a/tests/functional/nccl_connection.c b/tests/functional/nccl_connection.cc similarity index 99% rename from tests/functional/nccl_connection.c rename to tests/functional/nccl_connection.cc index 3874ec975..15b713612 100644 --- a/tests/functional/nccl_connection.c +++ b/tests/functional/nccl_connection.cc @@ -8,7 +8,7 @@ #include "config.h" -#include "test-common.h" +#include "test-common.hpp" int main(int argc, char* argv[]) { diff --git a/tests/functional/nccl_message_transfer.c b/tests/functional/nccl_message_transfer.cc similarity index 98% rename from tests/functional/nccl_message_transfer.c rename to tests/functional/nccl_message_transfer.cc index 3b2421ba0..9849bc56f 100644 --- a/tests/functional/nccl_message_transfer.c +++ b/tests/functional/nccl_message_transfer.cc @@ -9,14 +9,16 @@ #include "config.h" -#include "test-common.h" +#include "test-common.hpp" #define PROC_NAME_IDX(i) (i * MPI_MAX_PROCESSOR_NAME) int main(int argc, char* argv[]) { ncclResult_t res = ncclSuccess; - int rank, proc_name_len, num_ranks = 0, local_rank = 0, peer_rank = 0; + int rank, proc_name_len, num_ranks = 0, peer_rank = 0; + /* Unused when trace prints are not enabled. */ + [[maybe_unused]] int local_rank = 0; int buffer_type = NCCL_PTR_HOST; test_nccl_properties_t props = {}; @@ -390,7 +392,7 @@ int main(int argc, char* argv[]) MPI_Finalize(); NCCL_OFI_INFO(NCCL_NET, "Test completed successfully for rank %d", rank); -exit:; +exit: ncclResult_t close_res = ncclSuccess; diff --git a/tests/functional/ring.c b/tests/functional/ring.cc similarity index 99% rename from tests/functional/ring.c rename to tests/functional/ring.cc index 77aac75a6..abc4ccb48 100644 --- a/tests/functional/ring.c +++ b/tests/functional/ring.cc @@ -4,7 +4,7 @@ #include "config.h" -#include "test-common.h" +#include "test-common.hpp" #define PROC_NAME_IDX(i) (i * MPI_MAX_PROCESSOR_NAME) diff --git a/tests/functional/test-common.h b/tests/functional/test-common.hpp similarity index 98% rename from tests/functional/test-common.h rename to tests/functional/test-common.hpp index e83017423..51118c1cc 100644 --- a/tests/functional/test-common.h +++ b/tests/functional/test-common.hpp @@ -23,6 +23,10 @@ #include "nccl_ofi_math.h" #include "nccl_ofi_param.h" + +template +constexpr T PROC_NAME_IDX(T i) { return i * MPI_MAX_PROCESSOR_NAME; }; + #define STR2(v) #v #define STR(v) STR2(v) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 858e2e933..9242b8168 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -9,7 +9,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CPPFLAGS += -isystem $(abs_top_srcdir)/3rd-party/nccl/$(DEVICE_INTERFACE)/include AM_CPPFLAGS += -isystem $(abs_top_srcdir)/3rd-party/uthash/include LDADD = $(top_builddir)/src/libinternal_net_plugin.la -noinst_HEADERS = test-common.h +noinst_HEADERS = test-common.hpp noinst_PROGRAMS = \ deque \ @@ -26,7 +26,7 @@ if WANT_PLATFORM_AWS AM_CPPFLAGS += $(CUDA_CPPFLAGS) LDADD += $(CUDA_LIBS) noinst_PROGRAMS += show_tuner_decisions - show_tuner_decisions_SOURCES = show_tuner_decisions.c + show_tuner_decisions_SOURCES = show_tuner_decisions.cc show_tuner_decisions_LDADD = $(top_builddir)/src/libinternal_tuner_plugin.la noinst_PROGRAMS += region_based_tuner region_based_tuner_SOURCES = region_based_tuner.c @@ -34,13 +34,13 @@ if WANT_PLATFORM_AWS endif endif -idpool_SOURCES = idpool.c -deque_SOURCES = deque.c -freelist_SOURCES = freelist.c -msgbuff_SOURCES = msgbuff.c -scheduler_SOURCES = scheduler.c -ep_addr_list_SOURCES = ep_addr_list.c -mr_SOURCES = mr.c +idpool_SOURCES = idpool.cc +deque_SOURCES = deque.cc +freelist_SOURCES = freelist.cc +msgbuff_SOURCES = msgbuff.cc +scheduler_SOURCES = scheduler.cc +ep_addr_list_SOURCES = ep_addr_list.cc +mr_SOURCES = mr.cc TESTS = $(noinst_PROGRAMS) endif diff --git a/tests/unit/deque.c b/tests/unit/deque.cc similarity index 99% rename from tests/unit/deque.c rename to tests/unit/deque.cc index be356cfcb..c562c728f 100644 --- a/tests/unit/deque.c +++ b/tests/unit/deque.cc @@ -6,7 +6,7 @@ #include -#include "test-common.h" +#include "test-common.hpp" #include "nccl_ofi_deque.h" #define test_get_front(deque, expected) \ diff --git a/tests/unit/freelist.c b/tests/unit/freelist.cc similarity index 99% rename from tests/unit/freelist.c rename to tests/unit/freelist.cc index aff7a9536..74c3e846b 100644 --- a/tests/unit/freelist.c +++ b/tests/unit/freelist.cc @@ -6,7 +6,7 @@ #include -#include "test-common.h" +#include "test-common.hpp" #include "nccl_ofi_freelist.h" void *simple_base; diff --git a/tests/unit/idpool.c b/tests/unit/idpool.cc similarity index 99% rename from tests/unit/idpool.c rename to tests/unit/idpool.cc index 770e98a2c..48076eeb3 100644 --- a/tests/unit/idpool.c +++ b/tests/unit/idpool.cc @@ -6,7 +6,7 @@ #include -#include "test-common.h" +#include "test-common.hpp" #include "nccl_ofi_idpool.h" #include "nccl_ofi_math.h" diff --git a/tests/unit/mr.c b/tests/unit/mr.cc similarity index 99% rename from tests/unit/mr.c rename to tests/unit/mr.cc index 1a9b51558..a9f7120ac 100644 --- a/tests/unit/mr.c +++ b/tests/unit/mr.cc @@ -6,7 +6,7 @@ #include -#include "test-common.h" +#include "test-common.hpp" #include "nccl_ofi_mr.h" static inline bool test_lookup_impl(nccl_ofi_mr_cache_t *cache, void *addr, size_t size, diff --git a/tests/unit/msgbuff.c b/tests/unit/msgbuff.cc similarity index 99% rename from tests/unit/msgbuff.c rename to tests/unit/msgbuff.cc index f697ec8ed..0571be812 100644 --- a/tests/unit/msgbuff.c +++ b/tests/unit/msgbuff.cc @@ -8,7 +8,7 @@ #include "nccl_ofi_msgbuff.h" -#include "test-common.h" +#include "test-common.hpp" int main(int argc, char *argv[]) { diff --git a/tests/unit/scheduler.c b/tests/unit/scheduler.cc similarity index 88% rename from tests/unit/scheduler.c rename to tests/unit/scheduler.cc index 7dfcf8233..8e8bc8c77 100644 --- a/tests/unit/scheduler.c +++ b/tests/unit/scheduler.cc @@ -10,8 +10,8 @@ #include #include "nccl_ofi_log.h" +#include "test-common.hpp" #include "nccl_ofi_scheduler.h" -#include "test-common.h" static inline int verify_xfer_info(nccl_net_ofi_xfer_info_t *xfer, nccl_net_ofi_xfer_info_t *ref_xfer, int xfer_id) { @@ -86,12 +86,12 @@ static inline int set_ref_schedule(nccl_net_ofi_schedule_t *schedule, size_t ind } static inline int test_multiplexer(nccl_net_ofi_scheduler_t *scheduler, - int num_rails, - size_t msg_size, - size_t num_stripes, - int *rail_id, - int *offset, - size_t *msg_size_per_stripe) + int num_rails, + size_t msg_size, + size_t num_stripes, + int *rail_id, + size_t *offset, + size_t *msg_size_per_stripe) { int ret = 0; nccl_net_ofi_schedule_t *ref_schedule; @@ -158,7 +158,7 @@ static inline int test_threshold_scheduler() size_t msg_size_per_stripe_1[6][1] = {{msg_sizes_1[0]}, {msg_sizes_1[1]}, {msg_sizes_1[2]}, {msg_sizes_1[3]}, {msg_sizes_1[4]}, {msg_sizes_1[5]}}; int rail_ids_1[6][1] = {{0}, {1}, {2}, {3}, {0}, {1}}; /* In round-robin for each iteration a new rail-id is used */ - int offsets_1[6][1] = {{0}, {0}, {0}, {0}, {0}, {0}}; /* Offset remaines 0 in round robin */ + size_t offsets_1[6][1] = {{0}, {0}, {0}, {0}, {0}, {0}}; /* Offset remaines 0 in round robin */ for (int iter = 0; iter < 6; iter++) { ret = test_multiplexer(scheduler, num_rails, @@ -192,12 +192,12 @@ static inline int test_threshold_scheduler() /* For each message ensure that two rails are used. Also ensure that the rail-id pairs * are round-robin between each schedule */ int rail_ids_2[6][2] = {{2, 3}, {0, 1}, {2, 3}, {0, 1}, {2, 3}, {0, 1}}; - int offsets_2[6][2] = {{0, stripe_size[0]}, - {0, stripe_size[1]}, - {0, stripe_size[2]}, - {0, stripe_size[3]}, - {0, stripe_size[4]}, - {0, stripe_size[5]}}; + size_t offsets_2[6][2] = {{0, stripe_size[0]}, + {0, stripe_size[1]}, + {0, stripe_size[2]}, + {0, stripe_size[3]}, + {0, stripe_size[4]}, + {0, stripe_size[5]}}; size_t msg_size_per_stripe_2[6][2] = {{stripe_size[0], remaining_stripe_size[0]}, {stripe_size[1], remaining_stripe_size[1]}, {stripe_size[2], remaining_stripe_size[2]}, @@ -234,12 +234,12 @@ static inline int test_threshold_scheduler() /* For each message ensure that three rails are used. Also ensure that the rail-id triplets * are round-robin between each schedule */ int rail_ids_3[6][2] = {{2, 3}, {0, 1}, {2, 3}, {0, 1}, {2, 3}, {0, 1}}; - int offsets_3[6][2] = {{0, (stripe_size[0] * 2) / 2}, - {0, (stripe_size[1] * 2) / 2}, - {0, (stripe_size[2] * 2) / 2}, - {0, (stripe_size[3] * 2) / 2}, - {0, (stripe_size[4] * 2) / 2}, - {0, (stripe_size[5] * 2) / 2}}; + size_t offsets_3[6][2] = {{0, (stripe_size[0] * 2) / 2}, + {0, (stripe_size[1] * 2) / 2}, + {0, (stripe_size[2] * 2) / 2}, + {0, (stripe_size[3] * 2) / 2}, + {0, (stripe_size[4] * 2) / 2}, + {0, (stripe_size[5] * 2) / 2}}; size_t msg_size_per_stripe_3[6][2] = {{(stripe_size[0] * 2) / 2, remaining_stripe_size[0]}, {(stripe_size[1] * 2) / 2, remaining_stripe_size[1]}, {(stripe_size[2] * 2) / 2, remaining_stripe_size[2]}, @@ -275,12 +275,12 @@ static inline int test_threshold_scheduler() } /* For each message ensure that all four rails are used. */ int rail_ids_4[6][4] = {{2, 3, 0, 1}, {2, 3, 0, 1}, {2, 3, 0, 1}, {2, 3, 0, 1}, {2, 3, 0, 1}, {2, 3, 0, 1}}; - int offsets_4[6][4] = {{0, stripe_size[0], stripe_size[0] * 2, stripe_size[0] * 3}, - {0, stripe_size[1], stripe_size[1] * 2, stripe_size[1] * 3}, - {0, stripe_size[2], stripe_size[2] * 2, stripe_size[2] * 3}, - {0, stripe_size[3], stripe_size[3] * 2, stripe_size[3] * 3}, - {0, stripe_size[4], stripe_size[4] * 2, stripe_size[4] * 3}, - {0, stripe_size[5], stripe_size[5] * 2, stripe_size[5] * 3}}; + size_t offsets_4[6][4] = {{0, stripe_size[0], stripe_size[0] * 2, stripe_size[0] * 3}, + {0, stripe_size[1], stripe_size[1] * 2, stripe_size[1] * 3}, + {0, stripe_size[2], stripe_size[2] * 2, stripe_size[2] * 3}, + {0, stripe_size[3], stripe_size[3] * 2, stripe_size[3] * 3}, + {0, stripe_size[4], stripe_size[4] * 2, stripe_size[4] * 3}, + {0, stripe_size[5], stripe_size[5] * 2, stripe_size[5] * 3}}; size_t msg_size_per_stripe_4[6][4] = {{stripe_size[0], stripe_size[0], stripe_size[0], remaining_stripe_size[0]}, {stripe_size[1], stripe_size[1], stripe_size[1], remaining_stripe_size[1]}, {stripe_size[2], stripe_size[2], stripe_size[2], remaining_stripe_size[2]}, diff --git a/tests/unit/show_tuner_decisions.c b/tests/unit/show_tuner_decisions.cc similarity index 100% rename from tests/unit/show_tuner_decisions.c rename to tests/unit/show_tuner_decisions.cc diff --git a/tests/unit/test-common.h b/tests/unit/test-common.hpp similarity index 80% rename from tests/unit/test-common.h rename to tests/unit/test-common.hpp index 70b97e329..adb8762dd 100644 --- a/tests/unit/test-common.h +++ b/tests/unit/test-common.hpp @@ -5,14 +5,18 @@ #ifndef TEST_COMMON_H_ #define TEST_COMMON_H_ +#include "config.h" + #include #include #include "nccl_ofi.h" #include "nccl_ofi_log.h" -static inline void logger(ncclDebugLogLevel level, unsigned long flags, const char *filefunc, - int line, const char *fmt, ...) +namespace { + +void logger(ncclDebugLogLevel level, unsigned long flags, const char *filefunc, + int line, char const *const fmt, ...) { va_list vargs; @@ -24,7 +28,7 @@ static inline void logger(ncclDebugLogLevel level, unsigned long flags, const ch printf("INFO: Function: %s Line: %d: ", filefunc, line); break; case NCCL_LOG_TRACE: -#if OFI_NCCL_TRACE +#if defined(OFI_NCCL_TRACE) && OFI_NCCL_TRACE printf("TRACE: Function: %s Line: %d: ", filefunc, line); break; #else @@ -46,4 +50,6 @@ static inline void logger(ncclDebugLogLevel level, unsigned long flags, const ch #pragma GCC diagnostic pop } +} + #endif // End TEST_COMMON_H_