Skip to content

Commit 38e5f01

Browse files
committed
Move the GPU tests to other PR for now
1 parent 8157664 commit 38e5f01

1 file changed

Lines changed: 5 additions & 133 deletions

File tree

test/runtests.jl

Lines changed: 5 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using Test
22
using LinearAlgebra
33
using Random
44
using StridedViews
5-
using CUDA
65

76
Random.seed!(1234)
87

@@ -143,125 +142,10 @@ if !is_buildkite
143142
end
144143
end
145144
@test reshape(B8, (1, 1, 1)) == reshape(A8, (1, 1, 1)) ==
146-
StridedView(reshape(A8, (1, 1, 1))) == sreshape(A8, (1, 1, 1))
145+
StridedView(reshape(A8, (1, 1, 1))) == sreshape(A8, (1, 1, 1))
147146
@test reshape(B8, ()) == reshape(A8, ())
148147
end
149148

150-
A2 = view(A1, 1:36, 1:20)
151-
@test isstrided(A2)
152-
B2 = StridedView(A2)
153-
for op1 in (identity, conj, transpose, adjoint)
154-
if op1 == transpose || op1 == adjoint
155-
@test op1(A2) == op1(B2) == StridedView(op1(A2))
156-
else
157-
@test op1(A2) == op1(B2)
158-
end
159-
for op2 in (identity, conj, transpose, adjoint)
160-
@test op2(op1(A2)) == op2(op1(B2))
161-
end
162-
end
163-
164-
A3 = reshape(A1, 360, 10)
165-
@test isstrided(A3)
166-
@test !isstrided(reshape(A1', 10, 360))
167-
B3 = StridedView(A3)
168-
@test size(A3) == size(B3)
169-
@test strides(A3) == strides(B3)
170-
@test stride(A3, 1) == stride(B3, 1)
171-
@test stride(A3, 2) == stride(B3, 2)
172-
@test stride(A3, 3) == stride(B3, 3)
173-
for op1 in (identity, conj, transpose, adjoint)
174-
if op1 == transpose || op1 == adjoint
175-
@test op1(A3) == op1(B3) == StridedView(op1(A3))
176-
else
177-
@test op1(A3) == op1(B3)
178-
end
179-
for op2 in (identity, conj, transpose, adjoint)
180-
@test op2(op1(A3)) == op2(op1(B3))
181-
end
182-
end
183-
184-
A4 = reshape(A1', (6, 10, 5, 12))
185-
@test isstrided(A4)
186-
B4 = StridedView(A4)
187-
B4[2, 2, 2, 2] = 3
188-
@test A4[2, 2, 2, 2] == 3
189-
for op1 in (identity, conj)
190-
@test op1(A4) == op1(B4)
191-
for op2 in (identity, conj)
192-
@test op2(op1(A4)) == op2(op1(B4))
193-
end
194-
end
195-
196-
A4 = reshape(view(A1, 1:36, 1:20), (6, 6, 5, 4))
197-
@test isstrided(A4)
198-
B4 = StridedView(A4)
199-
B4[2, 2, 2, 2] = 4
200-
@test A4[2, 2, 2, 2] == 4
201-
for op1 in (identity, conj)
202-
@test op1(A4) == op1(B4)
203-
for op2 in (identity, conj)
204-
@test op2(op1(A4)) == op2(op1(B4))
205-
end
206-
end
207-
208-
A4 = reshape(view(A1', 1:36, 1:20), (6, 6, 5, 4))
209-
B4 = StridedView(A4)
210-
B4[2, 2, 2, 2] = 5
211-
@test A4[2, 2, 2, 2] == 5
212-
for op1 in (identity, conj)
213-
@test op1(A4) == op1(B4)
214-
for op2 in (identity, conj)
215-
@test op2(op1(A4)) == op2(op1(B4))
216-
end
217-
end
218-
219-
A5 = PermutedDimsArray(reshape(view(A1, 1:36, 1:20), (6, 6, 5, 4)), (3, 1, 2, 4))
220-
@test isstrided(A5)
221-
B5 = StridedView(A5)
222-
for op1 in (identity, conj)
223-
@test op1(A5) == op1(B5)
224-
for op2 in (identity, conj)
225-
@test op2(op1(A5)) == op2(op1(B5))
226-
end
227-
end
228-
229-
A6 = reshape(view(A1, 1:36, 1:20), (6, 120))
230-
@test !isstrided(A6)
231-
@test_throws StridedViews.ReshapeException StridedView(A6)
232-
try
233-
StridedView(A6)
234-
catch ex
235-
println("Printing error message:")
236-
show(ex)
237-
println("")
238-
end
239-
240-
# Array with Array elements
241-
A7 = [randn(T1, (5, 5)) for i in 1:5, j in 1:5]
242-
@test isstrided(A7)
243-
B7 = StridedView(A7)
244-
for op1 in (identity, conj, transpose, adjoint)
245-
@test op1(A7) == op1(B7) == StridedView(op1(A7))
246-
for op2 in (identity, conj, transpose, adjoint)
247-
@test op2(op1(A7)) == op2(op1(B7))
248-
end
249-
end
250-
251-
# Zero-dimensional array
252-
A8 = randn(T1, ())
253-
B8 = StridedView(A8)
254-
@test stride(B8, 1) == stride(B8, 5) == 1
255-
for op1 in (identity, conj)
256-
@test op1(A8) == op1(B8) == StridedView(op1(A8))
257-
for op2 in (identity, conj)
258-
@test op2(op1(A8)) == op2(op1(B8))
259-
end
260-
end
261-
@test reshape(B8, (1, 1, 1)) == reshape(A8, (1, 1, 1)) ==
262-
StridedView(reshape(A8, (1, 1, 1))) == sreshape(A8, (1, 1, 1))
263-
@test reshape(B8, ()) == reshape(A8, ())
264-
265149
@test !isstrided(Diagonal([0.5, 1.0, 1.5]))
266150
end
267151

@@ -365,7 +249,7 @@ if !is_buildkite
365249
@test view(B, :, 1:5, 3, 1:5) === sview(B, :, 1:5, 3, 1:5) === B[:, 1:5, 3, 1:5]
366250
@test view(B, :, 1:5, 3, 1:5) == StridedView(view(A, :, 1:5, 3, 1:5))
367251
@test pointer(view(B, :, 1:5, 3, 1:5)) ==
368-
pointer(StridedView(view(A, :, 1:5, 3, 1:5)))
252+
pointer(StridedView(view(A, :, 1:5, 3, 1:5)))
369253
@test StridedViews.offset(view(B, :, 1:5, 3, 1:5)) == 2 * stride(B, 3)
370254
end
371255
end
@@ -397,12 +281,12 @@ if !is_buildkite
397281
using PtrArrays
398282
@testset "PtrArrays with StridedView" begin
399283
@testset for T in (Float64, ComplexF64)
400-
A = randn!(PtrArrays.malloc(T, 10, 10, 10, 10))
284+
A = randn!(malloc(T, 10, 10, 10, 10))
401285
@test isstrided(A)
402286
B = StridedView(A)
403287
@test B isa StridedView
404288
@test B == A
405-
PtrArrays.free(A)
289+
free(A)
406290
end
407291
end
408292

@@ -411,18 +295,6 @@ if !is_buildkite
411295

412296
if isempty(VERSION.prerelease)
413297
using JET
414-
JET.test_package(StridedViews; target_modules = (StridedViews,))
415-
end
416-
end
417-
418-
if CUDA.functional()
419-
@testset "CUDA with StridedView" begin
420-
@testset for T in (Float64, ComplexF64)
421-
A = CUDA.randn!(T, 10, 10, 10, 10)
422-
@test isstrided(A)
423-
B = StridedView(A)
424-
@test B isa StridedView
425-
@test B == A
426-
end
298+
JET.test_package(StridedViews; target_modules=(StridedViews,))
427299
end
428300
end

0 commit comments

Comments
 (0)