Skip to content

Commit 8348f32

Browse files
kmp5VTcorbett5
authored andcommitted
[NDTensors] [ITensors] Require Julia 1.10 and above (ITensor#1539)
* Require Julia 1.10 and above * Fixes for Julia 1.11, update CI to use Julia version 1.10 and 1.11
1 parent 9d31a05 commit 8348f32

File tree

15 files changed

+138
-36
lines changed

15 files changed

+138
-36
lines changed

.github/workflows/main_test_itensors_base_macos_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
version:
17-
- '1.6'
17+
- 'lts'
1818
- '1'
1919
os:
2020
# - windows-latest # windows tests are failing for an unknow reason, disable for now

.github/workflows/test_itensormps_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

.github/workflows/test_itensors_base_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

.github/workflows/test_ndtensors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

NDTensors/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NDTensors"
22
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
33
authors = ["Matthew Fishman <[email protected]>"]
4-
version = "0.3.44"
4+
version = "0.3.45"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
@@ -91,7 +91,7 @@ TimerOutputs = "0.5.5"
9191
TupleTools = "1.2.0"
9292
VectorInterface = "0.4.2"
9393
cuTENSOR = "2"
94-
julia = "1.6"
94+
julia = "1.10"
9595

9696
[extras]
9797
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"

NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -597,21 +597,31 @@ include("TestBlockSparseArraysUtils.jl")
597597
c = @view b[4:8, 4:8]
598598
@test c isa SubArray{<:Any,<:Any,<:BlockSparseArray}
599599
@test size(c) == (5, 5)
600-
@test block_nstored(c) == 2
600+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
601+
@test block_nstored(c) == 2 broken = VERSION > v"1.11-"
601602
@test blocksize(c) == (2, 2)
602603
@test blocklengths.(axes(c)) == ([2, 3], [2, 3])
603-
@test size(c[Block(1, 1)]) == (2, 2)
604-
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]]
605-
@test size(c[Block(2, 2)]) == (3, 3)
606-
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]]
607-
@test size(c[Block(2, 1)]) == (3, 2)
608-
@test iszero(c[Block(2, 1)])
609-
@test size(c[Block(1, 2)]) == (2, 3)
610-
@test iszero(c[Block(1, 2)])
604+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
605+
@test size(c[Block(1, 1)]) == (2, 2) broken = VERSION v"1.11-"
606+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
607+
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]] broken = VERSION v"1.11-"
608+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
609+
@test size(c[Block(2, 2)]) == (3, 3) broken = VERSION v"1.11-"
610+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
611+
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]] broken = VERSION v"1.11-"
612+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
613+
@test size(c[Block(2, 1)]) == (3, 2) broken = VERSION v"1.11-"
614+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
615+
@test iszero(c[Block(2, 1)]) broken = VERSION v"1.11-"
616+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
617+
@test size(c[Block(1, 2)]) == (2, 3) broken = VERSION v"1.11-"
618+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
619+
@test iszero(c[Block(1, 2)]) broken = VERSION v"1.11-"
611620

612621
x = randn(elt, 3, 3)
613622
c[Block(2, 2)] = x
614-
@test c[Block(2, 2)] == x
623+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
624+
@test c[Block(2, 2)] == x broken = VERSION v"1.11-"
615625
@test a[Block(1, 1)[1:3, 1:3]] == x
616626

617627
a = BlockSparseArray{elt}([2, 3], [3, 4])
@@ -637,10 +647,13 @@ include("TestBlockSparseArraysUtils.jl")
637647
@test copy(b) == a
638648
@test blocksize(b) == (2, 2)
639649
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
640-
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
641-
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
642-
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
643-
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
650+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
651+
if VERSION < v"1.11-"
652+
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
653+
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
654+
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
655+
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
656+
end
644657
c = @view b[Block(2, 2)]
645658
@test blocksize(c) == (1, 1)
646659
@test c == a[Block.(3:4), Block.(3:4)]
@@ -669,13 +682,17 @@ include("TestBlockSparseArraysUtils.jl")
669682
@test copy(b) == a[J, J]
670683
@test blocksize(b) == (2, 2)
671684
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
672-
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]]
685+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
686+
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]] broken =
687+
VERSION v"1.11-"
673688
c = @views b[Block(1, 1)][2:3, 2:3]
674689
@test c == Array(a)[[8, 5], [8, 5]]
675-
@test copy(c) == Array(a)[[8, 5], [8, 5]]
690+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
691+
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
676692
c = @view b[Block(1, 1)[2:3, 2:3]]
677693
@test c == Array(a)[[8, 5], [8, 5]]
678-
@test copy(c) == Array(a)[[8, 5], [8, 5]]
694+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
695+
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
679696
end
680697

