Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection-less, Centralized controller #165

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9816e20
Initial changes for different control plane simulations
ba2tro Sep 23, 2024
bd6bbb1
update the examples to use the new protocols
ba2tro Sep 23, 2024
7a8d4c4
fixup
ba2tro Oct 4, 2024
b9b726a
update docstrings and changelog
ba2tro Oct 4, 2024
98454b0
add tests
ba2tro Oct 5, 2024
057541c
avoid using CliffordRepr() in tests
ba2tro Oct 7, 2024
70dc334
Send RequestCompletion from controller instead of RequestTracker
ba2tro Oct 10, 2024
20e501e
Try to add a sequence diagram to the readme and fix a typo in wgl app
ba2tro Oct 14, 2024
0fe7fc7
fix typo in the sequence diagram
ba2tro Oct 14, 2024
46f5d3f
move path selection to controller and related modifications
ba2tro Nov 4, 2024
ce88cb8
update controlplane test
ba2tro Nov 4, 2024
49ab5e6
update ProtocolZoo/ProtocolZoo.jl
ba2tro Nov 4, 2024
1a7bddb
fix for congestionchain example
ba2tro Nov 4, 2024
859292e
Add a connection-less and centralized protocol
ba2tro Nov 6, 2024
c965b4c
add the new example to tests
ba2tro Nov 6, 2024
a1fa6be
add new protocol to tests
ba2tro Nov 6, 2024
7dbc582
Merge branch 'master' into clcontroller
ba2tro Nov 8, 2024
656679f
Make classical and quantum channel delays customizable when initializ…
ba2tro Oct 24, 2024
a3842db
a more general predicate and choosing function
ba2tro Nov 14, 2024
a65fae9
Merge branch 'clcontroller' of https://github.com/ba2tro/QuantumSavor…
ba2tro Nov 14, 2024
bed4af2
Improve swap predicate with memoization and add condition for swaps o…
ba2tro Nov 22, 2024
1cf393a
Merge branch 'QuantumSavory:master' into clcontroller
ba2tro Nov 25, 2024
37ffab2
Add compat entry for Memoize.jl
ba2tro Nov 25, 2024
65a7d9f
infinite rounds for swapper in connection-less controller and separat…
ba2tro Dec 5, 2024
3dbd8aa
update test_controlplane.jl
ba2tro Dec 6, 2024
b61b6b6
update docstrings
ba2tro Dec 6, 2024
c86b7d7
fix
ba2tro Dec 11, 2024
3673750
Update sequence diagrams
ba2tro Dec 12, 2024
5297517
documentation and performance visualization
ba2tro Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add compat entry for Memoize.jl
ba2tro committed Nov 25, 2024
commit 37ffab2b611255f51d5cf944d784a91be4f37cad
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ Graphs = "1.9"
IterTools = "1.4.0"
LinearAlgebra = "1"
Makie = "0.20, 0.21"
Memoize = "0.4.4"
NetworkLayout = "0.4.4"
PrecompileTools = "1"
Printf = "1"

Unchanged files with check annotations Beta

"The number of rounds the Entangler should run for"
rounds::Int
end
Base.show(io::IO, tag::EntanglementRequest) = print(io, "$(tag.receiver) attempt entanglement generation with $(tag.neighbor)")
Tag(tag::EntanglementRequest) = Tag(EntanglementRequest, tag.receiver, tag.neighbor, tag.rounds)

Check warning on line 173 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L172-L173

Added lines #L172 - L173 were not covered by tests
"""
$TYPEDEF

Check warning on line 176 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L176

Added line #L176 was not covered by tests
A message sent from a controller to the [`RequestTracker`](@ref) at a node requesting it to perform a swap
"""whether the request is from a connection-oriented(0) or connection-less controller(1)"""
conn::Int
end
Base.show(io::IO, tag::SwapRequest) = print(io, "Node $(tag.swapping_node) perform a swap")
Tag(tag::SwapRequest) = Tag(SwapRequest, tag.swapping_node, tag.rounds, tag.src, tag.dst)

Check warning on line 197 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L196-L197

Added lines #L196 - L197 were not covered by tests
"""
$TYPEDEF
"""The node with which entanglement is to be generated"""
dst::Int
end
Base.show(io::IO, tag::DistributionRequest) = print(io, "Node $(tag.src) requesting entanglement with $(tag.dst)")
Tag(tag::DistributionRequest) = Tag(DistributionRequest, tag.src, tag.dst)

Check warning on line 215 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L214-L215

