|
| 1 | +# cwager_x64ff_mt |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +`cwager_x64ff_mt` is a multithreaded x86-64 NASM implementation of the base Sieve of Eratosthenes. |
| 9 | + |
| 10 | +The main source file is `cwager_x64ff_mt.asm`. |
| 11 | + |
| 12 | +Each worker thread repeatedly: |
| 13 | + |
| 14 | +- allocates a fresh sieve buffer dynamically at runtime |
| 15 | +- initializes that buffer from scratch |
| 16 | +- runs a faithful base-algorithm sieve over odd candidates only |
| 17 | +- discards the sieve unless it is the final completed pass for that worker |
| 18 | + |
| 19 | +The implementation keeps the benchmark state in a dynamically allocated benchmark structure and gives each worker its own dynamically allocated worker state structure. |
| 20 | + |
| 21 | +Each worker state structure contains the runtime sieve metadata and the sieve buffer pointer: |
| 22 | + |
| 23 | +- sieve size |
| 24 | +- derived bit count |
| 25 | +- derived word count |
| 26 | +- pass count |
| 27 | +- sieve buffer pointer |
| 28 | + |
| 29 | +This is intended to be the assembly equivalent of the "class containing the full state of the sieve" required by the current drag-race faithfulness rules. The sieve size and corresponding buffer are established dynamically at runtime for each worker, and each timed pass recreates a fresh sieve buffer from scratch before running the base algorithm. |
| 30 | + |
| 31 | +## Run instructions |
| 32 | + |
| 33 | +### NASM/GCC |
| 34 | + |
| 35 | +From this directory: |
| 36 | + |
| 37 | +```bash |
| 38 | +./build.sh |
| 39 | +./run.sh |
| 40 | +``` |
| 41 | + |
| 42 | +This produces the executable `cwager_x64ff_mt` from `cwager_x64ff_mt.asm`. |
| 43 | + |
| 44 | +### Docker |
| 45 | + |
| 46 | +```bash |
| 47 | +docker build -t cwager-x64ff-mt . |
| 48 | +docker run --rm cwager-x64ff-mt |
| 49 | +``` |
| 50 | + |
| 51 | +## Output |
| 52 | + |
| 53 | +Example output from this machine: |
| 54 | + |
| 55 | +```text |
| 56 | +cwager_x64ff_mt;128068;5.001;16;algorithm=base,faithful=yes,bits=1 |
| 57 | +cwager_x64ff_mt;128397;5.000;16;algorithm=base,faithful=yes,bits=1 |
| 58 | +``` |
| 59 | + |
| 60 | +## Notes |
| 61 | + |
| 62 | +This implementation targets amd64/x86-64 Linux, links against pthreads, and reports using the label `cwager_x64ff_mt`. |
0 commit comments