Verified Commit 7ea9770d authored by Justin Carpentier's avatar Justin Carpentier
Browse files

bench/timings: increase number of tested passes

parent 831bd677
......@@ -60,8 +60,110 @@ namespace pinocchio
Algo::run(model.joints[i],data.joints[i]);
}
}
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
struct EmptyForwardStepUnaryVisitNoData
: fusion::JointUnaryVisitorBase< EmptyForwardStepUnaryVisitNoData<Scalar,Options,JointCollectionTpl> >
{
typedef ModelTpl<Scalar,Options,JointCollectionTpl> Model;
typedef DataTpl<Scalar,Options,JointCollectionTpl> Data;
typedef fusion::NoArg ArgsType;
template<typename JointModel>
EIGEN_DONT_INLINE
static void algo(const JointModelBase<JointModel> &)
{ // do nothing
}
};
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline void emptyForwardPassUnaryVisitNoData(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
DataTpl<Scalar,Options,JointCollectionTpl> & data)
{
PINOCCHIO_UNUSED_VARIABLE(data);
assert(model.check(data) && "data is not consistent with model.");
typedef typename ModelTpl<Scalar,Options,JointCollectionTpl>::JointIndex JointIndex;
typedef EmptyForwardStepUnaryVisitNoData<Scalar,Options,JointCollectionTpl> Algo;
for(JointIndex i=1; i < (JointIndex)model.njoints; ++i)
{
Algo::run(model.joints[i]);
}
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
struct EmptyForwardStepBinaryVisit
: fusion::JointBinaryVisitorBase< EmptyForwardStepBinaryVisit<Scalar,Options,JointCollectionTpl> >
{
typedef ModelTpl<Scalar,Options,JointCollectionTpl> Model;
typedef DataTpl<Scalar,Options,JointCollectionTpl> Data;
typedef fusion::NoArg ArgsType;
template<typename JointModel1, typename JointModel2>
EIGEN_DONT_INLINE
static void algo(const JointModelBase<JointModel1> &,
const JointModelBase<JointModel2> &,
JointDataBase<typename JointModel1::JointDataDerived> &,
JointDataBase<typename JointModel2::JointDataDerived> &)
{ // do nothing
}
};
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline void emptyForwardPassBinaryVisit(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
DataTpl<Scalar,Options,JointCollectionTpl> & data)
{
assert(model.check(data) && "data is not consistent with model.");
typedef typename ModelTpl<Scalar,Options,JointCollectionTpl>::JointIndex JointIndex;
typedef EmptyForwardStepBinaryVisit<Scalar,Options,JointCollectionTpl> Algo;
for(JointIndex i=1; i < (JointIndex)model.njoints; ++i)
{
Algo::run(model.joints[i],model.joints[i],
data.joints[i],data.joints[i]);
}
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
struct EmptyForwardStepBinaryVisitNoData
: fusion::JointBinaryVisitorBase< EmptyForwardStepBinaryVisitNoData<Scalar,Options,JointCollectionTpl> >
{
typedef ModelTpl<Scalar,Options,JointCollectionTpl> Model;
typedef DataTpl<Scalar,Options,JointCollectionTpl> Data;
typedef fusion::NoArg ArgsType;
template<typename JointModel1, typename JointModel2>
EIGEN_DONT_INLINE
static void algo(const JointModelBase<JointModel1> &,
const JointModelBase<JointModel2> &)
{ // do nothing
}
};
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline void emptyForwardPassBinaryVisitNoData(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
DataTpl<Scalar,Options,JointCollectionTpl> & data)
{
PINOCCHIO_UNUSED_VARIABLE(data);
assert(model.check(data) && "data is not consistent with model.");
typedef typename ModelTpl<Scalar,Options,JointCollectionTpl>::JointIndex JointIndex;
typedef EmptyForwardStepBinaryVisitNoData<Scalar,Options,JointCollectionTpl> Algo;
for(JointIndex i=1; i < (JointIndex)model.njoints; ++i)
{
Algo::run(model.joints[i],model.joints[i]);
}
}
}
int main(int argc, const char ** argv)
{
......@@ -250,7 +352,28 @@ int main(int argc, const char ** argv)
{
emptyForwardPassUnaryVisit(model,data);
}
std::cout << "Empty Forward Pass = \t"; timer.toc(std::cout,NBT);
std::cout << "Empty Forward Pass Unary visit (no computations) = \t"; timer.toc(std::cout,NBT);
timer.tic();
SMOOTH(NBT)
{
emptyForwardPassUnaryVisitNoData(model,data);
}
std::cout << "Empty Forward Pass Unary visit No Data (no computations) = \t"; timer.toc(std::cout,NBT);
timer.tic();
SMOOTH(NBT)
{
emptyForwardPassBinaryVisit(model,data);
}
std::cout << "Empty Forward Pass Binary visit (no computations) = \t"; timer.toc(std::cout,NBT);
timer.tic();
SMOOTH(NBT)
{
emptyForwardPassBinaryVisitNoData(model,data);
}
std::cout << "Empty Forward Pass Binary visit No Data (no computations) = \t"; timer.toc(std::cout,NBT);
timer.tic();
SMOOTH(NBT)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment