Skip to content

Commit

Permalink
Add -S option
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Feb 14, 2024
1 parent 1f78934 commit 120f011
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 67 deletions.
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,33 @@ Generate the primes and/or prime k-tuplets inside [START, STOP]
(< 2^64) using the segmented sieve of Eratosthenes.
Options:
-c, --count[=NUM+] Count primes and/or prime k-tuplets, NUM <= 6.
Count primes: -c or --count (default option),
count twin primes: -c2 or --count=2,
count prime triplets: -c3 or --count=3, ...
--cpu-info Print CPU information (cache sizes).
-d, --dist=DIST Sieve the interval [START, START + DIST].
-n, --nth-prime Find the nth prime.
primesieve 100 -n: finds the 100th prime,
primesieve 2 100 -n: finds the 2nd prime > 100.
-p, --print[=NUM] Print primes or prime k-tuplets, NUM <= 6.
Print primes: -p or --print,
print twin primes: -p2 or --print=2,
print prime triplets: -p3 or --print=3, ...
-q, --quiet Quiet mode, prints less output.
-s, --size=SIZE Set the sieve size in KiB, SIZE <= 8192.
By default primesieve uses a sieve size that
matches your CPU's L1 cache size (per core) or is
slightly smaller than your CPU's L2 cache size.
--stress-test[=MODE] Run a stress test. The MODE can be either
CPU (default) or RAM. The default timeout is 24h.
--test Run various correctness tests (< 1 minute).
-t, --threads=NUM Set the number of threads, NUM <= CPU cores.
Default setting: use all available CPU cores.
--time Print the time elapsed in seconds.
--timeout=SEC Set the stress test timeout in seconds. Supported
units of time suffixes: s, m, h, d or y.
30 minutes timeout: --timeout 30m
-c, --count[=NUM+] Count primes and/or prime k-tuplets, NUM <= 6.
Count primes: -c or --count (default option),
count twin primes: -c2 or --count=2,
count prime triplets: -c3 or --count=3, ...
--cpu-info Print CPU information (cache sizes).
-d, --dist=DIST Sieve the interval [START, START + DIST].
-n, --nth-prime Find the nth prime.
primesieve 100 -n: finds the 100th prime,
primesieve 2 100 -n: finds the 2nd prime > 100.
-p, --print[=NUM] Print primes or prime k-tuplets, NUM <= 6.
Print primes: -p or --print,
print twin primes: -p2 or --print=2,
print prime triplets: -p3 or --print=3, ...
-q, --quiet Quiet mode, prints less output.
-s, --size=SIZE Set the sieve size in KiB, SIZE <= 8192.
By default primesieve uses a sieve size that
matches your CPU's L1 cache size (per core) or is
slightly smaller than your CPU's L2 cache size.
-S, --stress-test[=MODE] Run a stress test. The MODE can be either
CPU (default) or RAM. The default timeout is 24h.
--test Run various correctness tests (< 1 minute).
-t, --threads=NUM Set the number of threads, NUM <= CPU cores.
Default setting: use all available CPU cores.
--time Print the time elapsed in seconds.
--timeout=SEC Set the stress test timeout in seconds. Supported
units of time suffixes: s, m, h, d or y.
30 minutes timeout: --timeout 30m
```

## Build instructions
Expand Down
8 changes: 4 additions & 4 deletions doc/primesieve.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: primesieve
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 02/13/2024
.\" Date: 02/14/2024
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "PRIMESIEVE" "1" "02/13/2024" "\ \&" "\ \&"
.TH "PRIMESIEVE" "1" "02/14/2024" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -125,7 +125,7 @@ Set the size of the sieve array in KiB, 16 <=
<= 8192\&. By default primesieve uses a sieve size that matches your CPU\(cqs L1 cache size (per core) or is slightly smaller than your CPU\(cqs L2 cache size\&. This setting is crucial for performance, on exotic CPUs primesieve sometimes fails to determine the CPU\(cqs cache sizes which usually causes a big slowdown\&. In this case you can get a significant speedup by manually setting the sieve size to your CPU\(cqs L1 or L2 cache size (per core)\&.
.RE
.PP
\fB\-\-stress\-test\fR[=\fIMODE\fR]
\fB\-S, \-\-stress\-test\fR[=\fIMODE\fR]
.RS 4
Run a stress test\&. The
\fIMODE\fR
Expand All @@ -145,7 +145,7 @@ option\&.
.PP
\fB\-\-test\fR
.RS 4
Run various sieving tests\&.
Run various correctness tests (< 1 minute)\&.
.RE
.PP
\fB\-t, \-\-threads\fR=\fINUM\fR
Expand Down
4 changes: 2 additions & 2 deletions doc/primesieve.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ OPTIONS
this case you can get a significant speedup by manually setting the sieve
size to your CPU's L1 or L2 cache size (per core).

*--stress-test*[='MODE']::
*-S, --stress-test*[='MODE']::
Run a stress test. The 'MODE' can be either CPU (default) or RAM. The CPU
'MODE' uses little memory (on average about 225 MiB per thread) and puts the
highest load on the CPU. The RAM 'MODE' uses much more memory than the
Expand All @@ -90,7 +90,7 @@ OPTIONS
using the *--threads=NUM* option.

*--test*::
Run various sieving tests.
Run various correctness tests (< 1 minute).

*-t, --threads*='NUM'::
Set the number of threads, 1 \<= 'NUM' \<= CPU cores. By default primesieve
Expand Down
1 change: 1 addition & 0 deletions src/app/CmdOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ CmdOptions parseOptions(int argc, char* argv[])
{ "--R-inverse", std::make_pair(OPTION_R_INVERSE, NO_PARAM) },
{ "-s", std::make_pair(OPTION_SIZE, REQUIRED_PARAM) },
{ "--size", std::make_pair(OPTION_SIZE, REQUIRED_PARAM) },
{ "-S", std::make_pair(OPTION_STRESS_TEST, OPTIONAL_PARAM) },
{ "--stress-test", std::make_pair(OPTION_STRESS_TEST, OPTIONAL_PARAM) },
{ "--test", std::make_pair(OPTION_TEST, NO_PARAM) },
{ "-t", std::make_pair(OPTION_THREADS, REQUIRED_PARAM) },
Expand Down
68 changes: 34 additions & 34 deletions src/app/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,40 @@ void help(int exitCode)
"(< 2^64) using the segmented sieve of Eratosthenes.\n"
"\n"
"Options:\n"
" -c, --count[=NUM+] Count primes and/or prime k-tuplets, NUM <= 6.\n"
" Count primes: -c or --count (default option),\n"
" count twin primes: -c2 or --count=2,\n"
" count prime triplets: -c3 or --count=3, ...\n"
" --cpu-info Print CPU information (cache sizes).\n"
" -d, --dist=DIST Sieve the interval [START, START + DIST].\n"
" -h, --help Print this help menu.\n"
" -n, --nth-prime Find the nth prime.\n"
" primesieve 100 -n: finds the 100th prime,\n"
" primesieve 2 100 -n: finds the 2nd prime > 100.\n"
" --no-status Turn off the progressing status.\n"
" -p, --print[=NUM] Print primes or prime k-tuplets, NUM <= 6.\n"
" Print primes: -p or --print,\n"
" print twin primes: -p2 or --print=2,\n"
" print prime triplets: -p3 or --print=3, ...\n"
" -q, --quiet Quiet mode, prints less output.\n"
" -R, --RiemannR Riemann R function, very accurate\n"
" approximation of PrimePi(x).\n"
" --R-inverse Inverse Riemann R function, very accurate\n"
" approximation of the nth prime.\n"
" -s, --size=SIZE Set the sieve size in KiB, SIZE <= 8192.\n"
" By default primesieve uses a sieve size that\n"
" matches your CPU's L1 cache size (per core) or is\n"
" slightly smaller than your CPU's L2 cache size.\n"
" --stress-test[=MODE] Run a stress test. The MODE can be either\n"
" CPU (default) or RAM. The default timeout is 24h.\n"
" --test Run various correctness tests (< 1 minute).\n"
" -t, --threads=NUM Set the number of threads, NUM <= CPU cores.\n"
" Default setting: use all available CPU cores.\n"
" --time Print the time elapsed in seconds.\n"
" --timeout=SEC Set the stress test timeout in seconds. Supported\n"
" units of time suffixes: s, m, h, d or y.\n"
" 30 minutes timeout: --timeout 30m\n"
" -v, --version Print version and license information.";
" -c, --count[=NUM+] Count primes and/or prime k-tuplets, NUM <= 6.\n"
" Count primes: -c or --count (default option),\n"
" count twin primes: -c2 or --count=2,\n"
" count prime triplets: -c3 or --count=3, ...\n"
" --cpu-info Print CPU information (cache sizes).\n"
" -d, --dist=DIST Sieve the interval [START, START + DIST].\n"
" -h, --help Print this help menu.\n"
" -n, --nth-prime Find the nth prime.\n"
" primesieve 100 -n: finds the 100th prime,\n"
" primesieve 2 100 -n: finds the 2nd prime > 100.\n"
" --no-status Turn off the progressing status.\n"
" -p, --print[=NUM] Print primes or prime k-tuplets, NUM <= 6.\n"
" Print primes: -p or --print,\n"
" print twin primes: -p2 or --print=2,\n"
" print prime triplets: -p3 or --print=3, ...\n"
" -q, --quiet Quiet mode, prints less output.\n"
" -R, --RiemannR Riemann R function, very accurate\n"
" approximation of PrimePi(x).\n"
" --R-inverse Inverse Riemann R function, very accurate\n"
" approximation of the nth prime.\n"
" -s, --size=SIZE Set the sieve size in KiB, SIZE <= 8192.\n"
" By default primesieve uses a sieve size that\n"
" matches your CPU's L1 cache size (per core) or is\n"
" slightly smaller than your CPU's L2 cache size.\n"
" -S, --stress-test[=MODE] Run a stress test. The MODE can be either\n"
" CPU (default) or RAM. The default timeout is 24h.\n"
" --test Run various correctness tests (< 1 minute).\n"
" -t, --threads=NUM Set the number of threads, NUM <= CPU cores.\n"
" Default setting: use all available CPU cores.\n"
" --time Print the time elapsed in seconds.\n"
" --timeout=SEC Set the stress test timeout in seconds. Supported\n"
" units of time suffixes: s, m, h, d or y.\n"
" 30 minutes timeout: --timeout 30m\n"
" -v, --version Print version and license information.";

std::cout << helpMenu << std::endl;
std::exit(exitCode);
Expand Down

0 comments on commit 120f011

Please sign in to comment.