Simplify AVX512 code #824
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches-ignore: | |
- backup3 | |
- gh-pages | |
pull_request: | |
branches-ignore: | |
- backup3 | |
- gh-pages | |
jobs: | |
# See documentation: https://www.msys2.org/docs/ci/ | |
windows_mingw64: | |
strategy: | |
matrix: | |
platform: ['windows-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake | |
- name: Build primecount | |
run: | | |
cmake . -G "Unix Makefiles" -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test option | |
run: ./primecount --test | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
windows_msvc2022: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
run: | | |
cmake . -G "Visual Studio 17 2022" -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="/W3 /WX /MP /EHsc" | |
cmake --build . --config Release --target install | |
- name: CTest (unit tests) | |
run: ctest -j2 -C Release --output-on-failure | |
- name: primecount --test | |
run: Release\primecount.exe --test | |
- name: primecount 1e11 --legendre | |
run: Release\primecount.exe 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: Release\primecount.exe 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: Release\primecount.exe 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: Release\primecount.exe 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: Release\primecount.exe 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: Release\primecount.exe 1e14 --gourdon | |
windows_msvc2022_POPCNT: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
# Enable POPCNT using /arch:AVX | |
run: | | |
cmake . -G "Visual Studio 17 2022" -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="/arch:AVX /W3 /WX /MP /EHsc" | |
cmake --build . --config Release --target install | |
- name: CTest (unit tests) | |
run: ctest -j2 -C Release --output-on-failure | |
- name: primecount --test | |
run: Release\primecount.exe --test | |
- name: primecount 1e11 --legendre | |
run: Release\primecount.exe 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: Release\primecount.exe 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: Release\primecount.exe 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: Release\primecount.exe 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: Release\primecount.exe 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: Release\primecount.exe 1e14 --gourdon | |
linux_gcc: | |
strategy: | |
matrix: | |
platform: ['ubuntu-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
CC: gcc | |
CXX: g++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
linux_gcc_mpopcnt: | |
strategy: | |
matrix: | |
platform: ['ubuntu-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
CC: gcc | |
CXX: g++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-mpopcnt -Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
linux_gcc_sanitizers: | |
# This test fails on Ubuntu 22.04 likely due to an Ubuntu or compiler bug. | |
# See discussion at: https://github.com/quantumlib/Stim/issues/717#issuecomment-2002623560 | |
runs-on: ubuntu-20.04 | |
env: | |
CC: gcc | |
CXX: g++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -O1 -g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 --output-on-failure | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
- name: primecount 1e14 --status | |
run: ./primecount 1e14 --status | |
linux_gcc_valgrind: | |
runs-on: ubuntu-latest | |
env: | |
CC: gcc | |
CXX: g++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install valgrind | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -g" | |
cmake --build . --parallel --verbose | |
- name: primecount 1e11 --legendre | |
run: valgrind ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: valgrind ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: valgrind ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: valgrind ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: valgrind ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: valgrind ./primecount 1e14 --gourdon | |
- name: primecount 1e14 --status | |
run: valgrind ./primecount 1e14 --status | |
linux_clang: | |
strategy: | |
matrix: | |
platform: ['ubuntu-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
CC: clang | |
CXX: clang++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libomp-dev asciidoc libxml2-utils xmlto | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON -DBUILD_MANPAGE=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP.*:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
linux_clang_mpopcnt: | |
strategy: | |
matrix: | |
platform: ['ubuntu-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
CC: clang | |
CXX: clang++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libomp-dev asciidoc libxml2-utils xmlto | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON -DBUILD_MANPAGE=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-mpopcnt -Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP.*:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
macos_clang: | |
strategy: | |
matrix: | |
platform: ['macos-latest'] | |
config: ['Debug', 'Release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
CC: clang | |
CXX: clang++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: brew install libomp | |
- name: Build primecount | |
run: | | |
LDFLAGS="-L$(brew --prefix libomp)/lib" cmake . -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_CXX_FLAGS="-I$(brew --prefix libomp)/include -Wall -Wextra -pedantic -Werror" | |
grep "^OpenMP.*:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: primecount --test | |
run: ./primecount --test | |
- name: primecount 1e11 --legendre | |
run: ./primecount 1e11 --legendre | |
- name: primecount 1e12 --meissel | |
run: ./primecount 1e12 --meissel | |
- name: primecount 1e11 --lehmer | |
run: ./primecount 1e11 --lehmer | |
- name: primecount 1e12 --lmo | |
run: ./primecount 1e12 --lmo | |
- name: primecount 1e13 --deleglise-rivat | |
run: ./primecount 1e13 --deleglise-rivat | |
- name: primecount 1e14 --gourdon | |
run: ./primecount 1e14 --gourdon | |
linux_128bit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build primecount | |
run: | | |
cmake . -DBUILD_TESTS=ON | |
grep "^OpenMP:INTERNAL=1$" CMakeCache.txt | |
grep "^int128.*:INTERNAL=1$" CMakeCache.txt | |
cmake --build . --parallel --verbose | |
- name: CTest (unit tests) | |
run: ctest -j2 | |
- name: PrimePi(1e20) 128-bit test | |
run: | | |
./primecount 1e20 -s | tee primecount-1e20.log | |
grep 2220819602560918840 primecount-1e20.log |