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

switch upInitMsg to pull model #761

Merged
merged 42 commits into from
Jul 1, 2020
Merged

switch upInitMsg to pull model #761

merged 42 commits into from
Jul 1, 2020

Conversation

dehann
Copy link
Member

@dehann dehann commented Jul 1, 2020

Related to #674 decision to use only a message pull model. This PR is part of #459 refactoring. This PR is specifically focused on up-init-msg refactoring steps.

@dehann dehann linked an issue Jul 1, 2020 that may be closed by this pull request
10 tasks
@dehann dehann added this to the v0.12.2 milestone Jul 1, 2020
@dehann
Copy link
Member Author

dehann commented Jul 1, 2020

keep temporary debugging code:

using IncrementalInference

## small canonical factor graph, without graphinit
fg = generateCanonicalFG_CaesarRing1D(graphinit=false)
getSolverParams(fg).graphinit = false
getSolverParams(fg).dbg = true

# do all init on tree as part of solve
# getSolverParams(fg).drawtree = true
# tree, smt, hist = solveTree!(fg)


tree = wipeBuildNewTree!(fg)


# getSolverParams(fg).limititers = 50

TS = Vector{Task}(undef,6)

iters = 100*ones(Int, 6)

# good case
# iters = [47;53;25;34;34;34]
# iters = [59;46;26;35;35;35] # adding CSM 8e


# iters = [3;5;14;14;15;18]
# iters = [3;5;14;14;18;18] cannot find key 2
# iters = [10;16;14;18;18;15]
# iters = [6;16;18;18;18;15]
# iters = [10;16;18;18;18;15]

# all issues on attemptCliqInitDown
# iters = [10;16;19;18;18;15] # breaks on 3.19, key 2 not found
# iters = [10;16;18;19;18;15] # breaks on 4.19, key 2 not found
# iters = [10;17;18;18;18;15] # blocks on 2.17 ??
# iters = [10;16;18;18;19;15] # blocks on 5.19 ??

# iters = [10;16;18;18;24;15]

# w len == 1
# iters = [18;54;22;40;50;50]
# iters = [18;44;22;31;34;34]
# iters = [18;39;22;31;34;34]

# csm add 8e
# iters = [18;39;22;32;35;35]


SLEEP = 10

getSolverParams(fg).limititers = iters[3]
TS[3] = solveCliq!(fg, tree, :l1, recordcliq=true, async=true)
sleep(SLEEP)
getSolverParams(fg).limititers = iters[4]
TS[4] = solveCliq!(fg, tree, :x1, recordcliq=true, async=true)
sleep(SLEEP)
getSolverParams(fg).limititers = iters[2]
TS[2] = solveCliq!(fg, tree, :x4, recordcliq=true, async=true)
sleep(SLEEP)
getSolverParams(fg).limititers = iters[5]
TS[5] = solveCliq!(fg, tree, :x5, recordcliq=true, async=true)
sleep(SLEEP)
getSolverParams(fg).limititers = iters[1]
TS[1] = solveCliq!(fg, tree, :x0, recordcliq=true, async=true)
sleep(SLEEP)
getSolverParams(fg).limititers = iters[6]
TS[6] = solveCliq!(fg, tree, :x3, recordcliq=true, async=true)


sleep(SLEEP)
TS

##




hists = fetchCliqHistoryAll!(TS)
printCliqHistorySequential(hists)
printCliqHistorySequential(hists, joinLogPath(fg,"HistoryCSMAll.txt"))

0


##


using Logging


CLIQ = 5
STEP = 29

hist_ = fetch(TS[CLIQ])

fnct__ = deepcopy(hist_[STEP][3])
csmc__ = deepcopy(hist_[STEP][4])

# attachCSM!(csmc__, fg, tree)

csmc__.logger = SimpleLogger(stdout)

