Skip to content

Conversation

@giordano
Copy link
Member

@giordano giordano commented Nov 13, 2025

No description provided.

@giordano giordano force-pushed the mg/reactant-default-var branch from 386197e to 2c169ef Compare November 13, 2025 18:31
@giordano giordano force-pushed the mg/reactant-default-var branch from 444cf6b to 3f9be82 Compare November 13, 2025 18:49
@giordano
Copy link
Member Author

To demonstrate this works, on top of #1860 I get

julia> using Reactant

julia> Reactant.XLA.default_device()
Reactant.XLA.PJRT.Device(Ptr{Nothing}(0x0000000042369bd0), "TT:0 Wormhole_b0")

julia> ENV["REACTANT_DEFAULT_DEVICE"] = "31"
"31"

julia> Reactant.XLA.default_device()
Reactant.XLA.PJRT.Device(Ptr{Nothing}(0x000000004d618490), "TT:31 Wormhole_b0")

@giordano giordano changed the title Use REACTANT_DEFAULT_DEVICE to set default device ID with env var Define XLA.DEFAULT_DEVICE to set default device ID Nov 13, 2025
0-based index of default device to use, by default 0 (first available device).
"""
const DEFAULT_DEVICE = Ref{Int}(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're not doing an env var we can leave this as 1-indexed. [reason for env var is cuz cuda_visible_devices and friends are 0-indexed]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if you want we can still do DEFAULT_DEVICE = Ref{Int}(something(tryparse, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants