Skip to content

Commit 0693b2f

Browse files
committed
fix nilang version
1 parent 3842cf7 commit 0693b2f

File tree

4 files changed

+54
-33
lines changed

4 files changed

+54
-33
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Compose = "0.9"
2525
HDF5 = "0.15"
2626
LightGraphs = "1.3"
2727
LuxurySparse = "0.6"
28-
NiLang = "0.8"
28+
NiLang = "0.8, 0.9"
2929
Requires = "1"
3030
SimpleTensorNetworks = "0.2"
3131
TropicalNumbers = "0.2.1"

src/reversible/chimera.jl

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ end
1818

1919
@i function isolve_largemem(out!::T, sg::Spinglass{ChimeraLattice, T}, reg::ArrayReg{B,TT}, REG_STACK) where {B,T,TT<:Tropical{T}}
2020
@invcheckoff begin
21-
Lx sg.lattice.Nx
22-
Ly sg.lattice.Ny
23-
Js sg.Js
24-
hs sg.hs
25-
nj_red (Ly-1)*4 + 16 * Ly
21+
@routine begin
22+
Lx sg.lattice.Nx
23+
Ly sg.lattice.Ny
24+
Js sg.Js
25+
hs sg.hs
26+
nj_red (Ly-1)*4 + 16 * Ly
27+
end
2628
k 0
2729
@safe println("Running Chimera, Lx = $Lx, Ly = $Ly, eltype = $T.")
2830
@safe println("Layer 1/$Lx")
@@ -33,7 +35,7 @@ end
3335
end
3436

3537
for i=2:Lx
36-
hk (i-1)*Ly*8
38+
@routine hk (i-1)*Ly*8
3739
@safe println("Layer $i/$Lx")
3840
# BLACK
3941
for j=1:Ly*4
@@ -45,28 +47,33 @@ end
4547
end
4648

4749
# Contract with RED
48-
rr _init_reg(Tropical{T}, Ly*4, Val(false))
50+
@routine rr _init_reg(Tropical{T}, Ly*4, Val(false))
4951
red_reg(rr, Ly, Js[k+1:k+nj_red], hs[hk+1:hk+4Ly], REG_STACK)
5052
reg.state .*= rr.state
5153
incstack!(REG_STACK)
5254
swap_state!(REG_STACK, rr.state)
5355
k += nj_red
56+
~@routine
57+
~@routine
5458
end
5559
summed one(TT)
5660
i_sum(summed, reg.state)
5761
NiLang.SWAP(summed.n, out!)
5862
k length(Js)
5963
summed one(TT)
64+
~@routine
6065
end
6166
end
6267

6368
@i function isolve(out!::T, sg::AbstractSpinglass{ChimeraLattice, T}, reg::ArrayReg{B,TT}, A_STACK, B_STACK) where {B,T,TT<:Tropical{T}}
6469
@invcheckoff begin
65-
Lx sg.lattice.Nx
66-
Ly sg.lattice.Ny
67-
Js sg.Js
68-
hs sg.hs
69-
nj_red (Ly-1)*4 + 16 * Ly
70+
@routine begin
71+
Lx sg.lattice.Nx
72+
Ly sg.lattice.Ny
73+
Js sg.Js
74+
hs sg.hs
75+
nj_red (Ly-1)*4 + 16 * Ly
76+
end
7077
k 0
7178
@safe println("Running Chimera, Lx = $Lx, Ly = $Ly, eltype = $T.")
7279
@safe println("Layer 1/$Lx")
@@ -112,12 +119,14 @@ end
112119
reg.state .*= rr.state
113120
~@routine
114121
k += nj_red
122+
hk (i-1)*Ly*8
115123
end
116124
summed one(TT)
117125
i_sum(summed, reg.state)
118126
NiLang.SWAP(summed.n, out!)
119127
k length(Js)
120128
summed one(TT)
129+
~@routine
121130
end
122131
end
123132

