Open miguelcarcamov opened 1 month ago
It seems map_blocks inference fails for object dtype arrays? Could this dtype be forced by passing a dtype parameter to map_blocks?
The dtype will need to be passed into cupy.as_array
instead of map_blocks
. Code to change would be somewhere here:
Might need to wrap cupy.as_array
in functools.partial
with an extra dtype
argument, and then pass that on to map_blocks
. Do you want to open a PR for this?
since I just saw this: you might be able to use
if isinstance(self.da.data, dask_array_type):
data = self.da.data.map_blocks(cp.asarray)
return self.da.copy(data=data)
return self.da.copy(data=cp.asarray(self.da.data))
It seems that cupy
is unable to transfer object and string dtype objects to GPU. What I would do in this is case is to test if the dtype corresponds to any of that and if it does then transfer it to cupy, otherwise return the same array. What do you think?
I'm trying to convert the following xarray dataset to xarray cupy:
However, I'm getting the following error:
It seems map_blocks inference fails for object dtype arrays? Could this dtype be forced by passing a dtype parameter to map_blocks?