Skip to content

Commit

Permalink
[NDTensors] Remove ITensors dependency from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 24, 2024
1 parent 5fb4696 commit 0f4ec9c
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 150 deletions.
2 changes: 1 addition & 1 deletion NDTensors/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NDTensors"
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
authors = ["Matthew Fishman <[email protected]>"]
version = "0.3.46"
version = "0.3.47"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
4 changes: 0 additions & 4 deletions NDTensors/test/ITensors/Project.toml

This file was deleted.

6 changes: 0 additions & 6 deletions NDTensors/test/ITensors/TestITensorDMRG/Project.toml

This file was deleted.

20 changes: 0 additions & 20 deletions NDTensors/test/ITensors/TestITensorDMRG/TestITensorDMRG.jl

This file was deleted.

35 changes: 0 additions & 35 deletions NDTensors/test/ITensors/TestITensorDMRG/dmrg.jl

This file was deleted.

37 changes: 0 additions & 37 deletions NDTensors/test/ITensors/runtests.jl

This file was deleted.

5 changes: 2 additions & 3 deletions NDTensors/test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MappedArrays = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900"
Expand All @@ -23,12 +22,12 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
cuTENSOR = "2.0"
Metal = "1.1.0"
cuTENSOR = "2.0"

[extras]
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
TBLIS = "48530278-0828-4a49-9772-0f3830dfa1e9"
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
4 changes: 0 additions & 4 deletions NDTensors/test/ext/Project.toml

This file was deleted.

12 changes: 0 additions & 12 deletions NDTensors/test/ext/runtests.jl

This file was deleted.

24 changes: 0 additions & 24 deletions NDTensors/test/ext/test_mappedarraysext.jl

This file was deleted.

2 changes: 1 addition & 1 deletion NDTensors/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SafeTestsets: @safetestset
filenames = filter(readdir(@__DIR__)) do f
startswith("test_")(f) && endswith(".jl")(f)
end
for dir in ["lib", "ext", "ITensors"]
for dir in ["lib", "ext"]
push!(filenames, joinpath(dir, "runtests.jl"))
end
@testset "Test $(@__DIR__)/$filename" for filename in filenames
Expand Down
34 changes: 31 additions & 3 deletions NDTensors/test/test_combiner.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
@eval module $(gensym())
using NDTensors
using Test: @testset, @test, @test_throws
using GPUArraysCore: @allowscalar
using NDTensors:
NDTensors,
Block,
BlockOffsets,
BlockSparse,
BlockSparseTensor,
Combiner,
Dense,
DenseTensor,
contract,
dim,
dims,
tensor
include("NDTensorsTestUtils/NDTensorsTestUtils.jl")
using .NDTensorsTestUtils: devices_list, is_supported_eltype
using Test: @testset, @test, @test_throws

# Testing generic block indices
using ITensors: QN, Index
struct Index{Space}
space::Space
end
NDTensors.dim(i::Index) = sum(b -> last(b), i.space)
NDTensors.nblocks(i::Index) = length(i.space)
NDTensors.blockdim(i::Index, block::Integer) = last(i.space[block])
function NDTensors.outer(i1::Index, i2::Index)
return Index(vec(
map(Iterators.product(i1.space, i2.space)) do (b1, b2)
return first(b1) + first(b2) => last(b1) * last(b2)
end,
))
end
NDTensors.permuteblocks(i::Index, perm::Vector{Int}) = Index(i.space[perm])

struct QN end
Base.:+(q1::QN, q2::QN) = QN()

@testset "CombinerTensor basic functionality" begin
@testset "test device: $dev, eltype: $elt" for dev in devices_list(copy(ARGS)),
Expand Down

0 comments on commit 0f4ec9c

Please sign in to comment.