Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
flipgthb committed Jan 15, 2024
1 parent 0bcf78f commit eb9dfd1
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 193 deletions.
35 changes: 32 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "5902aa4cbdc90f37fe4ffcd1edcfda0f659c4971"
project_hash = "fcaf1a03f43730f617e1ecbadf378171f51cfb07"

[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
Expand Down Expand Up @@ -198,7 +198,7 @@ version = "1.6.1"
deps = ["Chain", "DataFrames", "Distributions", "LinearAlgebra", "NamedTupleTools", "Transducers"]
path = "src/DataPrep"
uuid = "d40174be-394b-476a-94dd-cdf19e683a9d"
version = "0.1.0"
version = "1.0.0"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
Expand Down Expand Up @@ -339,7 +339,7 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
deps = ["FGenerators", "LinearAlgebra", "StatsBase", "Transducers", "Tullio"]
path = "src/GBPAlgorithm"
uuid = "52f5dfbb-b0c2-49ff-99e4-0d4f43f103e5"
version = "0.1.0"
version = "1.0.0"

[[deps.HypergeometricFunctions]]
deps = ["DualNumbers", "LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"]
Expand Down Expand Up @@ -446,6 +446,12 @@ weakdeps = ["StaticArrays"]
[deps.LazyArrays.extensions]
LazyArraysStaticArraysExt = "StaticArrays"

[[deps.LeftChildRightSiblingTrees]]
deps = ["AbstractTrees"]
git-tree-sha1 = "fb6803dafae4a5d62ea5cab204b1e657d9737e7f"
uuid = "1d6d02ad-be62-4b6b-8a6d-2f90e265016e"
version = "0.2.0"

[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
Expand Down Expand Up @@ -563,6 +569,17 @@ version = "0.14.3"
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.2.0"

[[deps.ObservablePmap]]
deps = ["Distributed", "Logging", "Observables"]
git-tree-sha1 = "8afaa8d730c922e7d3304f51eb7f1036fcb0c89d"
uuid = "471f3579-fe7c-4d8d-9c38-de9ac94d91b4"
version = "0.2.1"

[[deps.Observables]]
git-tree-sha1 = "7438a59546cf62428fc9d1bc94729146d37a7225"
uuid = "510215fc-4207-5dde-b226-833fc4488ee2"
version = "0.5.5"

[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
Expand Down Expand Up @@ -641,6 +658,12 @@ version = "2.3.1"
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[deps.ProgressLogging]]
deps = ["Logging", "SHA", "UUIDs"]
git-tree-sha1 = "80d919dee55b9c50e8d9e2da5eeafff3fe58b539"
uuid = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
version = "0.1.4"

[[deps.ProgressMeter]]
deps = ["Distributed", "Printf"]
git-tree-sha1 = "00099623ffee15972c16111bcf84c58a0051257c"
Expand Down Expand Up @@ -845,6 +868,12 @@ deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"

[[deps.TerminalLoggers]]
deps = ["LeftChildRightSiblingTrees", "Logging", "Markdown", "Printf", "ProgressLogging", "UUIDs"]
git-tree-sha1 = "f133fab380933d042f6796eda4e130272ba520ca"
uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
version = "0.1.7"

[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ GBPAlgorithm = "52f5dfbb-b0c2-49ff-99e4-0d4f43f103e5"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NamedTupleTools = "d9ec5142-1e00-5aa0-9d6a-321866360f50"
ObservablePmap = "471f3579-fe7c-4d8d-9c38-de9ac94d91b4"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
Parquet2 = "98572fba-bba0-415d-956f-fa77e587d26d"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Transducers = "28d57a85-8fef-5791-bfe6-a80928e7c999"
Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"

Expand Down
206 changes: 206 additions & 0 deletions scripts/run_gbp_algorithm_multi_process.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
using Distributed
addprocs(4)

@everywhere using DrWatson

@everywhere begin
@quickactivate :GBPQAMDecoder

using Chain,
DataFrames,
Dates,
JLD2,
LinearAlgebra,
Observables,
ObservablePmap,
Parquet2,
ProgressMeter,
Random,
StatsBase,
TerminalLoggers,
Transducers
end

function move_cursor_up_while_clearing_lines(io,numlinesup)
for _ in 1:numlinesup
print(io,"\r\u1b[K\u1b[A")
end
end
move_cursor_up_while_clearing_lines(numlinesup) = Base.Fix1(move_cursor_up_while_clearing_lines,stderr)

function printover(io::IO,s::AbstractString, color::Symbol = :color_normal)
print(io,"\r")
printstyled(io,s; color=color)
# print(io,s)
print(io,"\u1b[K") # clear the rest of the line
end

printover(s::AbstractString,color::Symbol=:color_normal) = printover(stderr,s,color)

let
test_tasks = decoding_tasks_list(;
power=[-1,1],with_noise=[false,true],pilots=0,k=2,
load_batches=1#,alg_params=(;T=10,step=8,showprogressinfo=false)
)

@info "Warming up..."
obs, task = ologpmap(test_tasks; schedule_now=true, logger_f=TerminalLogger) do task_info
produce_or_load(
solve_decoding_task,task_info,datadir("results","testing_script");
force=true,verbose=true,tag=false
)
GC.gc()
end

sleep(45)

obs_func = on(obs; update=false, weak=true) do val
n = split(val,'\n')
s = val*"\n"^(21-n)
move_cursor_up_while_clearing_lines(21)
printover(s)
flush(stderr)
end
end;

GC.gc()

let
test_tasks = decoding_tasks_list(;
power=[-1,1],with_noise=[false,true],pilots=0,k=2,
load_batches=250#,alg_params=(;T=10,step=8,showprogressinfo=false)
)

@info "...One more..."
obs, task = ologpmap(test_tasks; schedule_now=true, logger_f=TerminalLogger) do task_info
produce_or_load(
solve_decoding_task,task_info,datadir("results","testing_script");
force=true,verbose=true,tag=false
)
GC.gc()
end

sleep(1)

# obs[] = join([rpad("",80) for _ in 1:nprocs()], '\n')
obs_func = on(obs; update=false, weak=true) do val
n = split(val,'\n')
s = val*"\n"^(21-n)
move_cursor_up_while_clearing_lines(21)
printover(s)
flush(stderr)
end
end;

let
test_tasks = decoding_tasks_list(;
power=collect(-2:8),with_noise=[false,true],pilots=collect(0:3),k=collect(1:3),
load_batches=2600#,alg_params=(;T=10,step=8,showprogressinfo=false)
)

@info "Running GBP for all cases"
obs, task = ologpmap(test_tasks; schedule_now=true, logger_f=TerminalLogger) do task_info
produce_or_load(
solve_decoding_task,task_info,datadir("results","gbp_all");
force=true,verbose=true,tag=false
)
GC.gc()
end

sleep(1800)

obs_func = on(obs; update=false, weak=true) do val
n = split(val,'\n')
s = val*"\n"^(21-n)
move_cursor_up_while_clearing_lines(21)
printover(s)
flush(stderr)
end
end;


# let
# test_tasks = decoding_tasks_list(;
# power=[-1,1],with_noise=[false,true],pilots=0,k=2,
# load_batches=1,alg_params=(;T=10,step=8,showprogressinfo=false)
# )

# p = Progress(length(test_tasks); desc="Warming up...", dt=10^-3, showspeed=true)
# channel = RemoteChannel(() -> Channel{Bool}(), 1)

# @sync begin # start two tasks which will be synced in the very end
# # the first task updates the progress bar
# @async while take!(channel)
# next!(p)
# end

# # the second task does the computation
# @async begin
# @distributed (+) for task_info in test_tasks
# produce_or_load(
# solve_decoding_task,task_info,datadir("results","testing_script");
# force=true,verbose=false,tag=false
# )
# GC.gc()
# put!(channel, true) # trigger a progress bar update
# 1
# end
# put!(channel, false) # this tells the printing task to finish
# end
# end

# # progress_pmap(test_tasks; progress) do task_info
# # GC.gc()
# # produce_or_load(
# # solve_decoding_task,task_info,datadir("results","testing_script");
# # force=true,verbose=false,tag=false
# # )
# # end

# GC.gc()
# end;

# GC.gc()

# let
# test_tasks = decoding_tasks_list(;
# power=[-1,1],with_noise=[false,true],pilots=0,k=2,
# load_batches=25,alg_params=(;T=10,step=8,showprogressinfo=false)
# )

# p = Progress(length(test_tasks); desc="... one more...", dt=10^-3, showspeed=true)
# channel = RemoteChannel(() -> Channel{Bool}(), 1)

# @sync begin # start two tasks which will be synced in the very end
# # the first task updates the progress bar
# @async while take!(channel)
# next!(p)
# end

# # the second task does the computation
# @async begin
# @distributed (+) for task_info in test_tasks
# produce_or_load(
# solve_decoding_task,task_info,datadir("results","testing_script");
# force=true,verbose=false,tag=false
# )
# GC.gc()
# put!(channel, true) # trigger a progress bar update
# 1
# end
# put!(channel, false) # this tells the printing task to finish
# end
# end

# # progress_pmap(test_tasks; progress) do task_info
# # GC.gc()
# # produce_or_load(
# # solve_decoding_task,task_info,datadir("results","testing_script");
# # force=true,verbose=false,tag=false
# # )
# # end

# GC.gc()
# end;

println("")
2 changes: 1 addition & 1 deletion scripts/run_gbp_algorithm_single_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ warm_up_results = let
load_batches=2
)

map(test_tasks) do task_info
results = map(test_tasks) do task_info
produce_or_load(solve_decoding_task,task_info,datadir("results","testing_script"); force=true)
end
end;
Expand Down
Loading

0 comments on commit eb9dfd1

Please sign in to comment.