dune-common
2.7.1
|
#include <dune/common/simd/test.hh>
Public Member Functions | |
template<class V , class Rebinds , template< class > class RebindPrune = IsLoop, template< class > class RebindAccept = Std::to_true_type> | |
void | check () |
run unit tests for simd vector type V More... | |
template<class V , class Rebinds , template< class > class Prune = IsLoop> | |
void | checkVector () |
run unit tests for simd vector type V More... | |
bool | good () const |
whether all tests succeeded More... | |
Test instantiation points | |
These functions should not be called directly, but serve as explicit instantiation points to keep memory usage bounded during compilation. There should be an explicit instantiation declaration ( If explicitly instantiating the top-level instantiation point Each instantiation point in the hierarchy implicitly instantiates its descendants, unless there are explicit instantiation declarations for them. However, for future-proofing it can make sense to explicitly instantiate nodes in the hierarchy even if all their children are already explicitly instantiated. This will limit the impact of instantiation points added in the future. | |
template<class V > | |
void | checkType () |
template<class V > | |
void | checkNonOps () |
template<class V > | |
void | checkUnaryOps () |
template<class V > | |
void | checkBinaryOps () |
template<class V > | |
void | checkBinaryOpsVectorVector () |
template<class V > | |
void | checkBinaryOpsScalarVector () |
template<class V > | |
void | checkBinaryOpsVectorScalar () |
template<class V > | |
void | checkBinaryOpsProxyVector () |
template<class V > | |
void | checkBinaryOpsVectorProxy () |
|
inline |
run unit tests for simd vector type V
This function will also ensure that check<W>()
is run, for any type W = Rebind<R, V>
where R
is in Rebinds
, and RebindPrune<W>::value == false
. No test will be run twice for a given type.
If the result of Rebind
is not pruned by RebindPrune
, it will be passed to RebindAccept
. If that rejects the type, a static assertion will trigger.
Rebinds | A list of types, usually in the form of a TypeList . |
RebindPrune | A type predicate determining whether to run check() for types obtained from Rebinds . |
RebindAccept | A type predicate determining whether a type is acceptable as the result of a Rebind . |
void Dune::Simd::UnitTest::checkBinaryOps |
void Dune::Simd::UnitTest::checkBinaryOpsProxyVector |
void Dune::Simd::UnitTest::checkBinaryOpsScalarVector |
void Dune::Simd::UnitTest::checkBinaryOpsVectorProxy |
void Dune::Simd::UnitTest::checkBinaryOpsVectorScalar |
void Dune::Simd::UnitTest::checkBinaryOpsVectorVector |
void Dune::Simd::UnitTest::checkNonOps |
void Dune::Simd::UnitTest::checkType |
void Dune::Simd::UnitTest::checkUnaryOps |
void Dune::Simd::UnitTest::checkVector |
run unit tests for simd vector type V
This function will also ensure that checkVector<Rebind<R, V>>()
(for any R
in Rebinds
) is run. No test will be run twice for a given type.
Rebinds | A list of types, usually in the form of a TypeList . |
Prune | A type predicate determining whether to run checkVector() for types obtained from Rebinds . |
check()
with the same template arguments. Rather than explicitly instantiating this function as described below, explicitly instantiate checkType()
and friends.standardtest.cc
for how to do this.Background: The compiler can use a lot of memory when compiling a unit test for many Simd vector types. E.g. for standardtest.cc, which tests all the fundamental arithmetic types plus std::complex
, g++ 4.9.2 (-g -O0 -Wall on x86_64 GNU/Linux) used ~6GByte.
One mitigation is to explicitly instantiate checkVector()
for the types that are tested. Still after doing that, standardtest.cc needed ~1.5GByte during compilation, which is more than the compilation units that actually instantiated checkVector()
(which clocked in at maximum at around 800MB, depending on how many instantiations they contained).
The second mitigation is to define checkVector()
outside of the class. I have no idea why this helps, but it makes compilation use less than ~100MByte. (Yes, functions defined inside the class are implicitly inline
, but the function is a template so it has inline semantics even when defined outside of the class. And I tried attribute
((noinline)), which had no effect on memory consumption.)
|
inline |
whether all tests succeeded