681698
# TODO: Add more tests of this, it may

NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ end
3737

3838
labelled_getindex(a, index) = labelled(unlabel(a)[index], label(a))
3939

40+
# This is required in Julia 1.11 and above since
41+
# the generic `axes(a::AbstractRange)` definition was removed
42+
# and replace with a generic `axes(a)` definition that
43+
# is written in terms of `Base.unchecked_oneto`, i.e.:
44+
# ```julia
45+
# map(Base.unchecked_oneto, size(A))
46+
# ```
47+
# which returns a `Base.OneTo` instead of a `LabelledUnitRange`.
48+
Base.axes(a::LabelledUnitRange) = Base.oneto.(size(a))
49+
50+
# TODO: Delete this definition, this should output a `Base.OneTo`.
4051
Base.OneTo(stop::LabelledInteger) = labelled(Base.OneTo(unlabel(stop)), label(stop))
4152

4253
# Fix ambiguity error with `AbstractRange` definition in `Base`.

NDTensors/test/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1818
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2020
StridedViews = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143"
21-
TBLIS = "48530278-0828-4a49-9772-0f3830dfa1e9"
2221
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
2322
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2423
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
@@ -30,5 +29,6 @@ Metal = "1.1.0"
3029
[extras]
3130
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
3231
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
33-
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
3432
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
33+
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
34+
TBLIS = "48530278-0828-4a49-9772-0f3830dfa1e9"

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensors"
22
uuid = "9136182c-28ba-11e9-034c-db9fb085ebd5"
33
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
4-
version = "0.6.19"
4+
version = "0.6.20"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -73,7 +73,7 @@ TupleTools = "1.2"
7373
VectorInterface = "0.4"
7474
Zeros = "0.3.0"
7575
ZygoteRules = "0.2.2"
76-
julia = "1.6"
76+
julia = "1.10"
7777

7878
[extras]
7979
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

jenkins/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ RUN apt-get update && \
1313

1414
ARG JULIA=1.6
1515
RUN curl -s -L https://julialang-s3.julialang.org/bin/linux/x64/${JULIA}/julia-${JULIA}-latest-linux-x86_64.tar.gz | \
16-
tar -C /usr/local -x -z --strip-components=1 -f -
16+
tar -C /usr/local -x -z --strip-components=1 -f -

