diff --git a/.gitea/workflows/publish-wiki.yml b/.gitea/workflows/publish-wiki.yml new file mode 100644 index 0000000..87b6546 --- /dev/null +++ b/.gitea/workflows/publish-wiki.yml @@ -0,0 +1,38 @@ +# Publish the project's wiki pages to the git host's wiki. +# +# On a push to main that changes docs/wiki/, this workflow calls the reusable +# workflow of TirSystem/github-action, which copies the Markdown pages of +# docs/wiki/ to the wiki of this repository (framework/process/wiki.md says +# what the folder holds: English and the PO language as a minimum). +# +# INSTALLING THIS FILE IS THE OPT-IN. There is no marker file. A project that +# does not copy it publishes nothing. +# +# Copy it to .gitea/workflows/publish-wiki.yml. Then: +# 1. Create the secret TOKEN_FOR_GITEA_WIKI in the organization of the +# repository: a Gitea token with scope write:repository for a user that +# can write this repository (see guides/credentials.md of github-action). +# 2. Enable the wiki in the repository settings. +# 3. Keep @v2, or pin the exact release tag together with tools-ref. +# A runner must be registered for the repository (or its organization). +# +# prune: "true" deletes wiki pages that are not in docs/wiki/, so the wiki +# always equals the folder. Leave it "false" to keep hand-written pages. + +name: Publish wiki + +on: + push: + branches: [ main ] + paths: + - "docs/wiki/**" + workflow_dispatch: + +jobs: + wiki: + uses: TirSystem/github-action/.gitea/workflows/publish-wiki-pages.yml@v2 + with: + wiki_dir: docs/wiki + prune: "true" + secrets: + TOKEN_FOR_GITEA_WIKI: ${{ secrets.TOKEN_FOR_GITEA_WIKI }} diff --git a/README.md b/README.md index 2ccda12..5b1c4bd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,50 @@ # prime-numbers-c +Lists every prime number from 0 to 1,000,000 and reports how long the search +took. It shows how fast a CPU is, but the result depends on how the program is +written: algorithm, instruction set (here AVX2), compiler and flags. + +Example result on a 13th Gen Intel(R) Core(TM) i5-13600K: + +```text +Found 78498 primes from 0 to 1000000 in 20.977 ms +``` + +## Build and run + +Needs `gcc` (Linux, or MinGW-w64 / MSYS2 on Windows), `make` and a CPU with AVX2. + +```bash +make +``` + +```bash +make run +``` + +```bash +make clean +``` + +The executable is built into `dist/`. The primes go to standard output and the +timing line to standard error, so this saves the list and still shows the time: + +```bash +./dist/prime_avx2 > primes.txt +``` + +## Layout + +| Path | Content | +| --- | --- | +| `src/prime_avx2.c` | the program | +| `Makefile` | build rules | +| `docs/wiki/` | wiki pages, published to the Gitea wiki by `.gitea/workflows/publish-wiki.yml` | + +## Documentation + +See the wiki: Description, Results and Build and run. + +## License + +See [LICENSE](LICENSE).