From 31efea058c0bf090fdb6e7cbd345a502d3be6378 Mon Sep 17 00:00:00 2001 From: Barak Shoshany Date: Fri, 7 May 2021 22:03:49 -0400 Subject: [PATCH] Updated to v1.5 --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++-------- thread_pool.hpp | 7 ++++--- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a4d90d7..0f6692b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,20 @@ +[![DOI:10.5281/zenodo.4742687](https://zenodo.org/badge/DOI/10.5281/zenodo.4742687.svg)](https://doi.org/10.5281/zenodo.4742687) +[![arXiv:2105.00613](https://img.shields.io/badge/arXiv-2105.00613-b31b1b.svg)](https://arxiv.org/abs/2105.00613) +[![License: MIT](https://img.shields.io/github/license/bshoshany/thread-pool)](https://github.com/bshoshany/thread-pool/blob/master/LICENSE.txt) +![Language: C++17](https://img.shields.io/badge/Language-C%2B%2B17-yellow) +![File size in bytes](https://img.shields.io/github/size/bshoshany/thread-pool/thread_pool.hpp) +![GitHub last commit](https://img.shields.io/github/last-commit/bshoshany/thread-pool) +[![GitHub repo stars](https://img.shields.io/github/stars/bshoshany/thread-pool?style=social)](https://github.com/bshoshany/thread-pool) +[![Twitter @BarakShoshany](https://img.shields.io/twitter/follow/BarakShoshany?style=social)](https://twitter.com/BarakShoshany) + # A C++17 Thread Pool for High-Performance Scientific Computing **Barak Shoshany**\ Department of Physics, Brock University,\ 1812 Sir Isaac Brock Way, St. Catharines, Ontario, L2S 3A1, Canada\ -[baraksh@gmail.com](mailto:baraksh@gmail.com) | [https://baraksh.com/](https://baraksh.com/)\ -Companion paper: [arXiv:2105.00613](https://arxiv.org/abs/2105.00613) +[bshoshany@brocku.ca](mailto:bshoshany@brocku.ca) | [https://baraksh.com/](https://baraksh.com/)\ +Companion paper: [arXiv:2105.00613](https://arxiv.org/abs/2105.00613)\ +DOI: [doi:10.5281/zenodo.4742687](https://doi.org/10.5281/zenodo.4742687) @@ -33,7 +43,7 @@ Companion paper: [arXiv:2105.00613](https://arxiv.org/abs/2105.00613) - [Dual Intel Xeon Gold 6148 (80 threads)](#dual-intel-xeon-gold-6148-80-threads) - [Version history](#version-history) - [Feedback](#feedback) -- [Author and copyright](#author-and-copyright) +- [Copyright and citing](#copyright-and-citing) @@ -70,7 +80,7 @@ As demonstrated in the performance tests [below](#performance-tests), using our * Reusing threads avoids the overhead of creating and destroying them for individual tasks. * A task queue ensures that there are never more threads running in parallel than allowed by the hardware. * **Lightweight:** - * Only ~160 lines of code, excluding comments, blank lines, and the two optional helper classes. + * Only ~180 lines of code, excluding comments, blank lines, and the two optional helper classes. * Single header file: simply `#include "thread_pool.hpp"`. * Header-only: no need to install or build the library. * Self-contained: no external requirements or dependencies. Does not require OpenMP or any other multithreading APIs. Only uses the C++ standard library, and works with any C++17-compliant compiler. @@ -691,6 +701,9 @@ An interesting point to notice is that for **single-threaded** calculations (1 b ## Version history +* Version 1.5 (2021-05-07) + * This library now has a DOI for citation purposes. Information on how to cite it in publications has been added to the source code and to `README.md`. + * Added GitHub badges to `README.md`. * Version 1.4 (2021-05-05) * Added three new public member functions to monitor the tasks submitted to the pool: * `get_tasks_queued()` gets the number of tasks currently waiting in the queue to be executed by the threads. @@ -725,9 +738,29 @@ An interesting point to notice is that for **single-threaded** calculations (1 b If you would like a request any additional features, or if you encounter any bugs, please feel free to [open a new issue](https://github.com/bshoshany/thread-pool/issues)! - -## Author and copyright + +## Copyright and citing -Copyright (c) 2021 [Barak Shoshany](http://baraksh.com). Licensed under the [MIT license](LICENSE.txt). If you found this code useful, please consider providing a link to the [GitHub repository](https://github.com/bshoshany/thread-pool) and/or citing the [companion paper](https://arxiv.org/abs/2105.00613): +Copyright (c) 2021 [Barak Shoshany](http://baraksh.com). Licensed under the [MIT license](LICENSE.txt). -* Barak Shoshany, "A C++17 Thread Pool for High-Performance Scientific Computing", [arXiv:2105.00613](https://arxiv.org/abs/2105.00613) (May 2021) +If you use this library in published research, please cite it as follows: + +* Barak Shoshany, "A C++17 Thread Pool for High-Performance Scientific Computing", [doi:10.5281/zenodo.4742687](https://doi.org/10.5281/zenodo.4742687), [arXiv:2105.00613](https://arxiv.org/abs/2105.00613) (May 2021) + +You can use the following BibTeX entry: + +```none +@article{Shoshany2021_ThreadPool, + archiveprefix = {arXiv}, + author = {Barak Shoshany}, + doi = {10.5281/zenodo.4742687}, + eid = {arXiv:2105.00613}, + eprint = {2105.00613}, + journal = {arXiv e-prints}, + keywords = {Computer Science - Distributed, Parallel, and Cluster Computing, D.1.3, D.1.5}, + month = {May}, + primaryclass = {cs.DC}, + title = {{A C++17 Thread Pool for High-Performance Scientific Computing}}, + year = {2021} +} +``` diff --git a/thread_pool.hpp b/thread_pool.hpp index 3c7cd56..a2210d8 100644 --- a/thread_pool.hpp +++ b/thread_pool.hpp @@ -3,9 +3,10 @@ /** * @file thread_pool.hpp * @author Barak Shoshany (baraksh@gmail.com) (http://baraksh.com) - * @version 1.4 - * @date 2021-05-05 - * @copyright Copyright (c) 2021 Barak Shoshany. Licensed under the MIT license. If you found this code useful, please consider providing a link to the GitHub repository: https://github.com/bshoshany/thread-pool and/or citing the companion paper: https://arxiv.org/abs/2105.00613 + * @version 1.5 + * @date 2021-05-07 + * @copyright Copyright (c) 2021 Barak Shoshany. Licensed under the MIT license. If you use this library in published research, please cite it as follows: + * - Barak Shoshany, "A C++17 Thread Pool for High-Performance Scientific Computing", doi:10.5281/zenodo.4742687, arXiv:2105.00613 (May 2021) * * @brief A C++17 thread pool for high-performance scientific computing. * @details A modern C++17-compatible thread pool implementation, built from scratch with high-performance scientific computing in mind. The thread pool is implemented as a single lightweight and self-contained class, and does not have any dependencies other than the C++17 standard library, thus allowing a great degree of portability. In particular, this implementation does not utilize OpenMP or any other high-level multithreading APIs, and thus gives the programmer precise low-level control over the details of the parallelization, which permits more robust optimizations. The thread pool was extensively tested on both AMD and Intel CPUs with up to 40 cores and 80 threads. Other features include automatic generation of futures and easy parallelization of loops. Two helper classes enable synchronizing printing to an output stream by different threads and measuring execution time for benchmarking purposes. Please visit the GitHub repository for documentation and updates, or to submit feature requests and bug reports.