src/reversible/second_neighbor.jl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ end
55

66
@i function isolve_largemem(out!::T, sg::AbstractSpinglass{MaskedSquareLattice}, reg::ArrayReg{1,TT}, REG_STACK; usecuda=false) where {T,TT<:Tropical{T}}
77
@invcheckoff begin
8-
lt sg.lattice
9-
Lx size(lt, 1)
10-
Ly size(lt, 2)
11-
nbit Ly + 2
12-
Js sg.Js
13-
hs sg.hs
8+
@routine begin
9+
lt sg.lattice
10+
Lx size(lt, 1)
11+
Ly size(lt, 2)
12+
nbit Ly + 2
13+
Js sg.Js
14+
hs sg.hs
15+
end
1416
k 0
1517
l 0
1618
for i=1:Lx
@@ -61,6 +63,7 @@ end
6163
l length(hs)
6264
k length(Js)
6365
summed one(TT)
66+
~@routine
6467
end
6568
end
6669

@@ -83,12 +86,14 @@ function cachesize_largemem(lt::MaskedSquareLattice)
8386
end
8487

8588
@i function isolve(out!::T, sg::Spinglass{MaskedSquareLattice,T}, reg::ArrayReg{1,TT}, A_STACK, B_STACK; usecuda=false) where {T,TT<:Tropical{T}}
86-
lt sg.lattice
87-
Lx size(lt, 1)
88-
Ly size(lt, 2)
89-
nbit Ly + 2
90-
Js sg.Js
91-
hs sg.hs
89+
@routine begin
90+
lt sg.lattice
91+
Lx size(lt, 1)
92+
Ly size(lt, 2)
93+
nbit Ly + 2
94+
Js sg.Js
95+
hs sg.hs
96+
end
9297
k 0
9398
l 0
9499
for i=1:Lx
@@ -159,6 +164,7 @@ end
159164
l length(hs)
160165
k length(Js)
161166
summed one(TT)
167+
~@routine
162168
end
163169

164170
cachesize_A(lt::MaskedSquareLattice) = size(lt,2)*3-1

src/reversible/square.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
@i function isolve(out!::T, sg::AbstractSpinglass{SquareLattice, T}, reg::ArrayReg{B,TT}, A_STACK, B_STACK) where {B,T,TT<:Tropical{T}}
22
@invcheckoff begin
3-
Lx sg.lattice.Nx
4-
Ly sg.lattice.Ny
5-
Js sg.Js
6-
hs sg.hs
3+
@routine begin
4+
Lx sg.lattice.Nx
5+
Ly sg.lattice.Ny
6+
Js sg.Js
7+
hs sg.hs
8+
end
79
@safe println("Layer 1/$Lx, stack size: $(A_STACK.top) & $(B_STACK.top)")
810
k 0
911
for j=1:Ly
@@ -46,6 +48,7 @@
4648
NiLang.SWAP(summed.n, out!)
4749
k length(Js)
4850
summed one(TT)
51+
~@routine
4952
end
5053
end
5154

@@ -63,10 +66,12 @@ end
6366

6467
@i function isolve_largemem(out!, sg::Spinglass{SquareLattice, T}, reg::ArrayReg{B,TT}, REG_STACK) where {B,T,TT<:Tropical{T}}
6568
@invcheckoff begin
66-
Lx sg.lattice.Nx
67-
Ly sg.lattice.Ny
68-
Js sg.Js
69-
hs sg.hs
69+
@routine begin
70+
Lx sg.lattice.Nx
71+
Ly sg.lattice.Ny
72+
Js sg.Js
73+
hs sg.hs
74+
end
7075
@safe println("Layer 1/$Lx")
7176
k 0
7277
for j=1:Ly
@@ -95,6 +100,7 @@ end
95100
NiLang.SWAP(summed.n, out!)
96101
k length(Js)
97102
summed one(TT)
103+
~@routine
98104
end
99105
end
100106

0 commit comments

Comments
 (0)