From c8e5575f5038e98f7922d26dd45317ed44872e52 Mon Sep 17 00:00:00 2001 From: yakovdyadkin <107515145+yakovdyadkin@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:48:16 -0500 Subject: [PATCH] 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 --- src/common.cu | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/common.cu b/src/common.cu index 4b8e8c0..4a1b5fd 100644 --- a/src/common.cu +++ b/src/common.cu @@ -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