Add Nx CPU benchmarks and refresh docs #8
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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - '**/*.ex' | |
| - '**/*.exs' | |
| - '**/*.rs' | |
| - '**/Cargo.toml' | |
| - '**/Cargo.lock' | |
| - 'mix.lock' | |
| - '.github/workflows/ci.yml' | |
| pull_request: | |
| branches: [main, master] | |
| paths: | |
| - '**/*.ex' | |
| - '**/*.exs' | |
| - '**/*.rs' | |
| - '**/Cargo.toml' | |
| - '**/Cargo.lock' | |
| - 'mix.lock' | |
| - '.github/workflows/ci.yml' | |
| env: | |
| MIX_ENV: test | |
| OPENBLAS_NUM_THREADS: 1 | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }} / Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS ARM64 (Apple Silicon) | |
| - os: macos-latest | |
| elixir: "1.19" | |
| otp: "27" | |
| # Linux x86_64 | |
| - os: ubuntu-latest | |
| elixir: "1.19" | |
| otp: "27" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install OpenBLAS (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libopenblas-dev | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}- | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| native/maxsim_cpu/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Compile | |
| run: mix compile --warnings-as-errors | |
| - name: Run tests | |
| run: mix test --exclude benchmark | |
| - name: Run Rust tests | |
| run: cargo test | |
| working-directory: native/maxsim_cpu | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install OpenBLAS | |
| run: sudo apt-get update && sudo apt-get install -y libopenblas-dev | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: "1.19" | |
| otp-version: "27" | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Check formatting (Elixir) | |
| run: mix format --check-formatted | |
| - name: Check formatting (Rust) | |
| run: cargo fmt --check | |
| working-directory: native/maxsim_cpu | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings | |
| working-directory: native/maxsim_cpu |