9#if defined(_MSC_VER) || defined(__ICL)
16 #include <parallel/algorithm>
24template<
typename ContainerType,
typename StopwatchType>
26 const ContainerType& container,
27 const StopwatchType& sw,
bool bShow=
true)
34 stream <<
"- Minimum: " << container.front()
35 <<
", Maximum: " << container.back()
36 <<
", Elapsed: " << sw.elapsed_time() <<
nL;
47 using container_t = std::vector<element_t>;
53 auto generator = crd::random_generator<element_t>(1, 100);
58 size_t size = 1'000'000;
59 size_t test_count = 5;
68 auto generators = generator.clone(test_count);
70 stream <<
"========== Parallel Sort ==========" <<
nL;
71 for(
size_t i = 0; i < test_count; ++i)
73 container_t sorted_container;
76 if(sorted_container.size() < 11)
77 stream <<i<<
" : " << sorted_container <<
nl;
81 #if defined(_MSC_VER) || defined(__ICL)
82 std::sort(std::execution::par_unseq, sorted_container.begin(), sorted_container.end());
83 #elif defined(_GLIBCXX_PARALLEL)
86 std::sort(sorted_container.begin(), sorted_container.end());
void examples_for_parallel_sort()
void print_container(size_t index, const ContainerType &container, const StopwatchType &sw, bool bShow=true)
tpf::chrono_random::stop_watch stop_watch
void random_fill(Type(&container)[N], RandomGeneratorType const &random_generator)
Implements random number generator and stop watch.
ContainerType< EleType > sort(ContainerType< EleType, Types... > container, sort_order order=sort_order::ascending, sort_method method=sort_method::size)
Stream output operators << are implemented.