From 17e8ba17a78da5cdef65d18971510dba24bae5af Mon Sep 17 00:00:00 2001 From: Saeed Maleki Date: Mon, 17 Apr 2023 19:06:58 +0000 Subject: [PATCH] lint + typo fix --- Makefile | 2 +- python/src/_py_mscclpp.cpp | 36 ++++++++++++++++++++---------------- src/ib.cc | 1 - 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 702833d6..25bdef81 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ mscclpp-test: $(LIBTARGET) $(MSCLLPPTESTBINS) cpplint: clang-format-12 -style=file --verbose --Werror --dry-run $(CPPSOURCES) - clang-format-12 --dry-run $(CPPSOURCES) + clang-format-12 --dry-run $(PYTHONCPPSOURCES) cpplint-autofix: clang-format-12 -style=file --verbose --Werror -i $(CPPSOURCES) diff --git a/python/src/_py_mscclpp.cpp b/python/src/_py_mscclpp.cpp index 39bc52e3..e627dcca 100644 --- a/python/src/_py_mscclpp.cpp +++ b/python/src/_py_mscclpp.cpp @@ -1,10 +1,9 @@ +#include #include #include #include #include -#include - #include #include #include @@ -71,14 +70,14 @@ void checkResult( } } -#define RETRY(C, ...) \ -{ \ - mscclppResult_t res; \ - do { \ - res = (C); \ - } while (res == mscclppInProgress); \ - checkResult(res, __VA_ARGS__); \ -} +#define RETRY(C, ...) \ + { \ + mscclppResult_t res; \ + do { \ + res = (C); \ + } while (res == mscclppInProgress); \ + checkResult(res, __VA_ARGS__); \ + } // Maybe return the value, maybe throw an exception. template @@ -98,7 +97,11 @@ struct _Comm { public: _Comm(int rank, int world_size, mscclppComm_t handle) - : _rank(rank), _world_size(world_size), _handle(handle), _is_open(true), _proxies_running(false) {} + : _rank(rank), + _world_size(world_size), + _handle(handle), + _is_open(true), + _proxies_running(false) {} ~_Comm() { close(); } @@ -106,8 +109,8 @@ struct _Comm { void close() { if (_is_open) { if (_proxies_running) { - mscclppProxyStop(_handle); - _proxies_running = false; + mscclppProxyStop(_handle); + _proxies_running = false; } checkResult(mscclppCommDestroy(_handle), "Failed to close comm channel"); _handle = NULL; @@ -245,7 +248,7 @@ NB_MODULE(_py_mscclpp, m) { uint64_t buff_size, mscclppTransport_t transport_type) -> void { if (comm._proxies_running) { - throw std::invalid_argument("Proxy Threads Already Running"); + throw std::invalid_argument("Proxy Threads Already Running"); } RETRY( mscclppConnect( @@ -270,8 +273,9 @@ NB_MODULE(_py_mscclpp, m) { "connection_setup", [](_Comm& comm) -> void { comm.check_open(); - RETRY(mscclppConnectionSetup(comm._handle), - "Failed to setup MSCCLPP connection"); + RETRY( + mscclppConnectionSetup(comm._handle), + "Failed to setup MSCCLPP connection"); }, nb::call_guard(), "Run connection setup for MSCCLPP.") diff --git a/src/ib.cc b/src/ib.cc index 0e1f3567..18a4fa02 100644 --- a/src/ib.cc +++ b/src/ib.cc @@ -304,7 +304,6 @@ int mscclppIbQp::rtr(const mscclppIbQpInfo* info) if (info->linkLayer == IBV_LINK_LAYER_ETHERNET || info->is_grh) { qp_attr.ah_attr.is_global = 1; qp_attr.ah_attr.grh.dgid.global.subnet_prefix = info->spn; - qp_attr.ah_attr.grh.dgid.global.interface_id = info->lid; qp_attr.ah_attr.grh.dgid.global.interface_id = info->iid; qp_attr.ah_attr.grh.flow_label = 0; qp_attr.ah_attr.grh.sgid_index = 0;