This commit is contained in:
Binyang Li
2023-04-03 06:14:41 +00:00
parent d3c7cc721a
commit 4de3dba818
3 changed files with 22 additions and 16 deletions

View File

@@ -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,

View File

@@ -5,24 +5,28 @@
#include <chrono>
namespace {
std::uint64_t now() {
using clock = std::chrono::steady_clock;
return std::chrono::duration_cast<std::chrono::nanoseconds>(clock::now().time_since_epoch()).count();
}
std::uint64_t now()
{
using clock = std::chrono::steady_clock;
return std::chrono::duration_cast<std::chrono::nanoseconds>(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;
}

View File

@@ -4,8 +4,10 @@
#include <cstdint>
// Can't include <chrono> because of bug with gcc 10.3.0
class timer {
class timer
{
std::uint64_t t0;
public:
timer();
double elapsed() const;