mirror of
https://github.com/NVIDIA/nccl-tests.git
synced 2026-04-23 16:08:20 +08:00
Add Option to Print Timestamps for Infinite Cycles (#1)
* Add timestamp if test is running infinitely * Add report_timestamps arg * Pretty print with with timestamps --------- Co-authored-by: Scott Moe <moes1@noreply.com>
This commit is contained in:
parent
abc46770a9
commit
c8e5575f50
@ -96,6 +96,7 @@ static int streamnull = 0;
|
||||
static int timeout = 0;
|
||||
static int cudaGraphLaunches = 0;
|
||||
static int report_cputime = 0;
|
||||
static int report_timestamps = 0;
|
||||
static int deviceImpl = 0;
|
||||
|
||||
int deviceCtaCount = 16; // Default number of CTAs for device implementation
|
||||
@ -646,7 +647,19 @@ testResult_t TimeTest(struct threadArgs* args, ncclDataType_t type, const char*
|
||||
setupArgs(size, type, args);
|
||||
char rootName[100];
|
||||
sprintf(rootName, "%6i", root);
|
||||
PRINT("%12li %12li %8s %6s %6s", max(args->sendBytes, args->expectedBytes), args->nbytes / wordSize(type), typeName, opName, rootName);
|
||||
if (run_cycles == 0 && report_timestamps == 1) {
|
||||
time_t t;
|
||||
struct tm *tm_info;
|
||||
char ts[26];
|
||||
|
||||
time(&t);
|
||||
tm_info = localtime(&t);
|
||||
strftime(ts, 26, "%Y-%m-%d-%H-%M-%S", tm_info);
|
||||
PRINT("%21s %12li %12li %8s %6s %6s", ts, max(args->sendBytes, args->expectedBytes), args->nbytes / wordSize(type), typeName, opName, rootName);
|
||||
}
|
||||
else {
|
||||
PRINT("%12li %12li %8s %6s %6s", max(args->sendBytes, args->expectedBytes), args->nbytes / wordSize(type), typeName, opName, rootName);
|
||||
}
|
||||
TESTCHECK(BenchTime(args, type, op, root, 0));
|
||||
TESTCHECK(BenchTime(args, type, op, root, 1));
|
||||
PRINT("\n");
|
||||
@ -845,6 +858,7 @@ int main(int argc, char* argv[]) {
|
||||
{"timeout", required_argument, 0, 'T'},
|
||||
{"cudagraph", required_argument, 0, 'G'},
|
||||
{"report_cputime", required_argument, 0, 'C'},
|
||||
{"report_timestamps", required_argument, 0, 'S'},
|
||||
{"average", required_argument, 0, 'a'},
|
||||
{"local_register", required_argument, 0, 'R'},
|
||||
{"cta_policy", required_argument, 0, 'x'},
|
||||
@ -856,7 +870,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
while(1) {
|
||||
int c;
|
||||
c = getopt_long(argc, argv, "t:g:b:e:i:f:n:m:w:N:p:c:o:d:r:z:y:T:hG:C:a:R:x:D:V:", longopts, &longindex);
|
||||
c = getopt_long(argc, argv, "t:g:b:e:i:f:n:m:w:N:p:c:o:d:r:z:y:T:hG:C:S:a:R:x:D:V:", longopts, &longindex);
|
||||
|
||||
if (c == -1)
|
||||
break;
|
||||
@ -945,6 +959,9 @@ int main(int argc, char* argv[]) {
|
||||
case 'C':
|
||||
report_cputime = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'S':
|
||||
report_timestamps = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'a':
|
||||
average = (int)strtol(optarg, NULL, 0);
|
||||
break;
|
||||
@ -1023,6 +1040,7 @@ int main(int argc, char* argv[]) {
|
||||
"[-T,--timeout <time in seconds>] \n\t"
|
||||
"[-G,--cudagraph <num graph launches>] \n\t"
|
||||
"[-C,--report_cputime <0/1>] \n\t"
|
||||
"[-S,--report_timestamps <0/1> report timestamps (default 0; requires -N 0)] \n\t"
|
||||
"[-a,--average <0/1/2/3> report average iteration time <0=RANK0/1=AVG/2=MIN/3=MAX>] \n\t"
|
||||
"[-R,--local_register <0/1/2> enable local (1) or symmetric (2) buffer registration on send/recv buffers (default: disable (0))] \n\t"
|
||||
"[-x,--cta_policy <0/1/2> set CTA policy (NCCL_CTA_POLICY_DEFAULT (0), NCCL_CTA_POLICY_EFFICIENCY (1), NCCL_CTA_POLICY_ZERO (2)) (default: do not set)] \n\t"
|
||||
@ -1346,14 +1364,19 @@ testResult_t run() {
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
int tsPad = report_timestamps ? 19 : 0;
|
||||
int sizePad = report_timestamps ? 13 : 10;
|
||||
const char* tsLbl = report_timestamps ? "timestamp" : "";
|
||||
const char* tsFmt = report_timestamps ? "%Y-%m-%d-%H-%M-%S" : "";
|
||||
const char* timeStr = report_cputime ? "cputime" : "time";
|
||||
PRINT("#\n");
|
||||
PRINT("# %10s %12s %8s %6s %6s out-of-place in-place \n", "", "", "", "", "");
|
||||
PRINT("# %10s %12s %8s %6s %6s %7s %6s %6s %6s %7s %6s %6s %6s\n", "size", "count", "type", "redop", "root",
|
||||
PRINT("# %*s%*s %12s %8s %6s %6s out-of-place in-place \n", tsPad, "", sizePad, "", "", "", "", "");
|
||||
PRINT("# %*s%*s %12s %8s %6s %6s %7s %6s %6s %6s %7s %6s %6s %6s\n", tsPad, tsLbl, sizePad, "size", "count", "type", "redop", "root",
|
||||
timeStr, "algbw", "busbw", "#wrong", timeStr, "algbw", "busbw", "#wrong");
|
||||
PRINT("# %10s %12s %8s %6s %6s %7s %6s %6s %5s %7s %6s %6s %5s\n", "(B)", "(elements)", "", "", "",
|
||||
PRINT("# %*s%*s %12s %8s %6s %6s %7s %6s %6s %5s %7s %6s %6s %5s\n", tsPad, tsFmt, sizePad, "(B)", "(elements)", "", "", "",
|
||||
"(us)", "(GB/s)", "(GB/s)", "", "(us)", "(GB/s)", "(GB/s)", "");
|
||||
|
||||
|
||||
struct testThread threads[nThreads];
|
||||
memset(threads, 0, sizeof(struct testThread)*nThreads);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user