Added lines #L214 - L215 were not covered by tests
"""
workwasdone = true # waiting is not enough because we might have multiple rounds of work to do
while workwasdone
workwasdone = false # if there is nothing in the mb queue(querydelete returns nothing) we skip to waiting, otherwise we keep querying until the queue is empty
for requesttagsymbol in (EntanglementRequest, SwapRequest)

Check warning on line 531 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L531

Added line #L531 was not covered by tests
if requesttagsymbol == EntanglementRequest
msg = querydelete!(mb, requesttagsymbol, ❓, ❓, ❓)
@debug "RequestTracker @$(prot.node): Received $msg"
end
end
@debug "RequestTracker @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)

Check warning on line 563 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L563

Added line #L563 was not covered by tests
@debug "RequestTracker @$(prot.node): Message wait ends at $(now(prot.sim))"
end

Check warning on line 565 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L565

Added line #L565 was not covered by tests
end
include("utils.jl")
msg = Tag(DistributionRequest, prot.src, prot.dst)
put!(channel(prot.net, prot.src=>prot.controller; permit_forward=true), msg)
@yield timeout(prot.sim, rand(d))
end

Check warning on line 606 in src/ProtocolZoo/ProtocolZoo.jl

Codecov / codecov/patch

src/ProtocolZoo/ProtocolZoo.jl#L605-L606

Added lines #L605 - L606 were not covered by tests
end
ticktock::Float64
end
@resumable function (prot::NetController)()
paths = collect(Graphs.all_simple_paths(prot.net.graph, 1, 8))
n_reg = length(prot.net.registers)
mb = messagebuffer(prot.net, prot.node)
while true
draw = (randperm(n_reg))[1:prot.n]
for i in 1:prot.n
path = paths[draw[i]]
@debug "Running Entanglement Distribution on path $(path) @ $(now(prot.sim))"
for i in 1:length(path)-1
msg = Tag(EntanglementRequest, path[i], path[i+1], 1)
if prot.node == path[i]
put!(mb, msg)

Check warning on line 38 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L26-L38

Added lines #L26 - L38 were not covered by tests
else
put!(channel(prot.net, prot.node=>msg[2]; permit_forward=true), msg)

Check warning on line 40 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L40

Added line #L40 was not covered by tests
end
end

Check warning on line 42 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L42

Added line #L42 was not covered by tests
for i in 2:length(path)-1
msg = Tag(SwapRequest, path[i], 1)
if prot.node == path[i]
put!(mb, msg)

Check warning on line 47 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L44-L47

Added lines #L44 - L47 were not covered by tests
else
put!(channel(prot.net, prot.node=>msg[2];permit_forward=true), msg)

Check warning on line 49 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L49

Added line #L49 was not covered by tests
end
end
@yield timeout(prot.sim, prot.ticktock)
end
end

Check warning on line 54 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L51-L54

Added lines #L51 - L54 were not covered by tests
end
"""
path_id = path_selection(prot.sim, prot.path_mat[req_src, req_dst])
path = prot.path_mat[req_src, req_dst].paths[path_id]
if isnothing(path_id)
@debug "Request failed, all paths reserved"

Check warning on line 93 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L93

Added line #L93 was not covered by tests
end
@debug "Running Entanglement Distribution on path $(path) @ $(now(prot.sim))"
for i in 1:length(path)-1

Check warning on line 97 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L97

Added line #L97 was not covered by tests
msg = Tag(EntanglementRequest, path[i], path[i+1], 1)
if prot.node == path[i]
put!(mb, msg)

Check warning on line 100 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L100

Added line #L100 was not covered by tests
else
put!(channel(prot.net, prot.node=>msg[2]; permit_forward=true), msg)
end
end
for i in 2:length(path)-1

Check warning on line 106 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L106

Added line #L106 was not covered by tests
msg = Tag(SwapRequest, path[i], 1, path[i-1], path[i+1], 0)
if prot.node == path[i]
put!(mb, msg)
end
end
@debug "Controller @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)

Check warning on line 116 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L116

Added line #L116 was not covered by tests
@debug "Controller @$(prot.node): Message wait ends at $(now(prot.sim))"
end
end

Check warning on line 119 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L119

Added line #L119 was not covered by tests
end
msg = querydelete!(mb, DistributionRequest, ❓, ❓)
if !isnothing(msg)
(msg_src, (_, req_src, req_dst)) = msg
for v in vertices(prot.net)

Check warning on line 151 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L151

Added line #L151 was not covered by tests
if v != req_src && v != req_dst
msg = Tag(SwapRequest, v, 1, req_src, req_dst, 1)
if prot.node == v
end
end
@debug "Controller @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)

Check warning on line 163 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L163

Added line #L163 was not covered by tests
@debug "Controller @$(prot.node): Message wait ends at $(now(prot.sim))"
end
end

Check warning on line 166 in src/ProtocolZoo/controllers.jl

Codecov / codecov/patch

src/ProtocolZoo/controllers.jl#L166

Added line #L166 was not covered by tests
end
@process unreserve_path(sim, pathobj, i)
return i
end
end
pathobj.failures +=1
return nothing

Check warning on line 41 in src/ProtocolZoo/utils.jl

Codecov / codecov/patch

src/ProtocolZoo/utils.jl#L39-L41

Added lines #L39 - L41 were not covered by tests
end
@resumable function unreserve_path(sim, pathobj::PathMetadata, i)
@yield timeout(sim, 0.5)
@debug "Path $(pathobj.paths[i]) workload reduced"
pathobj.workloads[i] -= 1

Check warning on line 47 in src/ProtocolZoo/utils.jl

Codecov / codecov/patch

src/ProtocolZoo/utils.jl#L44-L47

Added lines #L44 - L47 were not covered by tests
end