alugowski / poolstl Goto Github PK
View Code? Open in Web Editor NEWLight and self-contained implementation of C++17 parallel algorithms.
License: BSD 2-Clause "Simplified" License
Light and self-contained implementation of C++17 parallel algorithms.
License: BSD 2-Clause "Simplified" License
Hi,
I have tested the replacement in my project and it works just fine on windows visual studio 2022 and android studio 2022.3.1 (ndk 26.1.109)
It works as expected, however with emscripten, the code below fails with the provided log.
version of poolSTL 0.3.4
I am not sure if you have tested it with emscripten, this stack trace is from google chrome. I'll keep looking in to it, I have provided the report in case you can provide more info.
#define POOLSTL_STD_SUPPLEMENT 1
#include <poolSTL/poolstl.hpp>
#include <vector>
int main()
{
// Create a vector of 10 numbers
std::vector<int> numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// Sum the numbers in parallel using std::reduce with std::execution::par
int sum = std::reduce(std::execution::par, numbers.begin(), numbers.end());
return sum;
}
$std::__2::__throw_system_error(int, char const*) @ system_error.cpp:293
$std::__2::thread::thread<void (task_thread_pool::task_thread_pool::*)(), task_thread_pool::task_thread_pool*, void>(void (task_thread_pool::task_thread_pool::*&&)(), task_thread_pool::task_thread_pool*&&) @ thread.h:252
$void std::__2::allocator<std::__2::thread>::construct[abi:ue170004]<std::__2::thread, void (task_thread_pool::task_thread_pool::*)(), task_thread_pool::task_thread_pool*>(std::__2::thread*, void (task_thread_pool::task_thread_pool::*&&)(), task_thread_pool::task_thread_pool*&&) @ allocator.h:167
$void std::__2::allocator_traits<std::__2::allocator<std::__2::thread>>::construct[abi:ue170004]<std::__2::thread, void (task_thread_pool::task_thread_pool::*)(), task_thread_pool::task_thread_pool*, void>(std::__2::allocator<std::__2::thread>&, std::__2::thread*, void (task_thread_pool::task_thread_pool::*&&)(), task_thread_pool::task_thread_pool*&&) @ allocator_traits.h:296
$void std::__2::vector<std::__2::thread, std::__2::allocator<std::__2::thread>>::__emplace_back_slow_path<void (task_thread_pool::task_thread_pool::*)(), task_thread_pool::task_thread_pool*>(void (task_thread_pool::task_thread_pool::*&&)(), task_thread_pool::task_thread_pool*&&) @ vector:1660
$std::__2::thread& std::__2::vector<std::__2::thread, std::__2::allocator<std::__2::thread>>::emplace_back<void (task_thread_pool::task_thread_pool::*)(), task_thread_pool::task_thread_pool*>(void (task_thread_pool::task_thread_pool::*&&)(), task_thread_pool::task_thread_pool*&&) @ vector:1681
$task_thread_pool::task_thread_pool::start_threads(unsigned int) @ poolstl.hpp:407
$task_thread_pool::task_thread_pool::task_thread_pool(unsigned int) @ poolstl.hpp:157
$std::__2::__shared_ptr_emplace<task_thread_pool::task_thread_pool, std::__2::allocator<task_thread_pool::task_thread_pool>>::__shared_ptr_emplace[abi:ue170004]<>(std::__2::allocator<task_thread_pool::task_thread_pool>) @ shared_ptr.h:302
$std::__2::shared_ptr<task_thread_pool::task_thread_pool> std::__2::allocate_shared[abi:ue170004]<task_thread_pool::task_thread_pool, std::__2::allocator<task_thread_pool::task_thread_pool>, void>(std::__2::allocator<task_thread_pool::task_thread_pool> const&) @ shared_ptr.h:1022
$std::__2::shared_ptr<task_thread_pool::task_thread_pool> std::__2::make_shared[abi:ue170004]<task_thread_pool::task_thread_pool, void>() @ shared_ptr.h:1031
$poolstl::execution::internal::get_default_pool()::'lambda'()::operator()() const @ poolstl.hpp:686
$decltype(std::declval<poolstl::execution::internal::get_default_pool()::'lambda'()>()()) std::__2::__invoke[abi:ue170004]<poolstl::execution::internal::get_default_pool()::'lambda'()>(poolstl::execution::internal::get_default_pool()::'lambda'()&&) @ invoke.h:340
$void std::__2::__call_once_param<std::__2::tuple<poolstl::execution::internal::get_default_pool()::'lambda'()&&>>::__execute[abi:ue170004]<>(std::__2::__tuple_indices<...>) @ mutex:632
$std::__2::__call_once_param<std::__2::tuple<poolstl::execution::internal::get_default_pool()::'lambda'()&&>>::operator()[abi:ue170004]() @ mutex:624
$void std::__2::__call_once_proxy[abi:ue170004]<std::__2::tuple<poolstl::execution::internal::get_default_pool()::'lambda'()&&>>(void*) @ mutex:660
$std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*)) @ mutex.cpp:238
$void std::__2::call_once[abi:ue170004]<poolstl::execution::internal::get_default_pool()::'lambda'()>(std::__2::once_flag&, poolstl::execution::internal::get_default_pool()::'lambda'()&&) @ mutex:677
$poolstl::execution::internal::get_default_pool() @ poolstl.hpp:686
$poolstl::execution::parallel_policy::pool() const @ poolstl.hpp:730
$std::__2::vector<std::__2::future<int>, std::__2::allocator<std::__2::future<int>>> poolstl::internal::parallel_chunk_for_1<poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, int (*)(std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>, int, std::__2::plus<int>), int, int&, std::__2::plus<int>&>(poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>, int (*)(std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>, int, std::__2::plus<int>), int*, int, int&, std::__2::plus<int>&) @ poolstl.hpp:1698
$std::__2::enable_if<std::is_base_of<poolstl::execution::poolstl_policy, std::__2::remove_cv<std::__2::remove_reference<poolstl::execution::parallel_policy const&>::type>::type>::value, int>::type std::reduce<poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, int, std::__2::plus<int>>(poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>, int, std::__2::plus<int>) @ poolstl.hpp:2578
$std::__2::enable_if<std::is_base_of<poolstl::execution::poolstl_policy, std::__2::remove_cv<std::__2::remove_reference<poolstl::execution::parallel_policy const&>::type>::type>::value, int>::type std::reduce<poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, int>(poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>, int) @ poolstl.hpp:2594
$std::__2::enable_if<std::is_base_of<poolstl::execution::poolstl_policy, std::__2::remove_cv<std::__2::remove_reference<poolstl::execution::parallel_policy const&>::type>::type>::value, std::__2::iterator_traits<std::__2::__wrap_iter<int*>>::value_type>::type std::reduce<poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>>(poolstl::execution::parallel_policy const&, std::__2::__wrap_iter<int*>, std::__2::__wrap_iter<int*>) @ poolstl.hpp:2605
$ToolKit::Game::Frame(float) @ Game.cpp:36
Some codes are run on both small and large inputs. The small inputs may be best handled sequentially. Add a policy that allows selecting between sequential and parallel.
This mechanism should work both with poolstl::par
/poolstl::seq
and std::execution::par
/std::execution::seq
.
Add a single-line way to define std::execution::par
if the compiler does not support it.
This way user code can be written such that the native compiler-provided methods are used if available else poolSTL fallback.
Similar to fast_float's releases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.