Skip to content

Commit 5e3b8ca

Browse files
fixes for gpu
1 parent b30e666 commit 5e3b8ca

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/test_common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ def test_common_atomicadd(test_context):
1818
1919
GPUKERN void test_atomic_add(GPUGLMEM double* out, int32_t iterations)
2020
{
21-
double sum = 0;
2221
VECTORIZE_OVER(i, iterations);
2322
// If on CPU do some work to avoid the loop being optimized out
2423
#if defined(XO_CONTEXT_CPU_OPENMP)
2524
usleep(10);
2625
#endif
27-
atomicAdd(&sum, 1.0);
26+
atomicAdd(out, 1.0);
2827
END_VECTORIZE;
29-
out[0] = sum;
3028
}
3129
"""
3230

@@ -48,7 +46,7 @@ def test_common_atomicadd(test_context):
4846
xo.Arg(xo.Float64, pointer=True, name="out"),
4947
xo.Arg(xo.Int32, name="iterations"),
5048
],
51-
n_threads="iterations",
49+
n_threads=n_threads,
5250
)
5351
},
5452
)

0 commit comments

Comments
 (0)