Skip to content

Commit a7bd216

Browse files
committed
Updates
1 parent 9baaf17 commit a7bd216

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

Project.toml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,24 @@ TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
1818
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
1919

2020
[weakdeps]
21-
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
21+
#AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
2222
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
2323
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
2424
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
2525
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
2626

2727
[extensions]
28-
TensorKitAMDGPUExt = "AMDGPU"
28+
#TensorKitAMDGPUExt = "AMDGPU"
2929
TensorKitCUDAExt = ["CUDA", "cuTENSOR"]
3030
TensorKitChainRulesCoreExt = "ChainRulesCore"
3131
TensorKitFiniteDifferencesExt = "FiniteDifferences"
3232

3333
[compat]
34-
AMDGPU = "2"
34+
#AMDGPU = "2"
3535
Adapt = "4"
3636
Aqua = "0.6, 0.7, 0.8"
3737
CUDA = "5"
38+
cuTENSOR = "2.2"
3839
ChainRulesCore = "1"
3940
ChainRulesTestUtils = "1"
4041
Combinatorics = "1"
@@ -54,12 +55,13 @@ TestExtras = "0.2,0.3"
5455
TupleTools = "1.1"
5556
VectorInterface = "0.4, 0.5"
5657
Zygote = "0.7"
57-
cuTENSOR = "2"
5858
julia = "1.10"
5959

6060
[extras]
6161
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
6262
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
63+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
64+
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
6365
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
6466
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
6567
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
@@ -71,4 +73,9 @@ TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
7173
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
7274

7375
[targets]
74-
test = ["Adapt", "AMDGPU", "Aqua", "Combinatorics", "CUDA", "cuTENSOR", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]
76+
test = ["Adapt", "Aqua", "Combinatorics", "CUDA", "cuTENSOR", "LinearAlgebra", "TensorOperations", "Test", "TestExtras", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Zygote"]
77+
78+
[sources]
79+
CUDA = {url = "https://github.com/JuliaGPU/CUDA.jl", rev = "master"}
80+
cuTENSOR = {url = "https://github.com/JuliaGPU/CUDA.jl", subdir="lib/cutensor", rev = "ksh/cutensor_bump"}
81+
MatrixAlgebraKit = {url = "https://github.com/QuantumKitHub/MatrixAlgebraKit.jl", rev = "ksh/tk"}

ext/TensorKitCUDAExt/TensorKitCUDAExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using Random
1616

1717
include("cutensormap.jl")
1818

19-
TensorKit.Factorizations.select_svd_algorithm(::CuTensorMap, ::TensorKit.Factorizations.SVD) = CUSOLVER_Jacobi()
19+
TensorKit.Factorizations.select_svd_algorithm(::CuTensorMap, ::TensorKit.Factorizations.SVD) = CUSOLVER_QRIteration()
2020
TensorKit.Factorizations.select_svd_algorithm(::CuTensorMap, ::TensorKit.Factorizations.SDD) = throw(ArgumentError("DivideAndConquer unavailable on CUDA"))
2121
TensorKit.Factorizations.select_svd_algorithm(::CuTensorMap, alg::OFA) = throw(ArgumentError(lazy"Unknown algorithm $alg"))
2222

test/cuda.jl

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ for V in spacelist
160160
@test LinearAlgebra.isdiag(D)
161161
@test LinearAlgebra.diag(D) == d
162162
end=#
163+
#=
163164
@timedtestset "Permutations: test via inner product invariance" begin
164165
W = V1 ⊗ V2 ⊗ V3 ⊗ V4 ⊗ V5
165166
t = CUDA.rand(ComplexF64, W)
@@ -323,7 +324,7 @@ for V in spacelist
323324
@test ad(t1' / t') ad(t1)' / ad(t)'
324325
end
325326
end
326-
end
327+
end=#
327328
@timedtestset "Factorization" begin
328329
W = V1 V2 V3 V4 V5
329330
for T in (Float32, ComplexF64)
@@ -336,20 +337,14 @@ for V in spacelist
336337
TensorKit.Polar(), TensorKit.SVD(),
337338
)
338339
Q, R = @constinferred leftorth(t, ((3, 4, 2), (1, 5)); alg=alg)
339-
QdQ = Q' * Q
340-
@test QdQ ≈ one(QdQ)
340+
@test isisometry(Q)
341341
@test Q * R permute(t, ((3, 4, 2), (1, 5)))
342-
if alg isa Polar
343-
# @test isposdef(R) # not defined for CUDA
344-
@test_broken domain(R) == codomain(R) == space(t, 1)' space(t, 5)'
345-
end
346342
end
347343
@testset "leftnull with $alg" for alg in
348344
(TensorKit.QR(), TensorKit.SVD(),
349345
)
350346
N = @constinferred leftnull(t, ((3, 4, 2), (1, 5)); alg=alg)
351-
NdN = N' * N
352-
@test NdN ≈ one(NdN)
347+
@test isisometry(N)
353348
@test norm(N' * permute(t, ((3, 4, 2), (1, 5)))) <
354349
100 * eps(norm(t))
355350
end
@@ -360,29 +355,21 @@ for V in spacelist
360355
)
361356
# cusolver SVD requires m >= n for some reason
362357
L, Q = @constinferred rightorth(t, ((3, 4), (2, 1, 5)); alg=alg)
363-
QQd = Q * Q'
364-
@test QQd ≈ one(QQd)
358+
@test isisometry(Q; side=:right)
365359
@test L * Q ≈ permute(t, ((3, 4), (2, 1, 5)))
366-
if alg isa Polar
367-
# @test isposdef(L) # not defined for CUDA
368-
@test_broken domain(L) == codomain(L) == space(t, 3) ⊗ space(t, 4)
369-
end
370360
end
371361
@testset "rightnull with $alg" for alg in
372362
(TensorKit.LQ(), TensorKit.SVD(),
373363
)
374364
M = @constinferred rightnull(t, ((3, 4), (2, 1, 5)); alg=alg)
375-
MMd = M * M'
376-
@test MMd one(MMd)
365+
@test isisometry(M; side=:right)
377366
@test norm(permute(t, ((3, 4), (2, 1, 5))) * M') <
378367
100 * eps(norm(t))
379368
end
380369
@testset "tsvd with $alg" for alg in (TensorKit.SVD(),)
381370
U, S, V = @constinferred tsvd(t, ((3, 4, 2), (1, 5)); alg=alg)
382-
UdU = U' * U
383-
@test UdU one(UdU)
384-
VVd = V * V'
385-
@test VVd ≈ one(VVd)
371+
@test isisometry(U)
372+
@test isisometry(V; side=:right)
386373
t2 = permute(t, ((3, 4, 2), (1, 5)))
387374
US = U * S
388375
USV = US * V

0 commit comments

Comments
 (0)