Added timing statements in new code

release/4.3a0
Richard Roberts 2013-07-23 18:34:23 +00:00
parent 65657916ab
commit c788c525ea
9 changed files with 19 additions and 5 deletions

View File

@ -30,6 +30,7 @@ namespace gtsam {
OptionalOrdering ordering, const Eliminate& function, OptionalVariableIndex variableIndex) const
{
if(ordering && variableIndex) {
gttic(eliminateSequential);
// Do elimination
std::pair<boost::shared_ptr<BayesNetType>, boost::shared_ptr<FactorGraphType> > result
= EliminationTreeType(asDerived(), *variableIndex, *ordering).eliminate(function);
@ -60,6 +61,7 @@ namespace gtsam {
OptionalOrdering ordering, const Eliminate& function, OptionalVariableIndex variableIndex) const
{
if(ordering && variableIndex) {
gttic(eliminateMultifrontal);
// Do elimination with given ordering
std::pair<boost::shared_ptr<BayesTreeType>, boost::shared_ptr<FactorGraphType> > result
= JunctionTreeType(EliminationTreeType(asDerived(), *variableIndex, *ordering)).eliminate(function);
@ -90,6 +92,7 @@ namespace gtsam {
const OrderingUnordered& ordering, const Eliminate& function, OptionalVariableIndex variableIndex) const
{
if(variableIndex) {
gttic(eliminatePartialSequential);
// Do elimination
return EliminationTreeType(asDerived(), *variableIndex, ordering).eliminate(function);
} else {
@ -105,6 +108,7 @@ namespace gtsam {
const OrderingUnordered& ordering, const Eliminate& function, OptionalVariableIndex variableIndex) const
{
if(variableIndex) {
gttic(eliminatePartialMultifrontal);
// Do elimination
return JunctionTreeType(EliminationTreeType(asDerived(), *variableIndex, ordering)).eliminate(function);
} else {
@ -126,6 +130,7 @@ namespace gtsam {
{
if(marginalizedVariableOrdering)
{
gttic(marginalMultifrontalBayesNet);
// An ordering was provided for the marginalized variables, so we can first eliminate them
// in the order requested.
std::pair<boost::shared_ptr<BayesTreeType>, boost::shared_ptr<FactorGraphType> > eliminated =

View File

@ -80,7 +80,7 @@ namespace gtsam {
EliminationTreeUnordered<BAYESNET,GRAPH>::EliminationTreeUnordered(const FactorGraphType& graph,
const VariableIndexUnordered& structure, const OrderingUnordered& order)
{
gttic(ET_Create1);
gttic(EliminationTree_Contructor);
// Number of factors and variables - NOTE in the case of partial elimination, n here may
// be fewer variables than are actually present in the graph.
@ -187,6 +187,7 @@ namespace gtsam {
std::pair<boost::shared_ptr<BAYESNET>, boost::shared_ptr<GRAPH> >
EliminationTreeUnordered<BAYESNET,GRAPH>::eliminate(Eliminate function) const
{
gttic(EliminationTree_eliminate);
// Allocate result
boost::shared_ptr<BayesNetType> result = boost::make_shared<BayesNetType>();

View File

@ -31,6 +31,7 @@ namespace gtsam {
/* ************************************************************************* */
template <class FG, class BTCLIQUE>
void JunctionTree<FG,BTCLIQUE>::construct(const FG& fg, const VariableIndex& variableIndex) {
gttic(JT_construct);
gttic(JT_symbolic_ET);
const typename EliminationTree<IndexFactor>::shared_ptr symETree =
EliminationTree<IndexFactor>::Create(fg, variableIndex);

View File

@ -195,6 +195,7 @@ namespace gtsam {
JunctionTreeUnordered<BAYESTREE,GRAPH>
JunctionTreeUnordered<BAYESTREE,GRAPH>::FromEliminationTree(const ETREE& eliminationTree)
{
gttic(JunctionTree_FromEliminationTree);
// Here we rely on the BayesNet having been produced by this elimination tree, such that the
// conditionals are arranged in DFS post-order. We traverse the elimination tree, and inspect
// the symbolic conditional corresponding to each node. The elimination tree node is added to
@ -238,7 +239,7 @@ namespace gtsam {
std::pair<boost::shared_ptr<BAYESTREE>, boost::shared_ptr<GRAPH> >
JunctionTreeUnordered<BAYESTREE,GRAPH>::eliminate(const Eliminate& function) const
{
gttic(JunctionTreeUnordered_eliminate);
gttic(JunctionTree_eliminate);
// Do elimination (depth-first traversal). The rootsContainer stores a 'dummy' BayesTree node
// that contains all of the roots as its children. rootsContainer also stores the remaining
// uneliminated factors passed up from the roots.

View File

@ -84,7 +84,9 @@ public:
/* ************************************************************************* */
template<class FG>
VariableSlots::VariableSlots(const FG& factorGraph) {
VariableSlots::VariableSlots(const FG& factorGraph)
{
gttic(VariableSlots_constructor);
static const bool debug = false;
// Compute a mapping (called variableSlots) *from* each involved

View File

@ -109,6 +109,7 @@ namespace gtsam {
/* ************************************************************************* */
VectorValuesUnordered GaussianBayesTreeUnordered::optimize() const
{
gttic(GaussianBayesTree_optimize);
internal::OptimizeData rootData; // Will hold final solution
treeTraversal::DepthFirstForest(*this, rootData, internal::OptimizePreVisitor, internal::OptimizePostVisitor);
return rootData.results;

View File

@ -198,6 +198,7 @@ namespace gtsam {
/* ************************************************************************* */
VectorValuesUnordered GaussianFactorGraphUnordered::optimize(const Eliminate& function) const
{
gttic(GaussianFactorGraph_optimize);
return BaseEliminateable::eliminateMultifrontal(boost::none, function)->optimize();
}

View File

@ -50,13 +50,12 @@ GaussianBayesTree::shared_ptr GaussianMultifrontalSolver::eliminate() const {
/* ************************************************************************* */
VectorValues::shared_ptr GaussianMultifrontalSolver::optimize() const {
gttic(optimize);
gttic(GaussianMultifrontalSolver_optimize);
VectorValues::shared_ptr values;
if (useQR_)
values = VectorValues::shared_ptr(new VectorValues(junctionTree_->optimize(&EliminateQR)));
else
values= VectorValues::shared_ptr(new VectorValues(junctionTree_->optimize(&EliminatePreferCholesky)));
gttoc(optimize);
return values;
}

View File

@ -218,6 +218,7 @@ namespace gtsam {
// Cast or convert to Jacobians
std::vector<JacobianFactorUnordered::shared_ptr> jacobians = _convertOrCastToJacobians(graph);
gttic(Order_slots);
// Order variable slots - we maintain the vector of ordered slots, as well as keep a list
// 'unorderedSlots' of any variables discovered that are not in the ordering. Those will then
// be added after all of the ordered variables.
@ -252,6 +253,7 @@ namespace gtsam {
for(VariableSlots::const_iterator item = variableSlots->begin(); item != variableSlots->end(); ++item)
orderedSlots.push_back(item);
}
gttoc(Order_slots);
// Count dimensions
vector<DenseIndex> varDims;
@ -497,6 +499,7 @@ namespace gtsam {
std::pair<boost::shared_ptr<GaussianConditionalUnordered>, boost::shared_ptr<JacobianFactorUnordered> >
EliminateQRUnordered(const GaussianFactorGraphUnordered& factors, const OrderingUnordered& keys)
{
gttic(EliminateQRUnordered);
// Combine and sort variable blocks in elimination order
JacobianFactorUnordered::shared_ptr jointFactor;
try {