Skip to content

Commit

Permalink
Merge branch 'master' into lp/julia-1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed Oct 25, 2024
2 parents 0d02f01 + 9a32b6a commit 99a66a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
5 changes: 3 additions & 2 deletions test/canonise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ d = [1, 2, 2, 2, 4, 2, 2]
id = Dict(j => d[i] for (i, j) in enumerate(sites))

@testset "Random QMps ($T)" for T in (Float32, Float64)
for toCUDA (true, false)
checks = CUDA.functional() ? (true, false) : (false, )
for toCUDA checks
ψ = rand(QMps{T}, id, D)
ϕ = rand(QMps{T}, id, D)
@test is_consistent(ψ)
Expand Down Expand Up @@ -35,7 +36,7 @@ id = Dict(j => d[i] for (i, j) in enumerate(sites))
end
end

@testset "Measure spectrum($T)" for T in (Float32, Float64)
@testset "Measure spectrum ($T)" for T in (Float32, Float64)
svd_mps = TensorMap{T}(
1 => T[
-0.694389933025747 -0.7195989305943268;;;
Expand Down
38 changes: 22 additions & 16 deletions test/projectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,29 @@
end

@testset "Different devices" begin
checks = CUDA.functional() ? (true, false) : (false)
for T [Int16, Int32, Int64]
lp = PoolOfProjectors{T}()
p1 = Vector{T}([1, 1, 2, 2, 3, 3])
p2 = Vector{T}([1, 2, 1, 3])
k = add_projector!(lp, p1)
k = add_projector!(lp, p2)

@test typeof(get_projector!(lp, 2, :CPU)) <: Array{T,1}
@test typeof(get_projector!(lp, 1, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 1
@test length(lp, :CPU) == 2

@test typeof(get_projector!(lp, 1, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 1

@test typeof(get_projector!(lp, 2, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 2
for toCUDA checks
lp = PoolOfProjectors{T}()
p1 = Vector{T}([1, 1, 2, 2, 3, 3])
p2 = Vector{T}([1, 2, 1, 3])
k = add_projector!(lp, p1)
k = add_projector!(lp, p2)

if toCUDA
@test typeof(get_projector!(lp, 1, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 1

@test typeof(get_projector!(lp, 1, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 1

@test typeof(get_projector!(lp, 2, :GPU)) <: CuArray{T,1}
@test length(lp, :GPU) == 2
end

@test typeof(get_projector!(lp, 2, :CPU)) <: Array{T,1}
@test length(lp, :CPU) == 2
end
end
end
end

0 comments on commit 99a66a7

Please sign in to comment.