WIP: start adding a cirun-asv workflow
This commit is contained in:
parent
7e7edd954e
commit
412d81a9c6
|
@ -0,0 +1,186 @@
|
|||
name: Benchmark on arm64 graviton cirun
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- release-**
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- release-**
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
env:
|
||||
# GITHUB_TOKEN: ${{ secrets.OB_BENCH_TOKEN }}
|
||||
# BENCHMARKS_REPO: ev-br/ob-bench-asv
|
||||
ASV_CONFIG: asv.conf.json
|
||||
MACHINE_NAME: github-actions # to identify github actions machine as hostname changes everytime
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: "github.repository == 'OpenMathLib/OpenBLAS'"
|
||||
runs-on: "cirun-aws-runner-graviton--${{ github.run_id }}"
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
fortran: [gfortran]
|
||||
build: [make]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # To fetch all commits to be able to generate benchmarks html
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Print system information
|
||||
run: |
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
cat /proc/cpuinfo
|
||||
else
|
||||
echo "::error::$RUNNER_OS not supported"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install numpy meson meson-python ninja build asv
|
||||
# sudo apt install libopenblas-dev # XXX
|
||||
pip install scipy_openblas32
|
||||
python -c'import scipy_openblas32 as so; print(so.get_pkg_config())' > scipy_openblas.pc
|
||||
export PKG_CONFIG_PATH=$PWD
|
||||
echo ">>>> PKG_CONFIG" $PKG_CONFIG_PATH
|
||||
cat scipy_openblas.pc
|
||||
|
||||
run: |
|
||||
pip install numpy meson meson-python ninja build asv
|
||||
# sudo apt install libopenblas-dev # XXX
|
||||
pip install scipy_openblas32
|
||||
python -c'import scipy_openblas32 as so; print(so.get_pkg_config())' > scipy_openblas.pc
|
||||
export PKG_CONFIG_PATH=$PWD
|
||||
echo ">>>> PKG_CONFIG" $PKG_CONFIG_PATH
|
||||
cat scipy_openblas.pc
|
||||
|
||||
- name: Set and log asv machine configuration
|
||||
run: |
|
||||
asv machine --yes --config asv.conf.json
|
||||
echo "Machine Configuration:"
|
||||
cat ~/.asv-machine.json
|
||||
rm ~/.asv-machine.json
|
||||
|
||||
echo "Setting machine name to $MACHINE_NAME"
|
||||
asv machine --machine $MACHINE_NAME --yes --config $ASV_CONFIG -v
|
||||
cat ~/.asv-machine.json
|
||||
|
||||
######################
|
||||
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
sudo apt update
|
||||
sudo apt-get install -y gfortran cmake ccache libtinfo5 python3-pip pkg-config
|
||||
else
|
||||
echo "::error::$RUNNER_OS not supported"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Compilation cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
# We include the commit sha in the cache key, as new cache entries are
|
||||
# only created if there is no existing entry for the key yet.
|
||||
# GNU make and cmake call the compilers differently. It looks like
|
||||
# that causes the cache to mismatch. Keep the ccache for both build
|
||||
# tools separate to avoid polluting each other.
|
||||
key: ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }}
|
||||
# Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler.
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}
|
||||
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}
|
||||
ccache-${{ runner.os }}-${{ matrix.build }}
|
||||
|
||||
- name: Configure ccache
|
||||
run: |
|
||||
if [ "${{ matrix.build }}" = "make" ]; then
|
||||
# Add ccache to path
|
||||
if [ "$RUNNER_OS" = "Linux" ]; then
|
||||
echo "/usr/lib/ccache" >> $GITHUB_PATH
|
||||
else
|
||||
echo "::error::$RUNNER_OS not supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB).
|
||||
test -d ~/.ccache || mkdir -p ~/.ccache
|
||||
echo "max_size = 300M" > ~/.ccache/ccache.conf
|
||||
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||
ccache -s
|
||||
|
||||
- name: Build OpenBLAS
|
||||
run: |
|
||||
case "${{ matrix.build }}" in
|
||||
"make")
|
||||
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}"
|
||||
;;
|
||||
"cmake")
|
||||
mkdir build && cd build
|
||||
cmake -DDYNAMIC_ARCH=1 \
|
||||
-DNOFORTRAN=0 \
|
||||
-DBUILD_WITHOUT_LAPACK=0 \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
|
||||
..
|
||||
cmake --build .
|
||||
;;
|
||||
*)
|
||||
echo "::error::Configuration not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
make install PREFIX=$HOME/built-libs
|
||||
|
||||
- name: Show ccache status
|
||||
continue-on-error: true
|
||||
run: ccache -s
|
||||
|
||||
- name: Install benchmarking dependencies
|
||||
run: pip3 install meson ninja numpy pytest pytest-benchmark --user
|
||||
|
||||
- name: Build the wrapper
|
||||
run: |
|
||||
cd benchmark/pybench
|
||||
export PKG_CONFIG_PATH=$HOME/built-libs/lib/pkgconfig
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
meson setup build --prefix=$PWD/build-install
|
||||
meson install -C build
|
||||
#
|
||||
# sanity check
|
||||
cd build/openblas_wrap
|
||||
python3 -c'import _flapack; print(dir(_flapack))'
|
||||
#
|
||||
# copy the built .so (ubuntu linker!)
|
||||
cp _flapack.cpython-*-aarch64-linux-gnu.so ../../build-install/lib/python3/dist-packages/openblas_wrap
|
||||
|
||||
- name: Run benchmarks
|
||||
run: |
|
||||
cd benchmark/pybench
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
export PYTHONPATH=$PWD/build-install/lib/python3/dist-packages/
|
||||
OPENBLAS_NUM_THREADS=1 pytest benchmarks/bench_blas.py
|
||||
|
Loading…
Reference in New Issue