Skip to content
Open
Changes from 2 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
8 changes: 7 additions & 1 deletion src/xla/Client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ function get_device end
function get_addressable_device end
function platform_name end

default_device(client::AbstractClient) = first(addressable_devices(client))
function default_device(client::AbstractClient)
return addressable_devices(client)[something(
# `REACTANT_DEFAULT_DEVICE` is interpreted as 0-based.
tryparse(Int, get(ENV, "REACTANT_DEFAULT_DEVICE", "0")) + 1,
1,
)]
end
Loading