Skip to content

Commit 5b0df2c

Browse files
giordanowsmoses
andauthored
[CI] Prepare setup for new runners (#1478)
* [CI] Use new runners * [CI] Use custom images * [CI] Fix TMPDIR setting * [CI] Run also macOS again * [CI] Only add TPU test * Use `unzip_jll` * [CI] Disable TPU * Update CI.yml * Update CI.yml * bump libtpu * fix test * fix --------- Co-authored-by: William Moses <wmoses@google.com> Co-authored-by: William S. Moses <gh@wsmoses.com>
1 parent e8952fa commit 5b0df2c

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
timeout-minutes: 90
3434
name: Julia ${{ matrix.version }} - ${{ matrix.test_group }} - ${{ matrix.os }} - ${{ matrix.runtime }} - assertions=${{ matrix.assertions }} - ${{ github.event_name }}
3535
runs-on: ${{ matrix.os }}
36+
container:
37+
image: ${{ contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images:main' || '' }}
3638
strategy:
3739
fail-fast: false
3840
matrix:
@@ -59,6 +61,11 @@ jobs:
5961
assertions:
6062
- false
6163
include:
64+
- os: linux-x86-ct6e-180-4tpu
65+
version: "1.11"
66+
assertions: false
67+
test_group: core
68+
runtime: "IFRT"
6269
- os: ubuntu-24.04
6370
version: "1.10"
6471
assertions: true
@@ -86,9 +93,13 @@ jobs:
8693
# libReactant: packaged
8794
# version: '1.10'
8895
# test_group: integration
89-
env:
90-
TMPDIR: ${{ github.workspace }}/tmp
9196
steps:
97+
- name: Set TMPDIR
98+
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub
99+
# is terrible and the two don't match inside containers:
100+
# https://github.com/actions/runner/issues/2058
101+
run: |
102+
echo "TMPDIR=${GITHUB_WORKSPACE}/tmp" >> ${GITHUB_ENV}
92103
- uses: actions/checkout@v4
93104
- name: Create TMPDIR
94105
run: |

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Reactant_jll = "0192cb87-2b54-54ad-80e0-3be72ad8a3c0"
2525
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
2626
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
2727
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
28+
unzip_jll = "88f77b66-78eb-5ed0-bc16-ebba0796830d"
2829

2930
[weakdeps]
3031
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
@@ -102,6 +103,7 @@ Scratch = "1.2"
102103
Sockets = "1.10"
103104
SpecialFunctions = "2.4"
104105
Statistics = "1.10"
106+
unzip_jll = "6"
105107
YaoBlocks = "0.13, 0.14"
106108
julia = "1.10"
107109

src/accelerators/TPU.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using EnumX: @enumx
55
using Scratch: @get_scratch!
66
using HTTP
77
using Downloads
8+
using unzip_jll: unzip
89

910
const libtpu_dir = Ref{Union{Nothing,String}}(nothing)
1011
const RUNNING_IN_CLOUD_TPU_VM = Ref(false)
@@ -42,10 +43,10 @@ function download_libtpu_if_needed(path=nothing)
4243
zip_file_path = joinpath(path, "tpu.zip")
4344
tmp_dir = joinpath(path, "tmp")
4445
Downloads.download(
45-
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250415+nightly-py3-none-manylinux_2_31_x86_64.whl",
46+
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250727+nightly-py3-none-manylinux_2_31_x86_64.whl",
4647
zip_file_path,
4748
)
48-
run(`unzip -qq $(zip_file_path) -d $(tmp_dir)`)
49+
run(`$(unzip()) -qq $(zip_file_path) -d $(tmp_dir)`)
4950
mv(joinpath(tmp_dir, "libtpu", "libtpu.so"), libtpu_path)
5051
rm(tmp_dir; recursive=true)
5152
rm(zip_file_path; recursive=true)

test/basic.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,13 @@ end
375375
x = rand(size...)
376376

377377
@testset "outer repeat" begin
378-
@test (@jit repeat(Reactant.to_rarray(x), counts...)) == repeat(x, counts...)
378+
@test (@jit repeat(Reactant.to_rarray(x), counts...)) repeat(x, counts...)
379379
end
380380

381381
length(counts) < length(size) && continue
382382

383383
@testset "inner repeat" begin
384-
@test (@jit repeat(Reactant.to_rarray(x); inner=counts)) ==
384+
@test (@jit repeat(Reactant.to_rarray(x); inner=counts))
385385
repeat(x; inner=counts)
386386
end
387387
end
@@ -419,10 +419,13 @@ end
419419
end
420420

421421
@testset "Complex runtime: $CT" for CT in (ComplexF32, ComplexF64)
422-
a = Reactant.to_rarray(ones(CT, 2))
423-
b = Reactant.to_rarray(ones(CT, 2))
424-
c = Reactant.compile(+, (a, b))(a, b)
425-
@test c == ones(CT, 2) + ones(CT, 2)
422+
# complex f64 not supported on tpu
423+
if CT == ComplexF32 || !contains(string(Reactant.devices()[1]), "Tpu")
424+
a = Reactant.to_rarray(ones(CT, 2))
425+
b = Reactant.to_rarray(ones(CT, 2))
426+
c = Reactant.compile(+, (a, b))(a, b)
427+
@test c == ones(CT, 2) + ones(CT, 2)
428+
end
426429
end
427430

428431
@testset "Scalars" begin

0 commit comments

Comments
 (0)