Skip to content

Commit 28f8b6b

Browse files
committed
fix: caching
1 parent 343af1a commit 28f8b6b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/accelerators/TPU.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const _TPU_PCI_DEVICE_IDS = Dict(
159159
"0x0076" => TPUVersion.tpu7x,
160160
)
161161

162-
const NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID = Ref{Union{Nothing,Tuple{Int,TPUVersion}}}(
162+
const NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID = Ref{Union{Nothing,Tuple{Int,TPUVersion.T}}}(
163163
nothing
164164
)
165165

@@ -177,6 +177,11 @@ function num_available_tpu_chips_and_device_id()
177177
return NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID[]
178178
end
179179

180+
NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID[] = _num_available_tpu_chips_and_device_id()
181+
return NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID[]
182+
end
183+
184+
function _num_available_tpu_chips_and_device_id()
180185
Sys.islinux() || return 0, TPUVersion.Unknown
181186

182187
devices_dir = "/sys/bus/pci/devices/"

0 commit comments

Comments
 (0)