Skip to contents

Create a backend

Usage

AnvlBackend(
  new_data,
  new_empty,
  dtype,
  shape,
  ambiguous,
  as_array,
  as_raw,
  platform,
  device,
  new_device,
  print_data,
  jit,
  await_data
)

Arguments

new_data

(function)
Constructs an AnvlArray from R data. This should be a structure() with at least a $data field that contains the actual underlying data (PJRTBuffer for "pjrt" backend, array() for "quickr" backend).

new_empty

(function)
Constructs an AnvlArray of the given dtype and shape with unspecified contents. Called by nv_empty().

dtype

(function)
Extracts the dtype from an AnvlArray.

shape

(function)
Extracts the shape from an AnvlArray.

ambiguous

(function)
Extracts the ambiguous flag from an AnvlArray.

as_array

(function(x, check))
Converts an AnvlArray to an R array. The check flag is forwarded from as_array(); backends may use it to abort when materialization would lose information (e.g. ui64 values wrapping through bit64::integer64). See pjrt::as_array.PJRTBuffer().

as_raw

(function)
Converts an AnvlArray to raw bytes.

platform

(function)
Returns the platform name (e.g. "cpu").

device

(function)
Returns the device object for an AnvlArray.

new_device

(function)
Constructs a backend-specific device object from a device type string (e.g. "cpu"). Called by nv_device().

print_data

(function)
Prints the array data with a footer.

jit

(function)
Creates a JIT-compiled function implementation.

await_data

(function)
Blocks until the array's underlying data is ready. Called by await() for AnvlArrays; a no-op for backends without async execution.

Value

An AnvlBackend object.