katgpucbf.mapped_array module

Implement MappedArray.

class katgpucbf.mapped_array.MappedArray(host: ndarray, device: DeviceArray)[source]

Bases: object

An 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 MappedArray to 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 IOSlotBase for convenience, but it must actually be an instance of IOSlot.

host: ndarray
katgpucbf.mapped_array.make_vkgdr(device: AbstractDevice) <MagicMock id='140228911845920'>[source]

Create a vkgdr.Vkgdr for a given device.

The device must be a CUDA device. The returned handle uses coherent mappings, which are suitable for use with MappedArray.