cupyx.distributed.array.distributed_array#
- cupyx.distributed.array.distributed_array(array, index_map, mode=None)[source]#
Creates a distributed array from the given data.
This function does not check if all elements of the given array are stored in some of the chunks.
- Parameters:
array (array_like) –
DistributedArray
object,cupy.ndarray
object or any other object that can be passed tonumpy.array()
.index_map (dict from int to array indices) – Indices for the chunks that devices with designated IDs own. One device can have multiple chunks, which can be specified as a list of array indices.
mode (mode object, optional) – Mode that determines how overlaps of the chunks are interpreted. Defaults to
cupyx.distributed.array.REPLICA
.
- Return type:
See also
DistributedArray.mode
for details about modes.Example
>>> array = cupy.arange(9).reshape(3, 3) >>> A = distributed_array( ... array, ... {0: [(slice(2), slice(2)), # array[:2, :2] ... slice(None, None, 2)], # array[::2] ... 1: (slice(1, None), 2)}) # array[1:, 2]