tvm-clj.device

Operations on a device. Devices, such as a GPU, need to be addressed independently and once you have a device you can allocate a tensor on that device.

  • Device types are keywords: #{:cpu :cuda :opencl}
  • Device ids are integers starting from zero.

copy-tensor!

(copy-tensor! src-tens dest-tens stream)(copy-tensor! src-tens dest-tens)

Copy a src tensor to a destination tensor.

cpu->device

(cpu->device tensor device-type device-id {:keys [stream], :as options})(cpu->device tensor device-type device-id)

Ensure a tensor is on a device copying if necessary.

device->cpu

(device->cpu dev-tens {:keys [stream unsynchronized?]})(device->cpu dev-tens)

Ensure a tensor is on a device copying if necessary.

device-attributes

(device-attributes device-type device-id)

device-exists?

(device-exists? device-type device-id)

device-tensor

(device-tensor shape datatype device-type device-id options)(device-tensor shape datatype device-type device-id)(device-tensor src-tens-prototype device-type device-id)

Allocate a device tensor.

sync-with-host

(sync-with-host device-type device-id)

Synchonize the device stream with the host