kahypar / mt-kahypar

Mt-KaHyPar (Multi-Threaded Karlsruhe Hypergraph Partitioner) is a shared-memory multilevel graph and hypergraph partitioner equipped with parallel implementations of techniques used in the best sequential partitioning algorithms. Mt-KaHyPar can partition extremely large hypergraphs very fast and with high quality.
MIT License
122 stars 25 forks source link

Fix race condition when thread pinning is disabled #158

Closed kittobi1992 closed 1 year ago

kittobi1992 commented 1 year ago

In many algorithms, we use the cpu ID as unique index of a thread to access data structures. However, if thread pinning is disabled (e.g., in our library interfaces), the cpu ID is not unique. This can cause undefined behaviour if a thread is preempted by the OS while performing a criticial operation (e.g. inserting something into a vector). The fix now uses the tbb::this_task_arena::current_thread_index() method as unique ID in case thread pinning is disabled.