Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit c451dc5

Browse files
authored
Correction to range parameter of parallel_for for conformance to SYCL specification. (#188)
1 parent 6183ef2 commit c451dc5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

SYCL/ESIMD/kmeans/kmeans.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,13 @@ int main(int argc, char *argv[]) {
226226
// Actual execution goes here
227227

228228
unsigned int total_threads = (NUM_POINTS - 1) / POINTS_PER_THREAD + 1;
229-
auto GlobalRange = cl::sycl::range<1>(total_threads);
230-
cl::sycl::range<1> LocalRange{1};
231-
auto GlobalRange1 = cl::sycl::range<1>(NUM_CENTROIDS_ACTUAL);
232-
cl::sycl::range<1> LocalRange1 = cl::sycl::range<1>{1};
233229

234230
auto submitJobs = [&]() {
235231
// kmeans
232+
nd_range<1> Range{total_threads, 1};
236233
auto e = q.submit([&](cl::sycl::handler &cgh) {
237234
cgh.parallel_for<class kMeans>(
238-
GlobalRange * LocalRange, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
235+
Range, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
239236
simd<float, 2 * NUM_CENTROIDS_ALLOCATED> centroids(0);
240237
auto centroidsXYXY =
241238
centroids.format<float, NUM_CENTROIDS_ALLOCATED / SIMD_SIZE,
@@ -345,8 +342,9 @@ int main(int argc, char *argv[]) {
345342

346343
// compute centroid position
347344
auto e2 = q.submit([&](cl::sycl::handler &cgh) {
345+
nd_range<1> Range1{NUM_CENTROIDS_ACTUAL, 1};
348346
cgh.parallel_for<class kCompCentroidPos>(
349-
GlobalRange1 * LocalRange1, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
347+
Range1, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
350348
simd<float, SIMD_SIZE> xsum(0);
351349
simd<float, SIMD_SIZE> ysum(0);
352350
simd<int, SIMD_SIZE> npoints(0);

0 commit comments

Comments
 (0)