We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 343af1a commit 28f8b6bCopy full SHA for 28f8b6b
1 file changed
src/accelerators/TPU.jl
@@ -159,7 +159,7 @@ const _TPU_PCI_DEVICE_IDS = Dict(
159
"0x0076" => TPUVersion.tpu7x,
160
)
161
162
-const NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID = Ref{Union{Nothing,Tuple{Int,TPUVersion}}}(
+const NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID = Ref{Union{Nothing,Tuple{Int,TPUVersion.T}}}(
163
nothing
164
165
@@ -177,6 +177,11 @@ function num_available_tpu_chips_and_device_id()
177
return NUM_AVAILABLE_TPU_CHIPS_AND_DEVICE_ID[]
178
end
179
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()
185
Sys.islinux() || return 0, TPUVersion.Unknown
186
187
devices_dir = "/sys/bus/pci/devices/"
0 commit comments