Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rdemaria committed Oct 27, 2023
2 parents 2dbff05 + f6d9885 commit 2b899c8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 2 additions & 5 deletions tests/test_shared_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

def test_shared_memory():
for test_context in xo.context.get_test_contexts():

print(repr(test_context))

if isinstance(test_context, xo.ContextCupy):
test_context.default_block_size = 2
test_context.default_shared_mem_size_bytes = (
Expand Down Expand Up @@ -44,10 +42,10 @@ class TestElement(xo.HybridClass):
// reduction with an array of 4 doubles using 2 blocks each 2 threads
// use reduction with interleaved addressing: https://developer.download.nvidia.com/assets/cuda/files/reduction.pdf
// all threads within a block have access to shared memory
unsigned int tid = threadIdx.x; // thread ID within the block: 0,1
unsigned int gid = blockIdx.x*blockDim.x + threadIdx.x; // global thread ID: 0,1,2,3
// init shared memory with chunk of input array
extern __shared__ double sdata[2];
sdata[tid] = input_arr[gid];
Expand All @@ -68,7 +66,6 @@ class TestElement(xo.HybridClass):
def __init__(
self, _context=None, _buffer=None, _offset=None, _xobject=None
):

if _xobject is not None:
self.xoinitialize(
_xobject=_xobject,
Expand Down
2 changes: 1 addition & 1 deletion xobjects/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.8"
__version__ = "0.2.9"
8 changes: 7 additions & 1 deletion xobjects/hybrid_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,13 @@ def to_dict(self, copy_to_cpu=True):

if hasattr(obj, "_store_in_to_dict"):
for nn in obj._store_in_to_dict:
out[nn] = getattr(obj, nn)
ww = getattr(obj, nn)
if hasattr(ww, "to_dict"):
out[nn] = ww.to_dict()
elif hasattr(ww, "_to_dict"):
out[nn] = ww._to_dict()
else:
out[nn] = ww

return out

Expand Down

0 comments on commit 2b899c8

Please sign in to comment.