Skip to content

Commit 033ffe8

Browse files
committed
another race
1 parent 5d57377 commit 033ffe8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/cpu/primitives.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ namespace ctranslate2 {
294294
template<>
295295
template<>
296296
void primitives<Device::CPU>::relu(const float* x, float* y, dim_t size) {
297+
298+
int sum = 0;
299+
int n = 10000;
300+
301+
#pragma omp parallel for reduction(+:sum)
302+
for (int i = 0; i < n; i++) {
303+
sum += i; // Each thread has private copy, combined at end
304+
}
305+
306+
297307
float sum = 0.0f; // Shared state
298308

299309
cpu::parallel_for(0, size, cpu::GRAIN_SIZE,

0 commit comments

Comments
 (0)