replace openmp with thread-pool library bc openmp has larger fork boundary overhead

This commit is contained in:
2026-02-22 23:54:14 +01:00
parent 73b01f6af3
commit 443069f597
7 changed files with 82 additions and 30 deletions

View File

@ -13,6 +13,10 @@
#include "octree.hpp"
#endif
#ifndef WEB
#include <BS_thread_pool.hpp>
#endif
class Mass {
public:
const float mass;
@ -71,6 +75,10 @@ private:
int last_springs_count;
#endif
#ifndef WEB
BS::thread_pool<BS::tp::none> threads;
#endif
public:
// This is the main ownership of all the states/masses/springs.
// TODO: Everything is stored multiple times but idc (currently).
@ -82,6 +90,11 @@ public:
#ifndef BARNES_HUT
last_build = REPULSION_GRID_REFRESH;
#endif
#ifndef WEB
std::cout << "Thread-Pool: " << threads.get_thread_count() << " threads."
<< std::endl;
#endif
};
MassSpringSystem(const MassSpringSystem &copy) = delete;