Skip to content

Commit 61ed91d

Browse files
committed
[dl-cifar] Print both total and compute-only times
Add an extra timer to measure just the computation time without initialisation. Print both at the end.
1 parent 890d3f0 commit 61ed91d

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

dl-cifar/CUDA/main.cuda.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@ int main(int argc, const char** argv) {
6060

6161
DlCifarWorkloadParams workload_params(argc, argv);
6262

63+
Time wallClockCompute = get_time_now();
6364
VitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6465
CaitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6566

67+
double computeTime = calculate_op_time_taken(wallClockCompute);
68+
double totalTime = calculate_op_time_taken(wallClockStart);
69+
double ioTime = dataFileReadTimer->getTotalOpTime();
6670

67-
std::cout << "dataFileReadTimer->getTotalOpTime(): " << dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
68-
std::cout << "dl-cifar - total time for whole calculation: "
69-
<< calculate_op_time_taken(wallClockStart) - dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
71+
std::cout << "dl-cifar - I/O time: " << ioTime << " s" << std::endl;
72+
std::cout << "dl-cifar - compute time: " << computeTime - ioTime << " s" << std::endl;
73+
std::cout << "dl-cifar - total time for whole calculation: " << totalTime - ioTime << " s" << std::endl;
7074

7175
delete timer;
7276
delete dataFileReadTimer;

dl-cifar/HIP/main.hip.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@ int main(int argc, const char** argv) {
5757

5858
DlCifarWorkloadParams workload_params(argc, argv);
5959

60+
Time wallClockCompute = get_time_now();
6061
VitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6162
CaitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6263

64+
double computeTime = calculate_op_time_taken(wallClockCompute);
65+
double totalTime = calculate_op_time_taken(wallClockStart);
66+
double ioTime = dataFileReadTimer->getTotalOpTime();
6367

64-
std::cout << "dataFileReadTimer->getTotalOpTime(): " << dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
65-
std::cout << "dl-cifar - total time for whole calculation: "
66-
<< calculate_op_time_taken(wallClockStart) - dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
68+
std::cout << "dl-cifar - I/O time: " << ioTime << " s" << std::endl;
69+
std::cout << "dl-cifar - compute time: " << computeTime - ioTime << " s" << std::endl;
70+
std::cout << "dl-cifar - total time for whole calculation: " << totalTime - ioTime << " s" << std::endl;
6771

6872
delete timer;
6973
delete dataFileReadTimer;

dl-cifar/SYCL/main.sycl.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,17 @@ int main(int argc, const char** argv) {
5858

5959
DlCifarWorkloadParams workload_params(argc, argv);
6060

61+
Time wallClockCompute = get_time_now();
6162
VitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6263
CaitController::execute(workload_params.getDlNwSizeType(), langHandle, timer, dataFileReadTimer);
6364

65+
double computeTime = calculate_op_time_taken(wallClockCompute);
66+
double totalTime = calculate_op_time_taken(wallClockStart);
67+
double ioTime = dataFileReadTimer->getTotalOpTime();
6468

65-
std::cout << "dataFileReadTimer->getTotalOpTime(): " << dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
66-
std::cout << "dl-cifar - total time for whole calculation: "
67-
<< calculate_op_time_taken(wallClockStart) - dataFileReadTimer->getTotalOpTime() << " s" << std::endl;
69+
std::cout << "dl-cifar - I/O time: " << ioTime << " s" << std::endl;
70+
std::cout << "dl-cifar - compute time: " << computeTime - ioTime << " s" << std::endl;
71+
std::cout << "dl-cifar - total time for whole calculation: " << totalTime - ioTime << " s" << std::endl;
6872

6973
delete timer;
7074
delete dataFileReadTimer;

0 commit comments

Comments
 (0)