Skip to content

Commit 14c7d6d

Browse files
committed
Merge pull request #19 from aurianer/fix_unit
Fix calculation of bandwidth in MiB/s
2 parents 16f1560 + 4c003c1 commit 14c7d6d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

parallel_algos/radix-sort.cu

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@ int main(int argc, char** argv)
7474
memory_tracker.reset();
7575
float timeRadixSortTracked = timeGpu(radixSortTracked);
7676

77+
// time is measured in ms
78+
float time_s = timeRadixSort / 1000;
7779
memory_tracker.print_stats();
7880
std::size_t numBytesMoved = 2lu * numKeys * (sizeof(KeyType) + sizeof(ValueType));
7981
std::printf("radix sort normal time for %zu key-value pairs: %f s, bandwidth: %f MiB/s\n",
80-
numKeys, timeRadixSort / 1000, float(numBytesMoved) / timeRadixSort / 1000);
82+
numKeys, time_s, float(numBytesMoved) / time_s / (1024 * 1024));
83+
time_s = timeRadixSortTracked / 1000;
8184
std::printf(
8285
"radix sort with memory tracking time for %zu key-value pairs: %f s, bandwidth: %f MiB/s\n",
83-
numKeys, timeRadixSortTracked / 1000, float(numBytesMoved) / timeRadixSortTracked / 1000);
86+
numKeys, time_s, float(numBytesMoved) / time_s / (1024 * 1024));
8487

8588
return 0;
8689
}

parallel_algos/reduce.cu

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ int main(int argc, char** argv)
6464
memory_tracker.reset();
6565
float timeReduceTracked = timeGpu(reduceTracked);
6666

67+
// time is measured in ms
68+
float time_s = timeReduce / 1000;
6769
memory_tracker.print_stats();
6870
std::size_t numBytesMoved = numValues * sizeof(ValueType);
6971
std::printf("reduction normal time for %zu values: %f s, bandwidth: %f MiB/s\n", numValues,
70-
timeReduce / 1000, float(numBytesMoved) / timeReduce / 1000);
72+
time_s, float(numBytesMoved) / time_s / (1024 * 1024));
73+
time_s = timeReduceTracked / 1000;
7174
std::printf("reduction with memory tracking time for %zu values: %f s, bandwidth: %f MiB/s\n",
72-
numValues, timeReduceTracked / 1000, float(numBytesMoved) / timeReduceTracked / 1000);
75+
numValues, time_s, float(numBytesMoved) / time_s / (1024 * 1024));
7376

7477
if (power <= 25)
7578
{

parallel_algos/scan.cu

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ int main(int argc, char** argv)
7777
memory_tracker.reset();
7878
float timeScanTracked = timeGpu(scanTracked);
7979

80+
// time is measured in ms
81+
float time_s = timeScan / 1000;
8082
memory_tracker.print_stats();
8183
std::size_t numBytesMoved = 2lu * numValues * sizeof(ValueType);
8284
std::printf("exclusive scan normal time for %zu values: %f s, bandwidth: %f MiB/s\n", numValues,
83-
timeScan / 1000, float(numBytesMoved) / timeScan / 1000);
85+
time_s, float(numBytesMoved) / time_s / (1024 * 1024));
86+
time_s = timeScanTracked / 1000;
8487
std::printf(
8588
"exclusive scan with memory tracking time for %zu values: %f s, bandwidth: %f MiB/s\n",
86-
numValues, timeScanTracked / 1000, float(numBytesMoved) / timeScanTracked / 1000);
89+
numValues, time_s, float(numBytesMoved) / time_s / (1024 * 1024));
8790

8891
if (power <= 25)
8992
{

0 commit comments

Comments
 (0)