File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -659,7 +659,11 @@ class Cells(xo.Struct):
659659 int MAX_CELLS = 3;
660660
661661 GPUKERN
662- uint8_t loop_over(Cells cells, uint64_t* out_counts, uint64_t* out_vals)
662+ uint8_t loop_over(
663+ Cells cells,
664+ GPUGLMEM uint64_t* out_counts,
665+ GPUGLMEM uint64_t* out_vals
666+ )
663667 {
664668 uint8_t success = 1;
665669 int64_t num_cells = Cells_len_ids(cells);
@@ -668,8 +672,6 @@ class Cells(xo.Struct):
668672 int64_t id = Cells_get_ids(cells, i);
669673 int64_t count = Cells_len1_particles(cells, i);
670674
671- printf("Cell ID: %lld\n Particles (count %lld): ", id, count);
672-
673675 if (i >= MAX_CELLS) {
674676 success = 0;
675677 continue;
@@ -682,7 +684,6 @@ class Cells(xo.Struct):
682684
683685 VECTORIZE_OVER(j, num_particles);
684686 int64_t val = ArrNInt64_get(particles, j);
685- printf("%lld ", val);
686687
687688 if (j >= MAX_PARTICLES) {
688689 success = 0;
@@ -691,7 +692,6 @@ class Cells(xo.Struct):
691692
692693 out_vals[i * MAX_PARTICLES + j] = val;
693694 END_VECTORIZE;
694- printf("\n");
695695 }
696696 fflush(stdout);
697697 return success;
Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ def test_common_atomicadd(test_context):
1616 #include "xobjects/headers/common.h"
1717 #include "xobjects/headers/atomicadd.h"
1818
19- GPUKERN
20- double test_atomic_add()
19+ GPUKERN void test_atomic_add(GPUGLMEM double* out)
2120 {
2221 int iterations = 1000;
2322 double sum = 0;
@@ -28,7 +27,7 @@ def test_common_atomicadd(test_context):
2827 #endif
2928 atomicAdd(&sum, 1.0);
3029 END_VECTORIZE;
31- return sum;
30+ *out = sum;
3231 }
3332 """
3433
@@ -45,15 +44,15 @@ def test_common_atomicadd(test_context):
4544 sources = [src ],
4645 kernels = {
4746 "test_atomic_add" : xo .Kernel (
48- args = [],
47+ args = [xo . Arg ( xo . Float64 , pointer = True , name = "out" ) ],
4948 n_threads = n_threads ,
50- ret = xo .Arg (xo .Float64 ),
5149 )
5250 },
5351 )
5452
5553 expected = 1000
56- result = test_context .kernels .test_atomic_add ()
54+ result = np .array ([0 ], dtype = np .float64 )
55+ test_context .kernels .test_atomic_add (out = result )
5756
5857 assert result == expected
5958
You can’t perform that action at this time.
0 commit comments