Skip to content

Commit 9a0ecb7

Browse files
committed
Create buffer from all but first element to avoid expensive deletion
1 parent abb6227 commit 9a0ecb7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.vscode
2+
/build

external/Stats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ void finalizeStats(sycl::queue myQueue, std::vector<float> averageForces,
124124

125125
auto kernelDurationsForOutput = kernelDurations;
126126
// Discard first kernel time to prevent skewed results
127-
kernelDurations.erase(kernelDurations.begin());
128127
auto kernelDurationsBuf =
129-
sycl::buffer<int>(kernelDurations.data(), kernelDurations.size());
128+
sycl::buffer<int>(kernelDurations.data() + 1, kernelDurations.size());
130129

131130
// Calculate average kernel duration
132131
myQueue.submit([&](sycl::handler &cgh) {
@@ -136,6 +135,7 @@ void finalizeStats(sycl::queue myQueue, std::vector<float> averageForces,
136135
auto sumReduction =
137136
sycl::reduction(durationSumBuf, cgh, sycl::plus<int>());
138137

138+
auto out = sycl::stream{64, 1028, cgh};
139139
cgh.parallel_for(sycl::range<1>{durationAcc.size()}, sumReduction,
140140
[=](sycl::id<1> index, auto &sum) {
141141
sum += durationAcc[index];

0 commit comments

Comments
 (0)