Skip to content

Commit

Permalink
Julia 1.6 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed May 8, 2024
1 parent 61c523d commit 963a443
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 101 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"

[compat]
Adapt = "4"
Adapt = "3, 4"
CUDA = "4, 5"
ITensors = "0.3, 0.4, 0.5"
julia = "1.6"
66 changes: 0 additions & 66 deletions test/test_cudense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ using Test: @test, @testset
l = Index(ml, "l")
a = Index(ma, "a")
indices = [i, j, k, l, a]
## @testset "Test add CuDense" begin
## A = [SType(1.0) for ii in 1:dim(i), jj in 1:dim(j)]
## dA = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## SType(1.0), dim(i) * dim(j)
## )
## B = [SType(2.0) for ii in 1:dim(i), jj in 1:dim(j)]
## dB = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## SType(2.0), dim(i) * dim(j)
## )
## dC = +(dA, IndexSet(i, j), dB, IndexSet(j, i))
## hC = collect(dC)
## @test collect(A + B) ≈ hC
## end
@testset "Test2 add CuDense" begin
for i1 in indices, i2 in indices
i1 == i2 && continue
Expand All @@ -44,20 +31,6 @@ using Test: @test, @testset
@test B cpu(cuB) #check does operation `+=`` modify cuB
end
end

## @testset "Test subtract CuDense" begin
## A = [SType(1.0) for ii in 1:dim(i), jj in 1:dim(j)]
## dA = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## SType(1.0), dim(i) * dim(j)
## )
## B = [SType(2.0) for ii in 1:dim(i), jj in 1:dim(j)]
## dB = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## SType(2.0), dim(i) * dim(j)
## )
## dC = -(dA, IndexSet(i, j), dB, IndexSet(i, j))
## hC = collect(dC)
## @test A - B ≈ hC
## end
@testset "Test2 subtract CuDense" begin
for i1 in indices, i2 in indices
i1 == i2 && continue
Expand All @@ -76,43 +49,4 @@ using Test: @test, @testset
#end
end
end
## @testset "Test permute CuDense" begin
## A = [SType(ii * jj) for ii in 1:dim(i), jj in 1:dim(j)]
## dA = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## NDTensors.Dense(vec(A))
## )
## B = [SType(0.0) for ii in 1:dim(j), jj in 1:dim(j)]
## dB = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## SType(0.0), dim(i) * dim(j)
## )
## dC = permute!(dB, IndexSet(j, i), dA, IndexSet(i, j))
## hC = cpu(dC)
## @test transpose(A) == hC
## end
## @testset "Test move CuDense on/off GPU" begin
## A = [SType(1.0) for ii in 1:dim(i), jj in 1:dim(j)]
## dA = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(
## NDTensors.Dense(vec(A))
## )
## dB = convert(NDTensors.Dense{SType,Vector{SType}}, dA)
## @test NDTensors.data(dB) == vec(A)
## end
## @testset "Test basic CuDense features" begin
## @test NDTensors.Dense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(10) isa
## ITensorGPU.CuDense{SType}
## @test complex(NDTensors.Dense{SType,CuVector{SType}}) ==
## NDTensors.Dense{complex(SType),CuVector{complex(SType)}}
## end
## if SType == Float64
## @testset "Test CuDense complex" begin
## A = CUDA.rand(SType, dim(i) * dim(j))
## dA = ITensorGPU.CuDense{SType,CuVector{SType,ITensorGPU.default_buffertype()}}(A)
## dC = complex(dA)
## @test typeof(dC) !== typeof(dA)
## cdC = CuArray(dC)
## hC = collect(cdC)
## ccA = complex.(A)
## @test hC == collect(ccA)
## end
## end
end # End Dense storage test
34 changes: 0 additions & 34 deletions test/test_cumps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,37 +239,3 @@ end
@test inner(M0, M) > 0.1
end
end

#=@testset "Other MPS methods" begin
@testset "sample! method" begin
N = 10
sites = [Index(3,"Site,n=$n") for n=1:N]
psi = makeRandomCuMPS(sites,chi=3)
nrm2 = inner(psi,psi)
psi[1] *= (1.0/sqrt(nrm2))
s = sample!(psi)
@test length(s) == N
for n=1:N
@test 1 <= s[n] <= 3
end
# Throws becase not orthogonalized to site 1:
orthogonalize!(psi,3)
@test_throws ErrorException sample(psi)
# Throws becase not normalized
orthogonalize!(psi,1)
psi[1] *= (5.0/norm(psi[1]))
@test_throws ErrorException sample(psi)
# Works when ortho & normalized:
orthogonalize!(psi,1)
psi[1] *= (1.0/norm(psi[1]))
s = sample(psi)
@test length(s) == N
end
end=#

0 comments on commit 963a443

Please sign in to comment.