Add option for stress testing

This commit is contained in:
Wenkai Du
2020-03-11 13:40:17 -07:00
förälder bd53e98df3
incheckning 6e9e05972b
+16 -8
Visa fil
@@ -51,6 +51,7 @@ static int ncclroot = 0;
static int parallel_init = 0; static int parallel_init = 0;
static int blocking_coll = 0; static int blocking_coll = 0;
static int memorytype = 0; static int memorytype = 0;
static int stress_cycles = 1;
static ncclResult_t ncclabort = ncclSuccess; static ncclResult_t ncclabort = ncclSuccess;
double parsesize(char *value) { double parsesize(char *value) {
@@ -573,13 +574,16 @@ testResult_t TimeTest(struct threadArgs* args, ncclDataType_t type, const char*
} }
TESTCHECK(completeColl(args)); TESTCHECK(completeColl(args));
// Benchmark for (size_t iter = 0; iter < stress_cycles; iter++) {
for (size_t size = args->minbytes; size<=args->maxbytes; size = ((args->stepfactor > 1) ? size*args->stepfactor : size+args->stepbytes)) { if (iter > 0) PRINT("# Testing %d cycle.\n", iter+1);
setupArgs(size, type, args); // Benchmark
print_line_header(std::max(args->sendBytes, args->expectedBytes), args->nbytes / wordSize(type), typeName, opName, root); for (size_t size = args->minbytes; size<=args->maxbytes; size = ((args->stepfactor > 1) ? size*args->stepfactor : size+args->stepbytes)) {
TESTCHECK(BenchTime(args, type, op, root, 0)); setupArgs(size, type, args);
TESTCHECK(BenchTime(args, type, op, root, 1)); print_line_header(std::max(args->sendBytes, args->expectedBytes), args->nbytes / wordSize(type), typeName, opName, root);
PRINT("\n"); TESTCHECK(BenchTime(args, type, op, root, 0));
TESTCHECK(BenchTime(args, type, op, root, 1));
PRINT("\n");
}
} }
return testSuccess; return testSuccess;
} }
@@ -683,12 +687,13 @@ int main(int argc, char* argv[]) {
{"root", required_argument, 0, 'r'}, {"root", required_argument, 0, 'r'},
{"blocking", required_argument, 0, 'z'}, {"blocking", required_argument, 0, 'z'},
{"memory_type", required_argument, 0, 'y'}, {"memory_type", required_argument, 0, 'y'},
{"stress_cycles", required_argument, 0, 's'},
{"help", no_argument, 0, 'h'} {"help", no_argument, 0, 'h'}
}; };
while(1) { while(1) {
int c; int c;
c = getopt_long(argc, argv, "t:g:b:e:i:f:n:m:w:p:c:o:d:r:z:y:h", longopts, &longindex); c = getopt_long(argc, argv, "t:g:b:e:i:f:n:m:w:p:c:o:d:r:z:y:s:h", longopts, &longindex);
if (c == -1) if (c == -1)
break; break;
@@ -746,6 +751,9 @@ int main(int argc, char* argv[]) {
case 'y': case 'y':
memorytype = ncclstringtomtype(optarg); memorytype = ncclstringtomtype(optarg);
break; break;
case 's':
stress_cycles = strtol(optarg, NULL, 0);
break;
case 'h': case 'h':
printf("USAGE: %s \n\t" printf("USAGE: %s \n\t"
"[-t,--nthreads <num threads>] \n\t" "[-t,--nthreads <num threads>] \n\t"