Bench #1
This file contains hidden or 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: Bench | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| config_path: | |
| description: "Path to Configuration File" | |
| required: true | |
| default: "secpar_0_height_2.params.toml" | |
| data_id: | |
| description: "Data ID (e.g. 53)" | |
| required: true | |
| default: "0" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| id-token: write | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| launch-ec2: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::490752553772:role/machina-io-assume_role-slc | |
| role-duration-seconds: 900 | |
| aws-region: us-west-2 | |
| - name: Launch EC2 Instance | |
| id: launch-ec2 | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_PAT: ${{ secrets.GH_PAT }} | |
| IMAGE_ID: ami-075686beab831bb7f | |
| INSTANCE_TYPE: i4i.16xlarge | |
| SG: sg-02014faf3d99151dd | |
| run: | | |
| ./run.sh ${{ github.run_id }} | |
| bench: | |
| needs: launch-ec2 | |
| runs-on: ["${{github.run_id}}", self-hosted] | |
| timeout-minutes: 5760 #4days | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: clippy | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Raid configuration | |
| run: | | |
| sudo mdadm --create --verbose /dev/md0 --level=0 --name=MY_RAID --chunk=64 --raid-devices=2 /dev/nvme1n1 /dev/nvme2n1 | |
| sudo mkfs.ext4 -L MY_RAID /dev/md0 | |
| sudo mount /dev/md0 /tmp | |
| sudo chown -R ubuntu /tmp/ | |
| - name: Install build deps | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake libgmp-dev libasound2-dev | |
| - name: Check for OpenFHE | |
| id: openfhe-check | |
| run: | | |
| if ldconfig -p | grep -q 'libOpenFHE'; then | |
| echo "installed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "installed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout OpenFHE | |
| if: steps.openfhe-check.outputs.installed == 'false' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: MachinaIO/openfhe-development | |
| ref: feat/improve_determinant | |
| path: openfhe | |
| - name: Build & install OpenFHE | |
| if: steps.openfhe-check.outputs.installed == 'false' | |
| run: | | |
| cd openfhe | |
| mkdir -p build && cd build | |
| cmake .. | |
| make -j"$(nproc)" | |
| sudo make install | |
| echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/openfhe.conf | |
| sudo ldconfig | |
| - name: Verify OpenFHE install | |
| run: ls -lah /usr/local/lib | grep OpenFHE | |
| - name: Install abe | |
| run: cargo install --path abe | |
| - name: Verify abe | |
| run: which abe | |
| - name: Run benchmarks (stream + log) | |
| env: | |
| LD_LIBRARY_PATH: /usr/local/lib | |
| RUST_LOG: info | |
| run: | | |
| mkdir -p logs | |
| # Run abe for offline computation with hardcoded config path as requested | |
| ( | |
| abe bench-run-offline \ | |
| --config abe/run_configs/${{ github.event.inputs.config_path }} \ | |
| --data-dir data_${{ github.event.inputs.data_id }} \ | |
| 2>&1 | tee logs/data_${{ github.event.inputs.data_id }}.log | |
| ) & | |
| pid=$! | |
| echo "Benchmark PID: $pid" | |
| wait $pid | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Upload benchmark logs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bench-logs | |
| path: logs/*.log | |
| - name: Run memory profiling | |
| run: | | |
| LOG=logs/data_${{ github.event.inputs.data_id }}.log | |
| uv run memory_profile.py --log-file "$LOG" | |
| - name: Upload memory analysis | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: memory-analysis | |
| path: logs/combined_memory_analysis_*.txt | |
| - name: Clean up logs | |
| if: always() | |
| run: rm -rf logs | |
| - name: Clean up data | |
| if: always() | |
| run: rm -rf data_${{ github.event.inputs.data_id }} | |