MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / main

Function main

test/source/thread_sanitizer/quick_sort.cpp:12–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 int hi);
11
12int main() {
13 std::cout << "Starting parallel quick sort test" << std::endl;
14
15 concurrencpp::runtime_options opts;
16 opts.max_cpu_threads = std::thread::hardware_concurrency() * 8;
17 concurrencpp::runtime runtime(opts);
18
19 ::srand(::time(nullptr));
20
21 std::vector<int> array(8'000'000);
22 for (auto& i : array) {
23 i = ::rand() % 100'000;
24 }
25
26 quick_sort({}, runtime.thread_pool_executor(), array.data(), 0, array.size() - 1).get();
27
28 const auto is_sorted = std::is_sorted(array.begin(), array.end());
29 if (!is_sorted) {
30 std::cerr << "Quick sort test failed: array is not sorted." << std::endl;
31 std::abort();
32 }
33
34 std::cout << "================================" << std::endl;
35}
36
37using namespace concurrencpp;
38

Callers

nothing calls this directly

Calls 6

quick_sortFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
getMethod · 0.45
thread_pool_executorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected