Replace TryAllTypes with trying exemplar tests

There were many tests that created code paths for every base and Vec
type that VTK-m supports (up to 4 components). Although this is
admirable, it is also excessive, and our compile times for the tests are
very long.

To shorten compile times, remove the TryAllTypes method. Replace it with
a version of TryTypes that uses a default list of "exemplar" set of
integers, floats, and Vecs.
This commit is contained in:
Kenneth Moreland 2016-08-24 16:02:18 -06:00
parent fc0d804ad0
commit f8442903d8
23 changed files with 49 additions and 35 deletions

@ -79,7 +79,7 @@ struct TryArrayInType
template<typename Device>
void TryArrayInTransport(Device)
{
vtkm::testing::Testing::TryAllTypes(TryArrayInType<Device>());
vtkm::testing::Testing::TryTypes(TryArrayInType<Device>());
}
void TestArrayInTransport()

@ -75,7 +75,7 @@ struct TryArrayOutType
template<typename Device>
void TryArrayOutTransport(Device)
{
vtkm::testing::Testing::TryAllTypes(TryArrayOutType<Device>());
vtkm::testing::Testing::TryTypes(TryArrayOutType<Device>());
}
void TestArrayOutTransport()

@ -99,7 +99,7 @@ void TestCheckAtomicArray()
void TestCheckArray()
{
vtkm::testing::Testing::TryAllTypes(TryArraysOfType());
vtkm::testing::Testing::TryTypes(TryArraysOfType());
std::cout << "Trying some arrays with types that do not match the list."
<< std::endl;

@ -160,7 +160,7 @@ struct TestFunctor
void TestArrayManagerShare()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -163,7 +163,7 @@ struct TestFunctor
void TestArrayPortalFromIterators()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -159,7 +159,7 @@ struct TestFunctor
void TestArrayIteratorFromArrayPortal()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -339,9 +339,9 @@ private:
{
void operator()() const
{
vtkm::testing::Testing::TryAllTypes(VerifyEmptyArrays());
vtkm::testing::Testing::TryAllTypes(VerifyUserAllocatedHandle());
vtkm::testing::Testing::TryAllTypes(VerifyVTKMAllocatedHandle());
vtkm::testing::Testing::TryTypes(VerifyEmptyArrays());
vtkm::testing::Testing::TryTypes(VerifyUserAllocatedHandle());
vtkm::testing::Testing::TryTypes(VerifyVTKMAllocatedHandle());
}
};

@ -206,8 +206,7 @@ struct TryInputType
void TestArrayHandleTransform()
{
// vtkm::testing::Testing::TryAllTypes(TryInputType());
vtkm::testing::Testing::TryTypes(TryInputType(), vtkm::TypeListTagCommon());
vtkm::testing::Testing::TryTypes(TryInputType());
}

@ -173,7 +173,7 @@ struct TestFunctor
void TestArrayPortalToIterators()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -441,8 +441,8 @@ void TestDynamicArrayHandle()
std::cout << "*** vtkm::Vec<Float64,3> **********" << std::endl;
TryDefaultType(vtkm::Vec<vtkm::Float64,3>());
std::cout << "Try all VTK-m types." << std::endl;
vtkm::testing::Testing::TryAllTypes(TryBasicVTKmType());
std::cout << "Try exemplar VTK-m types." << std::endl;
vtkm::testing::Testing::TryTypes(TryBasicVTKmType());
std::cout << "Try unusual type." << std::endl;
TryUnusualType();

@ -211,7 +211,7 @@ struct TestFunctor
void TestStorageBasic()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -131,7 +131,7 @@ struct TestFunctor
void TestStorageBasic()
{
vtkm::testing::Testing::TryAllTypes(TestFunctor());
vtkm::testing::Testing::TryTypes(TestFunctor());
}
} // Anonymous namespace

@ -87,7 +87,7 @@ struct TryType
void TestExecObjectFetch()
{
vtkm::testing::Testing::TryAllTypes(TryType());
vtkm::testing::Testing::TryTypes(TryType());
}
} // anonymous namespace

@ -97,7 +97,7 @@ struct TryType
void TestExecObjectFetch()
{
vtkm::testing::Testing::TryAllTypes(TryType());
vtkm::testing::Testing::TryTypes(TryType());
}
} // anonymous namespace

@ -286,7 +286,7 @@ public:
window.Init("Testing Window", 300, 300);
//verify that we can transfer basic arrays and constant value arrays to opengl
vtkm::testing::Testing::TryAllTypes(TransferFunctor());
vtkm::testing::Testing::TryTypes(TransferFunctor());
//verify that openGL interop works with all grid types in that we can
//transfer coordinates / verts and properties to openGL

