Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eliahkagan/parallelmemorybenchmark
C++ sorting with execution policies (benchmark)
https://github.com/eliahkagan/parallelmemorybenchmark
Last synced: about 24 hours ago
JSON representation
C++ sorting with execution policies (benchmark)
- Host: GitHub
- URL: https://github.com/eliahkagan/parallelmemorybenchmark
- Owner: EliahKagan
- License: 0bsd
- Created: 2023-01-07T12:31:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T06:59:04.000Z (6 months ago)
- Last Synced: 2024-05-01T07:52:29.042Z (6 months ago)
- Language: C++
- Size: 88.9 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ParallelMemoryBenchmark
This is a simple memory benchmarking tool that makes an array of pseudorandom
numbers and sorts them using an execution policy. The length and policy are
specified by the user.ParallelMemoryBenchmark is an outgrowth of a program meant to reproduce a
vexing system stability problem. It is not really well-suited to use as a
general-purpose benchmark.However, it remains interesting as a demonstration of [C++ parallel execution
policies](https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t)
and as a limited benchmark of them in sorting.## License
This software is licensed under [0BSD](https://spdx.org/licenses/0BSD.html).
See [**`LICENSE`**](LICENSE).## Building
64-bit builds are recommended.
Release builds (that is, building with optimizations turned on and debug
symbols not emitted) are highly recommended. This is because the timings are of
only slight interest otherwise, and completely irrelevant for comparison
purposes.Library dependencies are resolved with
[`vcpkg`](https://vcpkg.io/en/getting-started.html), which is set up as a
submodule.**See [`building.md`](building.md) for build instructions.**
## Usage
The most basic usage is to run `pmb` specifying only the length of the
array—that is, the number of integers to sort. For example, to sort a billion
integers:```sh
./pmb 1000000000
```Output looks like this:
```text
length: 1000000000 elements (~3814 MiB)
seed: 1824255722 (generated by the system)
sort mode: std::execution::par (parallelize)Allocating/zeroing... Done. (1296 ms)
Generating... Done. (3491 ms)
Hashing... 7c99ae86. (220 ms)
Sorting... Done. (15077 ms)
Rehashing... 7c99ae86, same. (253 ms)
Checking... sorted. (608 ms)Test completed in about 21.3 seconds (21320 ms).
```Passing `--help` prints a message that includes a description of all options.
The other currently available options are:```text
-l [ --length ] arg specify how many elements to generate and sort
-s [ --seed ] arg custom seed for PRNG (omit to use system entropy)
-2 [ --twice ] after sorting, sort again (may test adaptivity)
-t [ --time ] display human-readable start time
-S [ --seq ] don't try to parallelize
-P [ --par ] try to parallelize (default)
-U [ --par-unseq ] try to parallelize, may migrate thread and vectorize
```Of special importance are the options `--seq`, `--par`, and `--par-unseq`, which
specify the policy execution. By default, as shown above, it is as if `--par`
were passed. These options correspond to
[`execution_policy_tag_t`](https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t)
policies.## Authors
ParallelMemoryBenchmark is written by
[Eliah Kagan](https://github.com/EliahKagan) and
[David Vassallo](https://github.com/dmvassallo).## Acknowledgements
The `-2`/`--twice` feature is due to a suggestion by **Godfrey Vassallo**, who
pointed out that it would be interesting to compare the performance of the
original sorting operation with a second sorting operation, carried out
immediately thereafter on the just-sorted elements.