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

Replace PackedFactor convert functions with specific function. Two chicken and egg problems, unpack DFGFactor #1424

Closed
dehann opened this issue Oct 17, 2021 · 4 comments · Fixed by #1468 or #1466

Comments

@dehann
Copy link
Member

dehann commented Oct 17, 2021

We should NOT use driving assumption that Base.convert API is right way to hydrate DFGFactor (which currently internally rebuilds operational data like CCW).

function convert(
::Type{GenericFunctionNodeData{CommonConvWrapper{F}}},
packed::GenericFunctionNodeData{P} ) where {F <: AbstractFactor, P <: PackedInferenceType}
#
# TODO store threadmodel=MutliThreaded,SingleThreaded in persistence layer
usrfnc = convert(F, packed.fnc)
mhcat, nh = parseusermultihypo(packed.multihypo, packed.nullhypo)
# TODO -- improve _prepCCW for hypotheses and certainhypo field recovery when deserializing
# reconstitute from stored data
# FIXME, add threadmodel=threadmodel
# FIXME https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/590#issuecomment-776838053
# FIXME dont know what manifolds to use in ccw
ccw = _prepCCW(DFG.DFGVariable[], usrfnc, multihypo=mhcat, nullhypo=nh, inflation=packed.inflation)
ccw.certainhypo = packed.certainhypo
# CommonConvWrapper{typeof(usrfnc)}
ret = FunctionNodeData{typeof(ccw)}(packed.eliminated, packed.potentialused, packed.edgeIDs, ccw,
packed.multihypo, packed.certainhypo, packed.nullhypo,
packed.solveInProgress, packed.inflation )
#
return ret
end

By assuming empty array DFGVariable[] we create two chicken egg problems:

The assumption that we can hydrate a factor in a vacuum is false, we do need the connected DFGVariable type information. DFGVariable can however be hydrated in a vacuum.

@dehann dehann changed the title two chicken and egg problems two chicken and egg problems, unpack DFGFactor Oct 17, 2021
@GearsAD GearsAD changed the title two chicken and egg problems, unpack DFGFactor Replace PackedFactor convert functions with specific function. Two chicken and egg problems, unpack DFGFactor Oct 17, 2021
@GearsAD
Copy link
Collaborator

GearsAD commented Oct 17, 2021

Fix this when fixing JuliaRobotics/DistributedFactorGraphs.jl#590

@dehann
Copy link
Member Author

dehann commented Oct 17, 2021

we need to maintain the list of exceptions to DFG driver symmetries. In this case, the exception is:

  • rebuildFactorMetadata / OperationalMem is not required in all DFG drivers.
    • CDDFG supporting direct convolution and product operations is Tier 2 requirement at best (symmetry is important, but FactorOperationalMemory is needed and only exists in LightDFG).

@sam-globus
Copy link
Contributor

Yep,

LightDFG is our DFG for solving - it's optimized for this.

CGDFG and FileDFG (and ZmqDFG/GraphQLDFG, etc.) are all designed to get data from somewhere and put it into a LightDFG, and then transport solved data back into their respective destination. Those aren't built for solving/etc, to the point that ideally we don't rebuild the factor metadata.

@dehann
Copy link
Member Author

dehann commented Oct 17, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment