Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit ed0f990

Browse files
committed
Basic tests for CuTensor type
1 parent 4dedd0f commit ed0f990

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/tensor.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ else
1111

1212
@test has_cutensor()
1313

14+
@testset "CuTensor type basics" begin
15+
N = 2
16+
dmax = 2^div(18,N)
17+
dims = rand(2:dmax, N)
18+
p = randperm(N)
19+
indsA = collect(('a':'z')[1:N])
20+
dimsA = dims
21+
A = rand(Float64, dimsA...)
22+
dA = CuArray(A)
23+
p = randperm(N)
24+
indsA = collect(('a':'z')[1:N])
25+
ctA = CuTensor(dA, indsA)
26+
@test length(ctA) == length(A)
27+
@test size(ctA) == size(A)
28+
@test size(ctA, 1) == size(A, 1)
29+
@test ndims(ctA) == ndims(A)
30+
@test strides(ctA) == strides(A)
31+
@test eltype(ctA) == eltype(A)
32+
end
33+
1434
@testset "Elementwise binary" begin
1535
eltypes = ((Float16, Float16),
1636
#(Float16, Float32),

0 commit comments

Comments
 (0)