Merge pull request #44 from ROCm/fix-printing

Clean up functional tests output

[ROCm/rocshmem commit: 9885f984f6]
This commit is contained in:
Yiltan
2024-10-28 15:45:28 -04:00
gecommit door GitHub
bovenliggende bd3a07d28b 0ed689439b
commit da9466f7cc
2 gewijzigde bestanden met toevoegingen van 73 en 66 verwijderingen
@@ -82,66 +82,66 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
CHECK_HIP(hipGetDeviceProperties(&deviceProps, device_id));
numWarps = (args.wg_size - 1) / deviceProps.warpSize + 1;
if (rank == 0) std::cout << "*** Creating Test: ";
if (rank == 0) std::cout << "### Creating Test: ";
TestType type = (TestType)args.algorithm;
switch (type) {
case InitTestType:
if (rank == 0) std::cout << "Init ***" << std::endl;
if (rank == 0) std::cout << "Init ###" << std::endl;
testers.push_back(new EmptyTester(args));
return testers;
case GetTestType:
if (rank == 0) std::cout << "Blocking Gets***" << std::endl;
if (rank == 0) std::cout << "Blocking Gets ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case GetNBITestType:
if (rank == 0) std::cout << "Non-Blocking Gets***" << std::endl;
if (rank == 0) std::cout << "Non-Blocking Gets ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case PutTestType:
if (rank == 0) std::cout << "Blocking Puts***" << std::endl;
if (rank == 0) std::cout << "Blocking Puts ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case PutNBITestType:
if (rank == 0) std::cout << "Non-Blocking Puts***" << std::endl;
if (rank == 0) std::cout << "Non-Blocking Puts ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case TeamCtxInfraTestType:
if (rank == 0) std::cout << "Team Ctx Infra test***" << std::endl;
if (rank == 0) std::cout << "Team Ctx Infra test ###" << std::endl;
testers.push_back(new TeamCtxInfraTester(args));
return testers;
case TeamCtxGetTestType:
if (rank == 0) std::cout << "Blocking Team Ctx Gets***" << std::endl;
if (rank == 0) std::cout << "Blocking Team Ctx Gets ###" << std::endl;
testers.push_back(new TeamCtxPrimitiveTester(args));
return testers;
case TeamCtxGetNBITestType:
if (rank == 0) std::cout << "Non-Blocking Team Ctx Gets***" << std::endl;
if (rank == 0) std::cout << "Non-Blocking Team Ctx Gets ###" << std::endl;
testers.push_back(new TeamCtxPrimitiveTester(args));
return testers;
case TeamCtxPutTestType:
if (rank == 0) std::cout << "Blocking Team Ctx Puts***" << std::endl;
if (rank == 0) std::cout << "Blocking Team Ctx Puts ###" << std::endl;
testers.push_back(new TeamCtxPrimitiveTester(args));
return testers;
case TeamCtxPutNBITestType:
if (rank == 0) std::cout << "Non-Blocking Team Ctx Puts***" << std::endl;
if (rank == 0) std::cout << "Non-Blocking Team Ctx Puts ###" << std::endl;
testers.push_back(new TeamCtxPrimitiveTester(args));
return testers;
case PTestType:
if (rank == 0) std::cout << "P Test***" << std::endl;
if (rank == 0) std::cout << "P Test ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case GTestType:
if (rank == 0) std::cout << "G Test***" << std::endl;
if (rank == 0) std::cout << "G Test ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
case GetSwarmTestType:
if (rank == 0) std::cout << "Get Swarm***" << std::endl;
if (rank == 0) std::cout << "Get Swarm ###" << std::endl;
testers.push_back(new GetSwarmTester(args));
return testers;
case TeamReductionTestType:
if (rank == 0)
std::cout << "All-to-All Team-based Reduction***" << std::endl;
std::cout << "All-to-All Team-based Reduction ###" << std::endl;
testers.push_back(new TeamReductionTester<float, ROC_SHMEM_SUM>(
args,
[](float& f1, float& f2) {
@@ -157,7 +157,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
}));
return testers;
case ReductionTestType:
if (rank == 0) std::cout << "All-to-All Reduction***" << std::endl;
if (rank == 0) std::cout << "All-to-All Reduction ###" << std::endl;
testers.push_back(new ReductionTester<float, ROC_SHMEM_SUM>(
args,
@@ -245,7 +245,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
return testers;
case BroadcastTestType:
if (rank == 0) {
std::cout << "Broadcast Test***" << std::endl;
std::cout << "Broadcast Test ###" << std::endl;
}
testers.push_back(new BroadcastTester<long>(
args,
@@ -282,7 +282,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
return testers;
case TeamBroadcastTestType:
if (rank == 0) {
std::cout << "Team Broadcast Test***" << std::endl;
std::cout << "Team Broadcast Test ###" << std::endl;
}
testers.push_back(new TeamBroadcastTester<long>(
args,
@@ -319,7 +319,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
return testers;
case AllToAllTestType:
if (rank == 0) {
std::cout << "Alltoall Test***" << std::endl;
std::cout << "Alltoall Test ###" << std::endl;
}
testers.push_back(new AlltoallTester<int64_t>(
args,
@@ -345,7 +345,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
return testers;
case FCollectTestType:
if (rank == 0) {
std::cout << "Fcollect Test***" << std::endl;
std::cout << "Fcollect Test ###" << std::endl;
}
testers.push_back(new FcollectTester<int64_t>(
args,
@@ -365,188 +365,188 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
}));
return testers;
case AMO_FAddTestType:
if (rank == 0) std::cout << "AMO Fetch_Add***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch_Add ###" << std::endl;
testers.push_back(new AMOStandardTester<long long>(args));
testers.push_back(new AMOStandardTester<long>(args));
testers.push_back(new AMOStandardTester<int>(args));
return testers;
case AMO_FIncTestType:
if (rank == 0) std::cout << "AMO Fetch_Inc***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch_Inc ###" << std::endl;
testers.push_back(new AMOStandardTester<long long>(args));
testers.push_back(new AMOStandardTester<long>(args));
testers.push_back(new AMOStandardTester<int>(args));
return testers;
case AMO_FetchTestType:
if (rank == 0) std::cout << "AMO Fetch***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch ###" << std::endl;
testers.push_back(new AMOExtendedTester<long long>(args));
testers.push_back(new AMOExtendedTester<long>(args));
testers.push_back(new AMOExtendedTester<int>(args));
return testers;
case AMO_FCswapTestType:
if (rank == 0) std::cout << "AMO Fetch_CSWAP***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch_CSWAP ###" << std::endl;
testers.push_back(new AMOStandardTester<long long>(args));
testers.push_back(new AMOStandardTester<long>(args));
testers.push_back(new AMOStandardTester<int>(args));
return testers;
case AMO_AddTestType:
if (rank == 0) std::cout << "AMO Add***" << std::endl;
if (rank == 0) std::cout << "AMO Add ###" << std::endl;
testers.push_back(new AMOStandardTester<long long>(args));
testers.push_back(new AMOStandardTester<long>(args));
testers.push_back(new AMOStandardTester<int>(args));
return testers;
case AMO_SetTestType:
if (rank == 0) std::cout << "AMO Set***" << std::endl;
if (rank == 0) std::cout << "AMO Set ###" << std::endl;
testers.push_back(new AMOExtendedTester<long long>(args));
testers.push_back(new AMOExtendedTester<long>(args));
testers.push_back(new AMOExtendedTester<int>(args));
return testers;
case AMO_SwapTestType:
if (rank == 0) std::cout << "AMO Swap***" << std::endl;
if (rank == 0) std::cout << "AMO Swap ###" << std::endl;
testers.push_back(new AMOExtendedTester<long long>(args));
testers.push_back(new AMOExtendedTester<long>(args));
testers.push_back(new AMOExtendedTester<int>(args));
return testers;
case AMO_FetchAndTestType:
if (rank == 0) std::cout << "AMO Fetch And***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch And ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_AndTestType:
if (rank == 0) std::cout << "AMO And***" << std::endl;
if (rank == 0) std::cout << "AMO And ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_FetchOrTestType:
if (rank == 0) std::cout << "AMO Fetch Or***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch Or ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_OrTestType:
if (rank == 0) std::cout << "AMO Or***" << std::endl;
if (rank == 0) std::cout << "AMO Or ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_FetchXorTestType:
if (rank == 0) std::cout << "AMO Fetch Xor***" << std::endl;
if (rank == 0) std::cout << "AMO Fetch Xor ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_XorTestType:
if (rank == 0) std::cout << "AMO Xor***" << std::endl;
if (rank == 0) std::cout << "AMO Xor ###" << std::endl;
testers.push_back(new AMOBitwiseTester<unsigned long long>(args));
testers.push_back(new AMOBitwiseTester<unsigned long>(args));
testers.push_back(new AMOBitwiseTester<unsigned int>(args));
return testers;
case AMO_IncTestType:
if (rank == 0) std::cout << "AMO Inc***" << std::endl;
if (rank == 0) std::cout << "AMO Inc ###" << std::endl;
testers.push_back(new AMOStandardTester<long long>(args));
testers.push_back(new AMOStandardTester<long>(args));
testers.push_back(new AMOStandardTester<int>(args));
return testers;
case PingPongTestType:
if (rank == 0) std::cout << "PingPong***" << std::endl;
if (rank == 0) std::cout << "PingPong ###" << std::endl;
testers.push_back(new PingPongTester(args));
return testers;
case PingAllTestType:
if (rank == 0) std::cout << "PingAll***" << std::endl;
if (rank == 0) std::cout << "PingAll ###" << std::endl;
testers.push_back(new PingAllTester(args));
return testers;
case BarrierAllTestType:
if (rank == 0) std::cout << "Barrier_All***" << std::endl;
if (rank == 0) std::cout << "Barrier_All ###" << std::endl;
testers.push_back(new BarrierAllTester(args));
return testers;
case SyncAllTestType:
if (rank == 0) std::cout << "SyncAll***" << std::endl;
if (rank == 0) std::cout << "SyncAll ###" << std::endl;
testers.push_back(new SyncTester(args));
return testers;
case SyncTestType:
if (rank == 0) std::cout << "Sync***" << std::endl;
if (rank == 0) std::cout << "Sync ###" << std::endl;
testers.push_back(new SyncTester(args));
return testers;
case RandomAccessTestType:
if (rank == 0) std::cout << "Random_Access***" << std::endl;
if (rank == 0) std::cout << "Random_Access ###" << std::endl;
testers.push_back(new RandomAccessTester(args));
return testers;
case ShmemPtrTestType:
if (rank == 0) std::cout << "Shmem_Ptr***" << std::endl;
if (rank == 0) std::cout << "Shmem_Ptr ###" << std::endl;
testers.push_back(new ShmemPtrTester(args));
return testers;
case WGGetTestType:
if (rank == 0) {
if (args.num_wgs > 1)
std::cout << "Tiled Blocking WG level Gets***" << std::endl;
else std::cout << "Blocking WG level Gets***" << std::endl;
std::cout << "Tiled Blocking WG level Gets ###" << std::endl;
else std::cout << "Blocking WG level Gets ###" << std::endl;
}
testers.push_back(new ExtendedPrimitiveTester(args));
return testers;
case WGGetNBITestType:
if (rank == 0) {
if (args.num_wgs > 1)
std::cout << "Tiled Non-Blocking WG level Gets***" << std::endl;
else std::cout << "Non-Blocking WG level Gets***" << std::endl;
std::cout << "Tiled Non-Blocking WG level Gets ###" << std::endl;
else std::cout << "Non-Blocking WG level Gets ###" << std::endl;
}
testers.push_back(new ExtendedPrimitiveTester(args));
return testers;
case WGPutTestType:
if (rank == 0) {
if (args.num_wgs > 1)
std::cout << "Tiled Blocking WG level Puts***" << std::endl;
else std::cout << "Blocking WG level Puts***" << std::endl;
std::cout << "Tiled Blocking WG level Puts ###" << std::endl;
else std::cout << "Blocking WG level Puts ###" << std::endl;
}
testers.push_back(new ExtendedPrimitiveTester(args));
return testers;
case WGPutNBITestType:
if (rank == 0) {
if (args.num_wgs > 1)
std::cout << "Tiled Non-Blocking WG level Puts***" << std::endl;
else std::cout << "Non-Blocking WG level Puts***" << std::endl;
std::cout << "Tiled Non-Blocking WG level Puts ###" << std::endl;
else std::cout << "Non-Blocking WG level Puts ###" << std::endl;
}
testers.push_back(new ExtendedPrimitiveTester(args));
return testers;
case PutNBIMRTestType:
if (rank == 0)
std::cout << "Non-Blocking Put message rate***" << std::endl;
std::cout << "Non-Blocking Put message rate ###" << std::endl;
testers.push_back(new PrimitiveMRTester(args));
return testers;
case WAVEGetTestType:
if (rank == 0) {
if (args.num_wgs > 1 || numWarps > 1)
std::cout << "Tiled Blocking WAVE level Gets***" << std::endl;
else std::cout << "Blocking WAVE level Gets***" << std::endl;
std::cout << "Tiled Blocking WAVE level Gets ###" << std::endl;
else std::cout << "Blocking WAVE level Gets ###" << std::endl;
}
testers.push_back(new WaveLevelPrimitiveTester(args));
return testers;
case WAVEGetNBITestType:
if (rank == 0) {
if (args.num_wgs > 1 || numWarps > 1)
std::cout << "Tiled Non-Blocking WAVE level Gets***" << std::endl;
else std::cout << "Non-Blocking WAVE level Gets***" << std::endl;
std::cout << "Tiled Non-Blocking WAVE level Gets ###" << std::endl;
else std::cout << "Non-Blocking WAVE level Gets ###" << std::endl;
}
testers.push_back(new WaveLevelPrimitiveTester(args));
return testers;
case WAVEPutTestType:
if (rank == 0) {
if (args.num_wgs > 1 || numWarps > 1)
std::cout << "Tiled Blocking WAVE level Puts***" << std::endl;
else std::cout << "Blocking WAVE level Puts***" << std::endl;
std::cout << "Tiled Blocking WAVE level Puts ###" << std::endl;
else std::cout << "Blocking WAVE level Puts ###" << std::endl;
}
testers.push_back(new WaveLevelPrimitiveTester(args));
return testers;
case WAVEPutNBITestType:
if (rank == 0) {
if (args.num_wgs > 1 || numWarps > 1)
std::cout << "Tiled Non-Blocking WAVE level Puts***" << std::endl;
else std::cout << "Non-Blocking WAVE level Puts***" << std::endl;
std::cout << "Tiled Non-Blocking WAVE level Puts ###" << std::endl;
else std::cout << "Non-Blocking WAVE level Puts ###" << std::endl;
}
testers.push_back(new WaveLevelPrimitiveTester(args));
return testers;
default:
if (rank == 0) std::cout << "Unknown***" << std::endl;
if (rank == 0) std::cout << "Unknown ###" << std::endl;
testers.push_back(new PrimitiveTester(args));
return testers;
}
@@ -688,14 +688,20 @@ void Tester::print(uint64_t size) {
int field_width = 20;
int float_precision = 2;
printf("\n##### Message Size %lu #####\n", size);
if (_print_header) {
printf("%-*s%*s%*s%*s",
10, "# Size (B)",
field_width, "Latency (us)",
field_width, "Bandwidth (GB/s)",
field_width + 1, "Msg Rate (Msg/s)\n");
_print_header = 0;
}
printf("%*s%*s%*s\n", field_width + 1, "Latency AVG (us)", field_width + 1,
"Bandwidth (GB/s)", field_width + 1, "Avg Message rate (Messages/s)");
printf("%*.*f %*.*f %*.*f\n", field_width, float_precision, latency_avg,
field_width, float_precision, bandwidth_avg_gbs, field_width,
float_precision, avg_msg_rate);
printf("%-*lu%*.*f%*.*f%*.*f\n",
10, size,
field_width, float_precision, latency_avg,
field_width, float_precision, bandwidth_avg_gbs,
field_width, float_precision, avg_msg_rate);
fflush(stdout);
}
@@ -132,6 +132,7 @@ class Tester {
uint64_t *timer = nullptr;
private:
bool _print_header = 1;
void print(uint64_t size);
void barrier();