katgpucbf.mapped_array module
Implement MappedArray.
- class katgpucbf.mapped_array.MappedArray(host: ndarray, device: DeviceArray)[source]
Bases:
objectAn array visible in the address space of both the host and the device.
The host view can be updated using normal numpy code, and the changes will be visible to subsequently enqueued kernels on the device.
- device: DeviceArray
- classmethod from_slot(vkgdr_handle: <MagicMock id='140228911845920'>, context: ~katsdpsigproc.abc.AbstractContext, slot: ~katsdpsigproc.accel.IOSlotBase) Self[source]
Allocate a
MappedArrayto match a slot.- Parameters:
vkgdr_handle – Handle for allocating memory from vkgdr. It must be created from the same device as context.
context – CUDA context in which the device view will be used.
slot – Slot from which the dtype, shape and padded shape will be extracted. The parameter is annotated as
IOSlotBasefor convenience, but it must actually be an instance ofIOSlot.
- katgpucbf.mapped_array.make_vkgdr(device: AbstractDevice) <MagicMock id='140228911845920'>[source]
Create a
vkgdr.Vkgdrfor a given device.The device must be a CUDA device. The returned handle uses coherent mappings, which are suitable for use with
MappedArray.