Use GMP and GNU parallel in GIthub Actions (#63)

* Use GMP and GNU parallel in GIthub Actions

* try gmp:i386

* Don't do GMP tests on i386
This commit is contained in:
Mamy Ratsimbazafy 2020-06-20 19:46:30 +02:00 committed by GitHub
parent e491f3b91d
commit 0400187f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 11 deletions

View File

@ -60,11 +60,11 @@ jobs:
with:
path: constantine
# - name: Install dependencies (Linux amd64)
# if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
# run: |
# sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
# --no-install-recommends -yq <packages here>
- name: Install dependencies (Linux amd64)
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq libgmp-dev
- name: Install dependencies (Linux i386)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
@ -73,7 +73,7 @@ jobs:
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-multilib g++-multilib \
libssl-dev:i386
libssl-dev:i386 libgmp-dev:i386
mkdir -p external/bin
cat << EOF > external/bin/gcc
#!/bin/bash
@ -85,9 +85,10 @@ jobs:
EOF
chmod 755 external/bin/gcc external/bin/g++
echo '::add-path::${{ github.workspace }}/external/bin'
# - name: Install dependencies (macOS)
# if: runner.os == 'macOS'
# run: brew install <packages here>
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install gmp
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
@ -105,6 +106,10 @@ jobs:
7z x external/windeps.zip -oexternal/dlls
echo '::add-path::${{ github.workspace }}'"/external/mingw$arch/bin"
echo '::add-path::${{ github.workspace }}'"/external/dlls"
choco install msys2
pacman -S mingw-w64-x86_64-gmp
- name: Setup environment
shell: bash
run: echo '::add-path::${{ github.workspace }}/nim/bin'
@ -192,8 +197,17 @@ jobs:
run: |
nimble refresh
nimble install -y gmp stew
- name: Run constantine tests (without GMP)
- name: Run Constantine tests (with GMP)
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.cpu == 'amd64'
shell: bash
run: |
export UCPU="$cpu"
cd constantine
nimble test_no_gmp
nimble test_parallel
- name: Run Constantine tests (without GMP)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
shell: bash
run: |
export UCPU="$cpu"
cd constantine
nimble test_parallel_no_gmp

View File

@ -206,6 +206,47 @@ task test_parallel, "Run all tests in parallel (via GNU parallel)":
runBench("bench_ec_g1")
runBench("bench_ec_g2")
task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience
let cmdFile = true # open(buildParallel, mode = fmWrite) # Nimscript doesn't support IO :/
exec "> " & buildParallel
for td in testDesc:
if not td.useGMP:
if td.path in useDebug:
test "-d:debugConstantine", td.path, cmdFile
else:
test "", td.path, cmdFile
# cmdFile.close()
# Execute everything in parallel with GNU parallel
exec "parallel --keep-order --group < " & buildParallel
exec "> " & buildParallel
if sizeof(int) == 8: # 32-bit tests on 64-bit arch
for td in testDesc:
if not td.useGMP:
if td.path in useDebug:
test "-d:Constantine32 -d:debugConstantine", td.path, cmdFile
else:
test "-d:Constantine32", td.path, cmdFile
# cmdFile.close()
# Execute everything in parallel with GNU parallel
exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks
#
# Benchmarks compile and run
# ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp")
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
task bench_fp, "Run benchmark 𝔽p with your default compiler":
runBench("bench_fp")