@ -285,7 +285,8 @@ public:
FunctionType Function;
};
/// Runs template \p function on all the types in the given list.
/// Runs template \p function on all the types in the given list. If no type
/// list is given, then an exemplar list of types is used.
///
template<typename FunctionType, typename TypeList>
static void TryTypes(const FunctionType &function, TypeList)
@ -294,17 +295,31 @@ public:
TypeList());
}
/// Runs templated \p function on all the basic types defined in VTK-m. This
/// is helpful to test templated functions that should work on all types. If
/// the function is supposed to work on some subset of types, then use
/// \c TryTypes to restrict the call to some other list of types.
///
struct TypeListTagExemplarTypes
: vtkm::ListTagBase<vtkm::UInt8,
vtkm::Id,
vtkm::FloatDefault,
vtkm::Vec<vtkm::Float64,3> >
{ };
template<typename FunctionType>
static void TryAllTypes(const FunctionType &function)
static void TryTypes(const FunctionType &function)
{
TryTypes(function, vtkm::TypeListTagAll());
TryTypes(function, TypeListTagExemplarTypes());
}
// Disabled: This very long list results is very long compile times.
// /// Runs templated \p function on all the basic types defined in VTK-m. This
// /// is helpful to test templated functions that should work on all types. If
// /// the function is supposed to work on some subset of types, then use
// /// \c TryTypes to restrict the call to some other list of types.
// ///
// template<typename FunctionType>
// static void TryAllTypes(const FunctionType &function)
// {
// TryTypes(function, vtkm::TypeListTagAll());
// }
/// Runs templated \p function on all cell shapes defined in VTK-m. This is
/// helpful to test templated functions that should work on all cell types.
///

@ -762,8 +762,8 @@ void RunMathTests()
std::cout << "Test for scalar and vector types." << std::endl;
vtkm::testing::Testing::TryTypes(TryScalarVectorFieldTests<Device>(),
vtkm::TypeListTagField());
std::cout << "Test for all types." << std::endl;
vtkm::testing::Testing::TryAllTypes(TryAllTypesTests<Device>());
std::cout << "Test for exemplar types." << std::endl;
vtkm::testing::Testing::TryTypes(TryAllTypesTests<Device>());
std::cout << "Test all Abs types" << std::endl;
vtkm::testing::Testing::TryTypes(TryAbsTests<Device>(),
TypeListTagAbs());

@ -88,7 +88,7 @@ struct BinaryOperatorTestFunctor
void TestBinaryOperators()
{
vtkm::testing::Testing::TryAllTypes(BinaryOperatorTestFunctor());
vtkm::testing::Testing::TryTypes(BinaryOperatorTestFunctor());
//test BitwiseAnd
{

@ -80,7 +80,7 @@ struct BinaryPredicateTestFunctor
void TestBinaryPredicates()
{
vtkm::testing::Testing::TryAllTypes(BinaryPredicateTestFunctor());
vtkm::testing::Testing::TryTypes(BinaryPredicateTestFunctor());
//test LogicalAnd
{

@ -74,7 +74,7 @@ private:
static void TestTypeTraits()
{
TypeTraitTest test;
vtkm::testing::Testing::TryAllTypes(test);
vtkm::testing::Testing::TryTypes(test);
std::cout << "vtkm::Vec<vtkm::FloatDefault, 5>" << std::endl;
test(vtkm::Vec<vtkm::FloatDefault, 5>());
}

@ -479,7 +479,7 @@ void TestTypes()
{
CheckTypeSizes();
vtkm::testing::Testing::TryAllTypes(TypeTestFunctor());
vtkm::testing::Testing::TryTypes(TypeTestFunctor());
//try with some custom tuple types
TypeTestFunctor()( vtkm::Vec<vtkm::FloatDefault,6>() );

@ -56,7 +56,7 @@ struct UnaryPredicateTestFunctor
void TestUnaryPredicates()
{
vtkm::testing::Testing::TryAllTypes(UnaryPredicateTestFunctor());
vtkm::testing::Testing::TryTypes(UnaryPredicateTestFunctor());
//test LogicalNot
{

@ -46,7 +46,7 @@ struct TestVecTypeFunctor
void TestVecTraits()
{
TestVecTypeFunctor test;
vtkm::testing::Testing::TryAllTypes(test);
vtkm::testing::Testing::TryTypes(test);
std::cout << "vtkm::Vec<vtkm::FloatDefault, 5>" << std::endl;
test(vtkm::Vec<vtkm::FloatDefault,5>());