Skip to content

Commit 571d416

Browse files
Format code (#95)
Co-authored-by: mofeing <[email protected]>
1 parent f8bbcb8 commit 571d416

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/XLA.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function GPUClient(node_id=0, num_nodes=1, platform="gpu")
7575
return Client(client)
7676
end
7777

78-
7978
function TPUClient(tpu_path::String)
8079
f = Libdl.dlsym(Reactant_jll.libReactantExtra_handle, "MakeTPUClient")
8180
refstr = Ref{Cstring}()
@@ -103,18 +102,19 @@ function __init__()
103102

104103
@static if !Sys.isapple()
105104
if isfile("/usr/lib/libtpu.so")
106-
dataset_dir = @get_scratch!("libtpu")
107-
if !isfile(dataset_dir*"/libtpu.so")
108-
Downloads.download("https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20240829-py3-none-any.whl", dataset_dir*"/tpu.zip")
109-
run(`unzip -qq $(dataset_dir*"/tpu.zip") -d $(dataset_dir)/tmp`)
110-
run(`mv $(dataset_dir)/tmp/libtpu/libtpu.so $(dataset_dir)/libtpu.so`)
111-
rm(dataset_dir*"/tmp", recursive=true)
112-
rm(dataset_dir*"/tpu.zip", recursive=true)
113-
end
114-
try
115-
tpu = TPUClient(
116-
dataset_dir*"/libtpu.so"
105+
dataset_dir = @get_scratch!("libtpu")
106+
if !isfile(dataset_dir * "/libtpu.so")
107+
Downloads.download(
108+
"https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20240829-py3-none-any.whl",
109+
dataset_dir * "/tpu.zip",
117110
)
111+
run(`unzip -qq $(dataset_dir*"/tpu.zip") -d $(dataset_dir)/tmp`)
112+
run(`mv $(dataset_dir)/tmp/libtpu/libtpu.so $(dataset_dir)/libtpu.so`)
113+
rm(dataset_dir * "/tmp"; recursive=true)
114+
rm(dataset_dir * "/tpu.zip"; recursive=true)
115+
end
116+
try
117+
tpu = TPUClient(dataset_dir * "/libtpu.so")
118118
backends["tpu"] = tpu
119119
default_backend[] = tpu
120120
catch e

0 commit comments

Comments
 (0)