Software Open Access
<?xml version='1.0' encoding='utf-8'?> <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd"> <identifier identifierType="DOI">10.5281/zenodo.6959270</identifier> <creators> <creator> <creatorName>Shoshany, Barak</creatorName> <givenName>Barak</givenName> <familyName>Shoshany</familyName> <nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0003-2222-127X</nameIdentifier> </creator> </creators> <titles> <title>A C++17 Thread Pool for High-Performance Scientific Computing</title> </titles> <publisher>Zenodo</publisher> <publicationYear>2021</publicationYear> <dates> <date dateType="Issued">2021-05-03</date> </dates> <resourceType resourceTypeGeneral="Software"/> <alternateIdentifiers> <alternateIdentifier alternateIdentifierType="url">https://zenodo.org/record/6959270</alternateIdentifier> </alternateIdentifiers> <relatedIdentifiers> <relatedIdentifier relatedIdentifierType="URL" relationType="IsSupplementTo">https://github.com/bshoshany/thread-pool/tree/v3.3.0</relatedIdentifier> <relatedIdentifier relatedIdentifierType="DOI" relationType="IsVersionOf">10.5281/zenodo.4742687</relatedIdentifier> </relatedIdentifiers> <version>v3.3.0</version> <rightsList> <rights rightsURI="https://opensource.org/licenses/MIT">MIT License</rights> <rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights> </rightsList> <descriptions> <description descriptionType="Abstract">v3.3.0 (2022-08-03) <ul> <li><code>BS_thread_pool.hpp</code>:<ul> <li>The public member variable <code>paused</code> of <code>BS::thread_pool</code> has been made private for future-proofing (in case future versions implement a more involved pausing mechanism) and better encapsulation. It is now accessible only via the <code>pause()</code>, <code>unpause()</code>, and <code>is_paused()</code> member functions. In other words:<ul> <li>Replace <code>pool.paused = true</code> with <code>pool.pause()</code>.</li> <li>Replace <code>pool.paused = false</code> with <code>pool.unpause()</code>.</li> <li>Replace <code>if (pool.paused)</code> (or similar) with <code>if (pool.is_paused())</code>.</li> </ul> </li> <li>The public member variable <code>f</code> of <code>BS::multi_future</code> has been renamed to <code>futures</code> for clarity, and has been made private for encapsulation and simplification purposes. Instead of operating on the vector <code>futures</code> itself, you can now use the <code>[]</code> operator of the <code>BS::multi_future</code> to access the future at a specific index directly, or the <code>push_back()</code> member function to append a new future to the list. The <code>size()</code> member function tells you how many futures are currently stored in the object.</li> <li>The explicit casts of <code>std::endl</code> and <code>std::flush</code>, added in v3.2.0 to enable flushing a <code>BS::synced_stream</code>, caused ODR (One Definition Rule) violations if <code>BS_thread_pool.hpp</code> was included in two different translation units, since they were mistakenly not defined as <code>inline</code>. To fix this, I decided to make them static members of <code>BS::synced_stream</code> instead of global variables, which also makes the code better organized in my opinion. These objects can now be accessed as <code>BS::synced_stream::endl</code> and <code>BS::synced_stream::flush</code>. I also added an example for how to use them in <code>README.md</code>. See <a href="https://github.com/bshoshany/thread-pool/issues/64">#64</a>.</li> </ul> </li> <li><code>BS_thread_pool_light.hpp</code>:<ul> <li>This package started out as a very lightweight thread pool, but over time has expanded to include many additional features, and at the time of writing it has a total of 340 lines of code, including all the helper classes. Therefore, I have decided to bundle a light version of the thread pool in a separate and stand-alone header file, <code>BS_thread_pool_light.hpp</code>, with only 170 lines of code (half the size of the full package). This file does not contain any of the helper classes, only a new <code>BS::thread_pool_light</code> class, which is a minimal thread pool with only the 5 most basic member functions:<ul> <li><code>get_thread_count()</code></li> <li><code>push_loop()</code></li> <li><code>push_task()</code></li> <li><code>submit()</code></li> <li><code>wait_for_tasks()</code></li> </ul> </li> <li>A separate test program <code>BS_thread_pool_light_test.cpp</code> tests only the features of the lightweight <code>BS::thread_pool_light</code> class. In the spirit of minimalism, it does not generate a log file and does not do any benchmarks.</li> <li>To be perfectly clear, each header file is 100% stand-alone. If you wish to use the full package, you only need <code>BS_thread_pool.hpp</code>, and if you wish to use the light version, you only need <code>BS_thread_pool_light.hpp</code>. Only a single header file needs to be included in your project.</li> </ul> </li> </ul></description> <description descriptionType="Other">If you use this package in published research, please cite it as follows.</description> </descriptions> </resource>
All versions | This version | |
---|---|---|
Views | 737 | 161 |
Downloads | 23 | 2 |
Data volume | 621.5 kB | 120.4 kB |
Unique views | 679 | 153 |
Unique downloads | 13 | 2 |