diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 9ea8346..fc23fff 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -27,40 +27,19 @@ jobs: if: needs.check-changed-files.outputs.cpp == 'true' run: ./scripts/format_all.sh . --check --exclude "build|wrappers" - extract-cuda-backend-branch: - uses: ./.github/workflows/extract-backends.yml - with: - pr-number: ${{ github.event.pull_request.number }} - test-linux-curve: name: Test on Linux runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] + needs: [check-changed-files, check-format] strategy: matrix: curve: - name: bn254 - build_args: -DG2=ON -DECNTT=ON - - name: bls12_381 - build_args: -DG2=ON -DECNTT=ON - - name: bls12_377 - build_args: -DG2=ON -DECNTT=ON - - name: bw6_761 - build_args: -DG2=ON -DECNTT=ON - - name: grumpkin - build_args: + build_args: -DG2=ON steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - name: Build curve working-directory: ./icicle if: needs.check-changed-files.outputs.cpp == 'true' @@ -71,40 +50,4 @@ jobs: - name: Run C++ curve Tests working-directory: ./icicle/build/tests if: needs.check-changed-files.outputs.cpp == 'true' - run: ctest --output-on-failure - - test-linux-field: - name: Test on Linux - runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] - strategy: - matrix: - field: - - name: babybear - build_args: -DEXT_FIELD=ON - - name: stark252 - build_args: -DEXT_FIELD=OFF - - name: m31 - build_args: -DEXT_FIELD=ON - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - - name: Build field - working-directory: ./icicle - if: needs.check-changed-files.outputs.cpp == 'true' - run: | - mkdir -p build && rm -rf build/* - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DFIELD=${{ matrix.field.name }} ${{ matrix.field.build_args }} -DCUDA_BACKEND=local -S . -B build - cmake --build build -j - - name: Run C++ field Tests - working-directory: ./icicle/build/tests - if: needs.check-changed-files.outputs.cpp == 'true' - run: ctest --output-on-failure + run: ctest -R msm --output-on-failure \ No newline at end of file diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index 4e566d4..0000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Deploy to GitHub Pages - -on: - push: - branches: - - main - paths: - - 'docs/**' - -permissions: - contents: write - -jobs: - deploy: - name: Deploy to GitHub Pages - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - path: 'repo' - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: npm - cache-dependency-path: ./repo/docs/package-lock.json - - - name: Install dependencies - run: npm install - working-directory: ./repo/docs - - - name: Build website - run: npm run build - working-directory: ./repo/docs - - - name: Copy CNAME to build directory - run: echo "dev.ingonyama.com" > ./build/CNAME - working-directory: ./repo/docs - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./repo/docs/build - user_name: github-actions[bot] - user_email: 41898282+github-actions[bot]@users.noreply.github.com - working-directory: ./repo/docs diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index ad1db1c..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This workflow is a demo of how to run all examples in the Icicle repository. -# For each language directory (c++, Rust, etc.) the workflow -# (1) loops over all examples (msm, ntt, etc.) and -# (2) runs ./run.sh in each directory. -# Each script should return 0 for success and 1 otherwise. - -name: Examples - -on: - pull_request: - branches: - - main - push: - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - check-changed-files: - uses: ./.github/workflows/check-changed-files.yml - - extract-cuda-backend-branch: - uses: ./.github/workflows/extract-backends.yml - with: - pr-number: ${{ github.event.pull_request.number }} - - run-examples: - runs-on: [self-hosted, Linux, X64, icicle, examples] - needs: [check-changed-files, extract-cuda-backend-branch] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout CUDA Backend - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - - name: c++ examples - working-directory: ./examples/c++ - if: needs.check-changed-files.outputs.cpp == 'true' || needs.check-changed-files.outputs.examples == 'true' - run: | - # loop over all directories in the current directory - for dir in $(find . -mindepth 1 -maxdepth 1 -type d); do - if [ -d "$dir" ]; then - echo "Running command in $dir" - cd $dir - ./run.sh -d CUDA - cd - - fi - done - - name: Rust examples - working-directory: ./examples/rust - if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.examples == 'true' - run: | - # loop over all directories in the current directory - for dir in $(find . -mindepth 1 -maxdepth 1 -type d); do - if [ -d "$dir" ]; then - echo "Running command in $dir" - cd $dir - ./run.sh -d CUDA - cd - - fi - done \ No newline at end of file diff --git a/.github/workflows/extract-backends.yml b/.github/workflows/extract-backends.yml deleted file mode 100644 index 80aac40..0000000 --- a/.github/workflows/extract-backends.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Extract Icicle Backend Branch - -on: - workflow_call: - inputs: - pr-number: - description: 'The PR number to fetch the description for' - required: true - type: number - outputs: - cuda-backend-branch: - description: "Branch name for cuda backend" - value: ${{ jobs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - -jobs: - extract-cuda-backend-branch: - name: Extract cuda branch name - runs-on: ubuntu-22.04 - outputs: - cuda-backend-branch: ${{ steps.extract.outputs.cuda-backend-branch }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Extract Private Branch from PR Description - id: extract - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - DESCRIPTION=$(gh pr view ${{ inputs.pr-number }} --json body -q '.body') - echo "PR Description: $DESCRIPTION" - CUDA_BE_BRANCH=$(echo "$DESCRIPTION" | grep -oP 'cuda-backend-branch:\s*\K[^\s]+') || true - if [ -z "$CUDA_BE_BRANCH" ]; then - CUDA_BE_BRANCH="main" # Default branch if not specified - fi - echo "Extracted CUDA Backend Branch: $CUDA_BE_BRANCH" - echo "cuda-backend-branch=$CUDA_BE_BRANCH" >> "$GITHUB_OUTPUT" \ No newline at end of file diff --git a/.github/workflows/golang.yml b/.github/workflows/golang.yml index ba70e01..b09e97e 100644 --- a/.github/workflows/golang.yml +++ b/.github/workflows/golang.yml @@ -31,42 +31,21 @@ jobs: if: needs.check-changed-files.outputs.golang == 'true' run: if [[ $(go list ./... | xargs go fmt) ]]; then echo "Please run go fmt"; exit 1; fi - extract-cuda-backend-branch: - uses: ./.github/workflows/extract-backends.yml - with: - pr-number: ${{ github.event.pull_request.number }} - # TODO - add runtime tests to the workflow # TODO - add core tests to the workflow build-curves-linux: name: Build and test curves on Linux runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] + needs: [check-changed-files, check-format] strategy: matrix: curve: - name: bn254 build_args: - - name: bls12_381 - build_args: - - name: bls12_377 - build_args: - - name: bw6_761 - build_args: - - name: grumpkin - build_args: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - name: Setup go uses: actions/setup-go@v5 with: @@ -83,80 +62,4 @@ jobs: run: | CURVE=$(echo ${{ matrix.curve.name }} | sed -e 's/_//g') export ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib - go test ./$CURVE/tests -count=1 -failfast -p 2 -timeout 60m -v - - build-fields-linux: - name: Build and test fields on Linux - runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] - strategy: - matrix: - field: - - name: babybear - build_args: - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - - name: Setup go - uses: actions/setup-go@v5 - with: - go-version: '1.22.0' - - name: Build - working-directory: ./wrappers/golang - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - # builds a single field with the fields specified build args - run: | - ./build.sh -field=${{ matrix.field.name }} ${{ matrix.field.build_args }} -cuda_backend=local - - name: Test - working-directory: ./wrappers/golang/fields - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - run: | - FIELD=$(echo ${{ matrix.field.name }} | sed -e 's/_//g') - export ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib - go test ./$FIELD/tests -count=1 -failfast -p 2 -timeout 60m -v - - build-hash-linux: - name: Build and test hash on Linux - runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - - name: Setup go - uses: actions/setup-go@v5 - with: - go-version: '1.22.0' - - name: Build - working-directory: ./wrappers/golang - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - # builds the hash and merkle tree lib using a local copy of the CUDA backend - run: | - ./build.sh -cuda_backend=local - - name: Test Hashes - working-directory: ./wrappers/golang/hash - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - run: | - export ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib - go test ./tests -count=1 -failfast -p 2 -timeout 60m -v - - name: Test Merkle Tree - working-directory: ./wrappers/golang/merkle-tree - if: needs.check-changed-files.outputs.golang == 'true' || needs.check-changed-files.outputs.cpp == 'true' - run: | - export ICICLE_BACKEND_INSTALL_DIR=/usr/local/lib - go test ./tests -count=1 -failfast -p 2 -timeout 60m -v + go test ./$CURVE/tests -count=1 -failfast -p 2 -timeout 60m -v \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9f5831..37d7096 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,14 +22,6 @@ jobs: uses: actions/checkout@v4 with: ssh-key: ${{ secrets.DEPLOY_KEY }} - - name: Checkout CUDA Backend - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - token: ${{ secrets.GITHUB_TOKEN }} - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: main - name: Setup Cache id: cache uses: actions/cache@v4 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 10ba7c9..a8af5fc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,32 +33,15 @@ jobs: # causing rustfmt to fail. run: if [[ $(find . -path ./icicle-curves/icicle-curve-template -prune -o -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --) ]]; then echo "Please run cargo fmt"; exit 1; fi - extract-cuda-backend-branch: - uses: ./.github/workflows/extract-backends.yml - with: - pr-number: ${{ github.event.pull_request.number }} - test-linux: name: Test on Linux runs-on: [self-hosted, Linux, X64, icicle] - needs: [check-changed-files, check-format, extract-cuda-backend-branch] + needs: [check-changed-files, check-format] steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Checkout CUDA Backend - if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp == 'true' - uses: actions/checkout@v4 - with: - repository: ingonyama-zk/icicle-cuda-backend - path: ./icicle/backend/cuda - ssh-key: ${{ secrets.CUDA_PULL_KEY }} - ref: ${{ needs.extract-cuda-backend-branch.outputs.cuda-backend-branch }} - name: Run tests working-directory: ./wrappers/rust if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp == 'true' - # tests are split to phases since NTT domain is global but tests have conflicting requirements run: | - cargo build --workspace --release --features=cuda_backend - cargo test --workspace --release --verbose --features=cuda_backend -- --skip phase - cargo test phase2 --workspace --release --features=cuda_backend - cargo test phase3 --workspace --release --features=cuda_backend + cargo test -p icicle-bn254 msm --release --verbose --features=cuda_backend diff --git a/.github/workflows/test-deploy-docs.yml b/.github/workflows/test-deploy-docs.yml deleted file mode 100644 index cc9079a..0000000 --- a/.github/workflows/test-deploy-docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Test Deploy to GitHub Pages - -on: - pull_request: - branches: - - main - paths: - - 'docs/**' - -jobs: - test-deploy: - name: Test deployment of docs website - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - path: 'repo' - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: npm - cache-dependency-path: ./repo/docs/package-lock.json - - - name: Install dependencies - run: npm install - working-directory: ./repo/docs - - name: Test build website - run: npm run build - working-directory: ./repo/docs diff --git a/icicle/backend/cuda/CMakeLists.txt b/icicle/backend/cuda/CMakeLists.txt index a41a66e..64bd53b 100644 --- a/icicle/backend/cuda/CMakeLists.txt +++ b/icicle/backend/cuda/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.18) include(cmake/Common.cmake) find_cuda_compiler() +option(G2 "Build G2 MSM" ON) + project(icicle_cuda_backend LANGUAGES CUDA CXX) set_env()