# getCliqueData(csmc__.cliq).solveCondition = Condition()
#
# getCliqueData(csmc__.cliq).initUpChannel
# tmpmsg = getCliqueData(csmc__.cliq).initUpChannel |> fetch
# getCliqueData(csmc__.cliq).initUpChannel = Channel{LikelihoodMessage}(1)
# put!(getCliqueData(csmc__.cliq).initUpChannel, tmpmsg)

# Juno.@enter fnct__(csmc__)
fnct__
fnct__ = fnct__(csmc__)
# Juno.@enter fnct__(csmc__)
# t5_19 = @async fnct__(csmc__)


# t4_19 = @async fnct__(csmc__)
# t3_19 = @async fnct__(csmc__)
# t5_25 = @async fnct__(csmc__)


istaskdone(t4_19)
istaskdone(t3_19)
istaskdone(t5_25)

fnct__ = fetch(t5_24)
0


## The error

# cliq 2, 3, or 4
csmc = csmc__
prnt = getParent(csmc.tree, csmc.cliq)[1]
dwinmsgs = prepCliqInitMsgsDown!(csmc.dfg, csmc.tree, prnt, csmc.cliq, logger=SimpleLogger(stdout), dbgnew=true)


0

## Other sequences that induce the same failures in either clique 2, 3, 4



# # makes cliq2 error with key 2 not found
# TS[1] = solveCliq!(fg, tree, :x0, recordcliq=true, async=true)
# sleep(5)
# TS[2] = solveCliq!(fg, tree, :x4, recordcliq=true, async=true)
# sleep(2)
# TS[5] = solveCliq!(fg, tree, :x5, recordcliq=true, async=true)
# sleep(2)
# TS[6] = solveCliq!(fg, tree, :x3, recordcliq=true, async=true)
# sleep(2)
# TS[3] = solveCliq!(fg, tree, :l1, recordcliq=true, async=true)
# sleep(2)
# TS[4] = solveCliq!(fg, tree, :x1, recordcliq=true, async=true)


# usually breaks on 4
# TS[4] = solveCliq!(fg, tree, :x1, recordcliq=true, async=true)
# TS[3] = solveCliq!(fg, tree, :l1, recordcliq=true, async=true)
# TS[1] = solveCliq!(fg, tree, :x0, recordcliq=true, async=true)
# TS[2] = solveCliq!(fg, tree, :x4, recordcliq=true, async=true)
# TS[5] = solveCliq!(fg, tree, :x5, recordcliq=true, async=true)
# TS[6] = solveCliq!(fg, tree, :x3, recordcliq=true, async=true)


#

@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2020

Codecov Report

Merging #761 into master will decrease coverage by 1.37%.
The diff coverage is 36.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #761      +/-   ##
==========================================
- Coverage   62.12%   60.75%   -1.38%     
==========================================
  Files          37       37              
  Lines        4520     4688     +168     
==========================================
+ Hits         2808     2848      +40     
- Misses       1712     1840     +128     
Impacted Files Coverage Δ
src/BeliefTypes.jl 25.80% <0.00%> (-27.53%) ⬇️
src/CliqStateMachineUtils.jl 53.18% <0.00%> (-6.26%) ⬇️
src/CliqueTypes.jl 47.05% <0.00%> (-41.84%) ⬇️
src/Deprecated.jl 20.00% <0.00%> (-2.00%) ⬇️
src/IncrementalInference.jl 75.00% <ø> (ø)
src/JunctionTree.jl 73.80% <0.00%> (ø)
src/JunctionTreeTypes.jl 17.68% <1.33%> (-13.84%) ⬇️
src/TreeMessageUtils.jl 54.76% <50.00%> (ø)
src/SolverAPI.jl 67.90% <66.66%> (+0.36%) ⬆️
src/TreeBasedInitialization.jl 85.38% <90.00%> (+1.40%) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbddb39...06c00b0. Read the comment docs.

@dehann dehann merged commit d45328b into master Jul 1, 2020
@dehann dehann deleted the wip/2Q20/refinit branch October 12, 2020 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate belief messages and message channels
2 participants