Skip to content

Commit

Permalink
sizeof.register_lazy("cupy"): Includes cupy.ndarray handle
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Dec 2, 2020
1 parent 4671da6 commit 159fa02
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dask_cuda/get_device_memory_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ def get_device_memory_objects_cudf_index(obj):


@sizeof.register_lazy("cupy")
def register_cupy():
from cupy.cuda.memory import BaseMemory
def register_cupy(): # NB: this overwrites dask.sizeof.register_cupy()
import cupy.cuda.memory

@sizeof.register(BaseMemory)
def sizeof_cupy_ndarray(x):
@sizeof.register(cupy.cuda.memory.BaseMemory)
def sizeof_cupy_base_memory(x):
return int(x.size)

@sizeof.register(cupy.ndarray)
def sizeof_cupy_ndarray(x):
return int(x.nbytes)

0 comments on commit 159fa02

Please sign in to comment.