@@ -9,8 +9,8 @@ void updateStats(sycl::queue myQueue, sycl::buffer<Actor> actorBuf,
9
9
float forceSum = 0 ;
10
10
auto forceSumBuf = sycl::buffer<float >(&forceSum, 1 );
11
11
12
- float activeActors = 0 ;
13
- auto activeActorsBuf = sycl::buffer<float >(&activeActors, 1 );
12
+ int activeActors = 0 ;
13
+ auto activeActorsBuf = sycl::buffer<int >(&activeActors, 1 );
14
14
15
15
// Calculate average force applied to actors this iteration
16
16
myQueue
@@ -37,23 +37,23 @@ void updateStats(sycl::queue myQueue, sycl::buffer<Actor> actorBuf,
37
37
actorBuf.get_access <sycl::access::mode::read>(cgh);
38
38
39
39
auto activeActorsReduction =
40
- sycl::reduction (activeActorsBuf, cgh, sycl::plus<float >());
40
+ sycl::reduction (activeActorsBuf, cgh, sycl::plus<int >());
41
41
42
42
cgh.parallel_for (sycl::range<1 >{actorAcc.size ()},
43
43
activeActorsReduction,
44
44
[=](sycl::id<1 > index, auto &sum) {
45
45
if (!actorAcc[index].getAtDestination ()) {
46
- sum += 1 . 0f ;
46
+ sum += 1 ;
47
47
}
48
48
});
49
49
});
50
50
myQueue.throw_asynchronous ();
51
51
52
52
sycl::host_accessor<float , 1 , sycl::access::mode::read> forceSumHostAcc (
53
53
forceSumBuf);
54
- sycl::host_accessor<float , 1 , sycl::access::mode::read>
54
+ sycl::host_accessor<int , 1 , sycl::access::mode::read>
55
55
activeActorsHostAcc (activeActorsBuf);
56
- averageForces.push_back (forceSumHostAcc[0 ] / activeActorsHostAcc[0 ]);
56
+ averageForces.push_back (forceSumHostAcc[0 ] / float ( activeActorsHostAcc[0 ]) );
57
57
58
58
// Find actors which have reached their destination and record how long
59
59
// it took them
0 commit comments