EXLA.Client (EXLA v0.11.0)

Copy Markdown View Source

Functions for managing EXLA.Client.

See EXLA module docs for a general introduction.

Summary

Functions

Returns the name of the default client.

Fetches a client with the given name from configuration.

Sends buffer from device outfeed to the given process tagged by ref.

Returns the memory statistics for a client.

Returns a map of supported platforms with device information.

Resets the peak memory counter for a client.

Sends data_and_typespecs to device infeed.

Functions

default_name()

Returns the name of the default client.

fetch!(name)

Fetches a client with the given name from configuration.

from_outfeed(client, device_id, typespecs, pid, ref)

Sends buffer from device outfeed to the given process tagged by ref.

get_memory_statistics(client)

Returns the memory statistics for a client.

Returns a map with the following keys:

  • :allocated - Currently allocated memory in bytes
  • :peak - Peak memory usage in bytes
  • :per_device - Map of device ID to allocated memory in bytes

Examples

client = EXLA.Client.fetch!(:host)
EXLA.Client.get_memory_statistics(client)
%{allocated: 0, peak: 0, per_device: %{0 => 0}}

get_supported_platforms()

Returns a map of supported platforms with device information.

reset_peak_memory(client)

Resets the peak memory counter for a client.

Examples

iex> client = EXLA.Client.fetch!(:host)
iex> EXLA.Client.reset_peak_memory(client)
:ok

to_infeed(client, device_id, data_and_typespecs)

Sends data_and_typespecs to device infeed.

data_and_typespecs is a list of values corresponding to a single infeed operation. It must be a list of two element tuples where the first element is a binary and the second element is a EXLA.Typespec.