From 4de3dba8182cd37dab6c4452f7f8a5ebe2e34ad9 Mon Sep 17 00:00:00 2001 From: Binyang Li Date: Mon, 3 Apr 2023 06:14:41 +0000 Subject: [PATCH] fix lint --- tests/common.h | 12 ++++++------ tests/timer.cc | 22 +++++++++++++--------- tests/timer.h | 4 +++- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/common.h b/tests/common.h index b7e2c226..1fffcbac 100644 --- a/tests/common.h +++ b/tests/common.h @@ -53,7 +53,8 @@ } \ } while (0) -typedef enum { +typedef enum +{ testSuccess = 0, testInternalError = 1, testCudaError = 2, @@ -62,12 +63,11 @@ typedef enum { testNumResults = 5 } testResult_t; -struct testColl { +struct testColl +{ const char name[20]; - void (*getCollByteCount)( - size_t *sendcount, size_t *recvcount, size_t *paramcount, - size_t *sendInplaceOffset, size_t *recvInplaceOffset, - size_t count, int nranks); + void (*getCollByteCount)(size_t* sendcount, size_t* recvcount, size_t* paramcount, size_t* sendInplaceOffset, + size_t* recvInplaceOffset, size_t count, int nranks); testResult_t (*initData)(struct threadArgs* args, int in_place); void (*getBw)(size_t count, int typesize, double sec, double* algBw, double* busBw, int nranks); testResult_t (*runColl)(void* sendbuff, void* recvbuff, int nranksPerNode, size_t count, mscclppComm_t comm, diff --git a/tests/timer.cc b/tests/timer.cc index eb510d9a..28477ae8 100644 --- a/tests/timer.cc +++ b/tests/timer.cc @@ -5,24 +5,28 @@ #include namespace { - std::uint64_t now() { - using clock = std::chrono::steady_clock; - return std::chrono::duration_cast(clock::now().time_since_epoch()).count(); - } +std::uint64_t now() +{ + using clock = std::chrono::steady_clock; + return std::chrono::duration_cast(clock::now().time_since_epoch()).count(); } +} // namespace -timer::timer() { +timer::timer() +{ t0 = now(); } -double timer::elapsed() const { +double timer::elapsed() const +{ std::uint64_t t1 = now(); - return 1.e-9*(t1 - t0); + return 1.e-9 * (t1 - t0); } -double timer::reset() { +double timer::reset() +{ std::uint64_t t1 = now(); - double ans = 1.e-9*(t1 - t0); + double ans = 1.e-9 * (t1 - t0); t0 = t1; return ans; } \ No newline at end of file diff --git a/tests/timer.h b/tests/timer.h index 6edfdd4c..c30b264c 100644 --- a/tests/timer.h +++ b/tests/timer.h @@ -4,8 +4,10 @@ #include // Can't include because of bug with gcc 10.3.0 -class timer { +class timer +{ std::uint64_t t0; + public: timer(); double elapsed() const;