Lines Matching refs:T

92 template<typename T>
93 T& check_alignment(T& t, const char *aname) { in check_alignment()
101 template<typename T>
102 const T& check_alignment(const T& t, const char *aname) { in check_alignment()
147 template< typename T >
149 static inline void init(T &e) { e = static_cast<T>(0); } in init()
150 static inline void sum(T &e, const int addend ) { e += static_cast<T>(addend); } in sum()
151 static inline void sum(T &e, const double addend ) { e += static_cast<T>(addend); } in sum()
152 static inline void set(T &e, const int value ) { e = static_cast<T>(value); } in set()
153 static inline double get(const T &e ) { return static_cast<double>(e); } in get()
184 template <typename T, int Value>
189 T operator()() { return Value; } in operator ()()
214 template <typename T>
216 T operator()(const T& left, const T& right) const { in operator ()()
239 template <typename T>
241 T operator()(T left, T right ) const { in operator ()()
242 return FunctorAddCombineRef<T>()( left, right ); in operator ()()
246 template <typename T>
247 T FunctionAddByRef( const T &left, const T &right) { in FunctionAddByRef()
248 return FunctorAddCombineRef<T>()( left, right ); in FunctionAddByRef()
251 template <typename T>
252 T FunctionAdd( T left, T right) { return FunctionAddByRef(left,right); } in FunctionAdd()
254 template <typename T>
257 Accumulator(T& result) : my_result(result) {} in Accumulator()
260 test_helper<T>::set(my_result, test_helper<T>::get(other)); in operator =()
263 void operator()(const T& new_bit) { test_helper<T>::sum(my_result, new_bit); } in operator ()()
265 T& my_result;
268 template <typename T>
271 ClearingAccumulator(T& result) : my_result(result) {} in ClearingAccumulator()
274 test_helper<T>::set(my_result, test_helper<T>::get(other)); in operator =()
277 void operator()(T& new_bit) { in operator ()()
278 test_helper<T>::sum(my_result, new_bit); in operator ()()
279 test_helper<T>::init(new_bit); in operator ()()
281 static void AssertClean(const T& thread_local_value) { in AssertClean()
282 T zero; in AssertClean()
283 test_helper<T>::init(zero); in AssertClean()
284 REQUIRE_MESSAGE(test_helper<T>::get(thread_local_value)==test_helper<T>::get(zero), in AssertClean()
288 T& my_result;
297 template <typename T, template<class> class Allocator>
299 typedef oneapi::tbb::enumerable_thread_specific<T, Allocator<T> > ets_type;
309 test_helper<T>::sum( check_alignment(sums.local(),allocator_name), 1 ); in operator ()()
314 template< typename T, template<class> class Allocator>
317 typedef oneapi::tbb::enumerable_thread_specific<T, Allocator<T> > ets_type; in run_parallel_scalar_tests_nocombine()
319 Checker<T> my_check; in run_parallel_scalar_tests_nocombine()
330 T default_value{}; in run_parallel_scalar_tests_nocombine()
336 ets_type static_sums = ets_type( T() ); in run_parallel_scalar_tests_nocombine()
338 T exemplar; in run_parallel_scalar_tests_nocombine()
339 test_helper<T>::init(exemplar); in run_parallel_scalar_tests_nocombine()
344 T iterator_sum; in run_parallel_scalar_tests_nocombine()
345 test_helper<T>::init(iterator_sum); in run_parallel_scalar_tests_nocombine()
347 T finit_ets_sum; in run_parallel_scalar_tests_nocombine()
348 test_helper<T>::init(finit_ets_sum); in run_parallel_scalar_tests_nocombine()
350 T const_iterator_sum; in run_parallel_scalar_tests_nocombine()
351 test_helper<T>::init(const_iterator_sum); in run_parallel_scalar_tests_nocombine()
353 T range_sum; in run_parallel_scalar_tests_nocombine()
354 test_helper<T>::init(range_sum); in run_parallel_scalar_tests_nocombine()
356 T const_range_sum; in run_parallel_scalar_tests_nocombine()
357 test_helper<T>::init(const_range_sum); in run_parallel_scalar_tests_nocombine()
359 T cconst_sum; in run_parallel_scalar_tests_nocombine()
360 test_helper<T>::init(cconst_sum); in run_parallel_scalar_tests_nocombine()
362 T assign_sum; in run_parallel_scalar_tests_nocombine()
363 test_helper<T>::init(assign_sum); in run_parallel_scalar_tests_nocombine()
365 T cassgn_sum; in run_parallel_scalar_tests_nocombine()
366 test_helper<T>::init(cassgn_sum); in run_parallel_scalar_tests_nocombine()
367 T non_cassgn_sum; in run_parallel_scalar_tests_nocombine()
368 test_helper<T>::init(non_cassgn_sum); in run_parallel_scalar_tests_nocombine()
370 T static_sum; in run_parallel_scalar_tests_nocombine()
371 test_helper<T>::init(static_sum); in run_parallel_scalar_tests_nocombine()
377 FunctorFinit<T,0> my_finit(SecretTag); in run_parallel_scalar_tests_nocombine()
381 … oneapi::tbb::blocked_range<int>( 0, N*p, RANGE_MIN ), parallel_scalar_body<T,Allocator>( sums, al… in run_parallel_scalar_tests_nocombine()
385 … oneapi::tbb::blocked_range<int>( 0, N*p, RANGE_MIN ), parallel_scalar_body<T,Allocator>( finit_et… in run_parallel_scalar_tests_nocombine()
389 … oneapi::tbb::blocked_range<int>( 0, N*p, RANGE_MIN ), parallel_scalar_body<T,Allocator>( static_s… in run_parallel_scalar_tests_nocombine()
396 test_helper<T>::sum(iterator_sum, *i); in run_parallel_scalar_tests_nocombine()
402 test_helper<T>::sum(const_iterator_sum, *i); in run_parallel_scalar_tests_nocombine()
408 test_helper<T>::sum(range_sum, *i); in run_parallel_scalar_tests_nocombine()
415 test_helper<T>::sum(const_range_sum, *i); in run_parallel_scalar_tests_nocombine()
419 …typedef typename oneapi::tbb::enumerable_thread_specific<T, Allocator<T>, oneapi::tbb::ets_key_per… in run_parallel_scalar_tests_nocombine()
424 T& ref = cconst.local(exists); in run_parallel_scalar_tests_nocombine()
433 test_helper<T>::sum(cconst_sum, *i); in run_parallel_scalar_tests_nocombine()
441 test_helper<T>::sum(assign_sum, *i); in run_parallel_scalar_tests_nocombine()
448 test_helper<T>::sum(cassgn_sum, *i); in run_parallel_scalar_tests_nocombine()
454 test_helper<T>::sum(non_cassgn_sum, *i); in run_parallel_scalar_tests_nocombine()
459 test_helper<T>::sum(finit_ets_sum, *i); in run_parallel_scalar_tests_nocombine()
464 test_helper<T>::sum(static_sum, *i); in run_parallel_scalar_tests_nocombine()
469 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(iterator_sum)); in run_parallel_scalar_tests_nocombine()
470 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(const_iterator_sum)); in run_parallel_scalar_tests_nocombine()
471 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(range_sum)); in run_parallel_scalar_tests_nocombine()
472 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(const_range_sum)); in run_parallel_scalar_tests_nocombine()
474 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(cconst_sum)); in run_parallel_scalar_tests_nocombine()
475 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(assign_sum)); in run_parallel_scalar_tests_nocombine()
476 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(cassgn_sum)); in run_parallel_scalar_tests_nocombine()
477 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(non_cassgn_sum)); in run_parallel_scalar_tests_nocombine()
478 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(finit_ets_sum)); in run_parallel_scalar_tests_nocombine()
479 REQUIRE(EXPECTED_SUM*p == test_helper<T>::get(static_sum)); in run_parallel_scalar_tests_nocombine()
484 template< typename T, template<class> class Allocator>
487 typedef oneapi::tbb::enumerable_thread_specific<T, Allocator<T> > ets_type; in run_parallel_scalar_tests()
491 ets_type static_sums = ets_type( T() ); in run_parallel_scalar_tests()
493 T exemplar; in run_parallel_scalar_tests()
494 test_helper<T>::init(exemplar); in run_parallel_scalar_tests()
506 run_parallel_scalar_tests_nocombine<T,Allocator>(test_name, allocator_name); in run_parallel_scalar_tests()
516 T combine_sum; in run_parallel_scalar_tests()
517 test_helper<T>::init(combine_sum); in run_parallel_scalar_tests()
519 T combine_ref_sum; in run_parallel_scalar_tests()
520 test_helper<T>::init(combine_ref_sum); in run_parallel_scalar_tests()
522 T accumulator_sum; in run_parallel_scalar_tests()
523 test_helper<T>::init(accumulator_sum); in run_parallel_scalar_tests()
525 T static_sum; in run_parallel_scalar_tests()
526 test_helper<T>::init(static_sum); in run_parallel_scalar_tests()
528 T clearing_accumulator_sum; in run_parallel_scalar_tests()
529 test_helper<T>::init(clearing_accumulator_sum); in run_parallel_scalar_tests()
532 Checker<T> my_check; in run_parallel_scalar_tests()
544 parallel_scalar_body<T, Allocator>(sums, allocator_name)); in run_parallel_scalar_tests()
549 parallel_scalar_body<T, Allocator>(static_sums, allocator_name)); in run_parallel_scalar_tests()
553 test_helper<T>::sum(combine_sum, sums.combine(FunctionAdd<T>)); in run_parallel_scalar_tests()
554 test_helper<T>::sum(combine_ref_sum, sums.combine(FunctionAddByRef<T>)); in run_parallel_scalar_tests()
555 test_helper<T>::sum(static_sum, static_sums.combine(FunctionAdd<T>)); in run_parallel_scalar_tests()
558 sums.combine_each(Accumulator<T>(accumulator_sum)); in run_parallel_scalar_tests()
560 sums.combine_each(ClearingAccumulator<T>(clearing_accumulator_sum)); in run_parallel_scalar_tests()
562 sums.combine_each(ClearingAccumulator<T>::AssertClean); in run_parallel_scalar_tests()
573 REQUIRE(EXPECTED_SUM * p == test_helper<T>::get(combine_sum)); in run_parallel_scalar_tests()
574 REQUIRE(EXPECTED_SUM * p == test_helper<T>::get(combine_ref_sum)); in run_parallel_scalar_tests()
575 REQUIRE(EXPECTED_SUM * p == test_helper<T>::get(static_sum)); in run_parallel_scalar_tests()
576 REQUIRE(EXPECTED_SUM * p == test_helper<T>::get(accumulator_sum)); in run_parallel_scalar_tests()
577 REQUIRE(EXPECTED_SUM * p == test_helper<T>::get(clearing_accumulator_sum)); in run_parallel_scalar_tests()
586 template <typename T, template<class> class Allocator>
588 typedef std::vector<T, oneapi::tbb::tbb_allocator<T> > container_type;
598 T one; in operator ()()
599 test_helper<T>::set(one, 1); in operator ()()
608 template <typename R, typename T>
611 T sum;
613 typedef std::vector<T, oneapi::tbb::tbb_allocator<T> > container_type;
615 parallel_vector_reduce_body ( ) : count(0) { test_helper<T>::init(sum); } in parallel_vector_reduce_body()
616 …tor_reduce_body ( parallel_vector_reduce_body<R, T> &, oneapi::tbb::split ) : count(0) { test_hel… in parallel_vector_reduce_body()
623 test_helper<T>::sum(sum, *vi); in operator ()()
629 test_helper<T>::sum(sum,b.sum); in join()
635 template< typename T, template<class> class Allocator>
637 typedef std::vector<T, oneapi::tbb::tbb_allocator<T> > container_type; in run_parallel_vector_tests()
643 T sum; in run_parallel_vector_tests()
644 test_helper<T>::init(sum); in run_parallel_vector_tests()
651 parallel_vector_for_body<T,Allocator>( vs, allocator_name ) ); in run_parallel_vector_tests()
661 parallel_vector_reduce_body< typename ets_type::const_range_type, T > pvrb; in run_parallel_vector_tests()
664 test_helper<T>::sum(sum, pvrb.sum); in run_parallel_vector_tests()
696 T minus_one; in run_parallel_vector_tests()
697 test_helper<T>::set(minus_one, -1); in run_parallel_vector_tests()
700 …ets_type vvs( typename container_type::size_type(25), minus_one, oneapi::tbb::tbb_allocator<T>() ); in run_parallel_vector_tests()
702 …eapi::tbb::blocked_range<int> (0, N*p, RANGE_MIN), parallel_vector_for_body<T,Allocator>( vvs, all… in run_parallel_vector_tests()
705 parallel_vector_reduce_body< typename ets_type::const_range_type, T > pvrb2; in run_parallel_vector_tests()
708 REQUIRE( test_helper<T>::get(pvrb2.sum) == N*p-pvrb2.count*25 ); in run_parallel_vector_tests()
715 double result_value = test_helper<T>::get(sum); in run_parallel_vector_tests()
720 template<typename T, template<class> class Allocator>
723 typedef std::vector<T, oneapi::tbb::tbb_allocator<T> > container_type; in run_cross_type_vector_tests()
728 T sum; in run_cross_type_vector_tests()
729 test_helper<T>::init(sum); in run_cross_type_vector_tests()
737 …eapi::tbb::blocked_range<int> (0, N*p, RANGE_MIN), parallel_vector_for_body<T, Allocator>( vs, all… in run_cross_type_vector_tests()
747 parallel_vector_reduce_body< typename ets_nokey_type::const_range_type, T > pvrb; in run_cross_type_vector_tests()
750 test_helper<T>::sum(sum, pvrb.sum); in run_cross_type_vector_tests()
774 double result_value = test_helper<T>::get(sum); in run_cross_type_vector_tests()
779 template< typename T >
781 T sum; in run_serial_scalar_tests()
782 test_helper<T>::init(sum); in run_serial_scalar_tests()
786 test_helper<T>::sum(sum,1); in run_serial_scalar_tests()
790 double result_value = test_helper<T>::get(sum); in run_serial_scalar_tests()
794 template< typename T >
796 T sum; in run_serial_vector_tests()
797 test_helper<T>::init(sum); in run_serial_vector_tests()
798 T one; in run_serial_vector_tests()
799 test_helper<T>::set(one, 1); in run_serial_vector_tests()
802 std::vector<T, oneapi::tbb::tbb_allocator<T> > v; in run_serial_vector_tests()
806 …for (typename std::vector<T, oneapi::tbb::tbb_allocator<T> >::const_iterator i = v.begin(); i != v… in run_serial_vector_tests()
807 test_helper<T>::sum(sum, *i); in run_serial_vector_tests()
810 double result_value = test_helper<T>::get(sum); in run_serial_vector_tests()
840 template<typename T, template<class> class Allocator, typename Init>
841 oneapi::tbb::enumerable_thread_specific<T,Allocator<T> > MakeETS( Init init ) { in MakeETS()
842 return oneapi::tbb::enumerable_thread_specific<T,Allocator<T> >(init); in MakeETS()
851 template<typename T, template<class> class Allocator, typename... P>
852 oneapi::tbb::enumerable_thread_specific<T,Allocator<T> > MakeETS( oneapi::tbb::detail::stored_pack<… in MakeETS()
853 typedef oneapi::tbb::enumerable_thread_specific<T,Allocator<T> > result_type; in MakeETS()
859 template<typename T, template<class> class Allocator, typename InitSrc, typename InitDst, typename …
861 typedef oneapi::tbb::enumerable_thread_specific<T, Allocator<T> > ets_type; in ets_copy_assign_test()
864 const ets_type& cref_binder = MakeETS<T, Allocator>(init1); in ets_copy_assign_test()
886 ets_type&& rvref_binder = MakeETS<T, Allocator>(init1); in ets_copy_assign_test()
907 template<typename T, int Expected>
909 void operator()( const T& value ) { in operator ()()
910 REQUIRE(test_helper<T>::get(value) == Expected); in operator ()()
912 void operator()( const std::pair<int,T>& value ) { in operator ()()
914 REQUIRE(test_helper<T>::get(value.second) == Expected*value.first); in operator ()()
918 template <typename T, template<class> class Allocator>
923 T src_init; in run_assign_and_copy_constructor_test()
924 test_helper<T>::set(src_init,EXPECTED); in run_assign_and_copy_constructor_test()
925 T other_init; in run_assign_and_copy_constructor_test()
926 test_helper<T>::init(other_init); in run_assign_and_copy_constructor_test()
927 … ets_copy_assign_test<T, Allocator>(src_init, other_init, Validator<T,EXPECTED>(), allocator_name); in run_assign_and_copy_constructor_test()
930 FunctorFinit<T,EXPECTED> src_finit(SecretTag); in run_assign_and_copy_constructor_test()
931 FunctorFinit<T,0> other_finit(SecretTag); in run_assign_and_copy_constructor_test()
932 …ets_copy_assign_test<T, Allocator>(src_finit, other_finit, Validator<T,EXPECTED>(), allocator_name… in run_assign_and_copy_constructor_test()
936 test_helper<T>::set(src_init,EXPECTED*17); in run_assign_and_copy_constructor_test()
937 …y_assign_test< std::pair<int,T>, Allocator>(oneapi::tbb::detail::save_pack(17,src_init), std::make… in run_assign_and_copy_constructor_test()