Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,37 @@ permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Run tests
run: |
# Allow any process to access any perf event:
sudo sysctl -w kernel.perf_event_paranoid=-1
sudo perf stat python --help
pip install maturin
python3 -m venv ./venv
. ./venv/bin/activate
pip install -r requirements-dev.txt
maturin develop
pytest

linux:
needs: [tests]
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'
Expand All @@ -42,9 +66,10 @@ jobs:
path: dist

sdist:
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions test_perf_event.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import numpy as np
from numba import njit
from py_perf_event import (
Expand Down Expand Up @@ -68,6 +69,11 @@ def test_raw():

TODO: This test is model-specific, only tested on i7-12700K.
"""
with open("/proc/cpuinfo") as f:
model = f.read()
if "i7-12700K" not in model:
pytest.skip("Wrong CPU model")

# SIMD on float64:
simd_f64 = [Raw(0x4c7), Raw(0x10c7)]

Expand Down