Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions deps/ReactantExtra/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2147,24 +2147,34 @@ REACTANT_ABI int ifrt_client_addressable_device_count(ifrt::Client *client) {
}

REACTANT_ABI void ifrt_client_devices(ifrt::Client *client,
ifrt::Device **out_devices) {
ifrt::Device **out_devices,
uint64_t num_devices) {
auto span = client->devices();
if (span.size() != num_devices)
ReactantThrowError("Incorrect number of devices provided");
assert(span.size() == num_devices);
for (int i = 0; i < span.size(); i++) {
out_devices[i] = span[i];
}
}

REACTANT_ABI void ifrt_client_addressable_devices(ifrt::Client *client,
ifrt::Device **out_devices) {
ifrt::Device **out_devices,
uint64_t num_devices) {
auto span = client->addressable_devices();
if (span.size() != num_devices)
ReactantThrowError("Incorrect number of devices provided");
for (int i = 0; i < span.size(); i++) {
out_devices[i] = span[i];
}
}

REACTANT_ABI void ifrt_client_all_devices(ifrt::Client *client,
ifrt::Device **out_devices) {
ifrt::Device **out_devices,
uint64_t num_devices) {
auto span = client->GetAllDevices();
if (span.size() != num_devices)
ReactantThrowError("Incorrect number of devices provided");
for (int i = 0; i < span.size(); i++) {
out_devices[i] = span[i];
}
Expand Down
Loading