jenkins/Jenkinsfile

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pipeline {
77
stages {
88
stage('GPU Testing') {
99
parallel {
10-
stage('NDTensorsCUDAExt julia-1.10') {
10+
stage('NDTensorsCUDAExt julia-lts') {
1111
options {
1212
timeout(time: 45, unit: 'MINUTES')
1313
}
@@ -31,7 +31,31 @@ pipeline {
3131
'''
3232
}
3333
}
34-
stage('NDTensorscuTENSORExt julia-1.10') {
34+
stage('NDTensorsCUDAExt julia-1') {
35+
options {
36+
timeout(time: 45, unit: 'MINUTES')
37+
}
38+
agent {
39+
dockerfile {
40+
label 'gpu&&v100'
41+
filename 'Dockerfile'
42+
dir 'jenkins'
43+
additionalBuildArgs '--build-arg JULIA=1.11'
44+
args '--gpus "device=1"'
45+
}
46+
}
47+
environment {
48+
HOME = pwd(tmp:true)
49+
OMP_NUM_THREADS = 4
50+
JULIA_NUM_THREADS = 4
51+
}
52+
steps {
53+
sh '''
54+
julia -e 'using Pkg; Pkg.activate(temp=true); Pkg.Registry.update(); Pkg.update(); Pkg.develop(path="./NDTensors"); Pkg.develop(path="."); Pkg.test("NDTensors"; test_args=["cuda"])'
55+
'''
56+
}
57+
}
58+
stage('NDTensorscuTENSORExt julia-lts') {
3559
options {
3660
timeout(time: 45, unit: 'MINUTES')
3761
}
@@ -55,7 +79,52 @@ pipeline {
5579
'''
5680
}
5781
}
58-
stage('NDTensorsMetalExt Julia-1.10'){
82+
stage('NDTensorscuTENSORExt julia-1') {
83+
options {
84+
timeout(time: 45, unit: 'MINUTES')
85+
}
86+
agent {
87+
dockerfile {
88+
label 'gpu&&v100'
89+
filename 'Dockerfile'
90+
dir 'jenkins'
91+
additionalBuildArgs '--build-arg JULIA=1.11'
92+
args '--gpus "device=1"'
93+
}
94+
}
95+
environment {
96+
HOME = pwd(tmp:true)
97+
OMP_NUM_THREADS = 4
98+
JULIA_NUM_THREADS = 4
99+
}
100+
steps {
101+
sh '''
102+
julia -e 'using Pkg; Pkg.activate(temp=true); Pkg.Registry.update(); Pkg.update(); Pkg.develop(path="./NDTensors"); Pkg.develop(path="."); Pkg.test("NDTensors"; test_args=["cutensor"])'
103+
'''
104+
}
105+
}
106+
stage('NDTensorsMetalExt Julia-lts'){
107+
options {
108+
timeout(time: 45, unit: 'MINUTES')
109+
}
110+
agent {
111+
label 'm1'
112+
}
113+
environment{
114+
PATH="${env.HOME}/.juliaup/bin:${env.PATH}"
115+
PLATFORM = 'macos'
116+
}
117+
steps{
118+
sh '''
119+
juliaup add lts
120+
juliaup default lts
121+
'''
122+
sh '''
123+
julia -e 'using Pkg; Pkg.activate(temp=true); Pkg.develop(path="./NDTensors"); Pkg.develop(path="."); Pkg.test("NDTensors"; test_args=["metal"])'
124+
'''
125+
}
126+
}
127+
stage('NDTensorsMetalExt Julia-1'){
59128
options {
60129
timeout(time: 45, unit: 'MINUTES')
61130
}
@@ -69,6 +138,7 @@ pipeline {
69138
steps{
70139
sh '''
71140
juliaup update
141+
juliaup default release
72142
'''
73143
sh '''
74144
julia -e 'using Pkg; Pkg.activate(temp=true); Pkg.develop(path="./NDTensors"); Pkg.develop(path="."); Pkg.test("NDTensors"; test_args=["metal"])'
@@ -78,4 +148,4 @@ pipeline {
78148
}
79149
}
80150
}
81-
}
151+
}

src/lib/ITensorMPS/test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
66
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
77
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
88
OptimKit = "77e91f04-9b3b-57a6-a776-40b61faaebe0"
9+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
910
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
1011
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

src/lib/ITensorMPS/test/base/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
44
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
55
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
66
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
7+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
78
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"

src/lib/ITensorMPS/test/base/test_mpo.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Combinatorics
33
using ITensors
44
using NDTensors: scalartype
5+
using StableRNGs: StableRNG
56
using Test
67

78
include(joinpath(@__DIR__, "utils", "util.jl"))
@@ -814,11 +815,11 @@ end
814815
N = 6
815816
sites = [Index(2, "Site,n=$n") for n in 1:N]
816817
seed = 623
817-
mt = MersenneTwister(seed)
818-
K = random_mps(mt, sites)
818+
rng = StableRNG(seed)
819+
K = random_mps(rng, sites)
819820
L = MPO(K)
820-
result = sample(mt, L)
821-
@test result [1, 2, 1, 1, 2, 2]
821+
result = sample(rng, L)
822+
@test result [1, 1, 2, 1, 1, 1]
822823
end
823824

824825
@testset "MPO+MPO sum (directsum)" begin

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ OptimKit = "77e91f04-9b3b-57a6-a776-40b61faaebe0"
1515
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1616
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
1717
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
18+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
1819
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
1920
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2021
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"

0 commit comments

Comments
 (0)