Strip any mtune option from FFLAGS is the compiler is flang-new #402
Workflow file for this run
This file contains 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: Run codspeed benchmarks | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
benchmarks: | |
if: "github.repository == 'OpenMathLib/OpenBLAS'" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
fortran: [gfortran] | |
build: [make] | |
pyver: ["3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Print system information | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
cat /proc/cpuinfo | |
fi | |
- name: Install Dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update | |
sudo apt-get install -y gfortran cmake ccache libtinfo5 | |
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: Write out the .pc | |
run: | | |
cd benchmark/pybench | |
cat > openblas.pc << EOF | |
libdir=${{ github.workspace }} | |
includedir= ${{ github.workspace }} | |
openblas_config= OpenBLAS 0.3.27 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64 | |
version=0.0.99 | |
extralib=-lm -lpthread -lgfortran -lquadmath -L${{ github.workspace }} -lopenblas | |
Name: openblas | |
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version | |
Version: ${version} | |
URL: https://github.com/xianyi/OpenBLAS | |
Libs: ${{ github.workspace }}/libopenblas.so -Wl,-rpath,${{ github.workspace }} | |
Libs.private: -lm -lpthread -lgfortran -lquadmath -L${{ github.workspace }} -lopenblas | |
Cflags: -I${{ github.workspace}} | |
EOF | |
cat openblas.pc | |
- name: Configure ccache | |
run: | | |
if [ "${{ matrix.build }}" = "make" ]; then | |
# Add ccache to path | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
echo "/usr/lib/ccache" >> $GITHUB_PATH | |
elif [ "$RUNNER_OS" = "macOS" ]; then | |
echo "$(brew --prefix)/opt/ccache/libexec" >> $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 | |
- name: Show ccache status | |
continue-on-error: true | |
run: ccache -s | |
- name: Install benchmark dependencies | |
run: pip install meson ninja numpy pytest pytest-codspeed --user | |
- name: Build the wrapper | |
run: | | |
cd benchmark/pybench | |
export PKG_CONFIG_PATH=$PWD | |
meson setup build --prefix=$PWD/build-install | |
meson install -C build | |
# | |
# sanity check | |
cd build/openblas_wrap | |
python -c'import _flapack; print(dir(_flapack))' | |
- name: Run benchmarks under pytest-benchmark | |
run: | | |
cd benchmark/pybench | |
pip install pytest-benchmark | |
export PYTHONPATH=$PWD/build-install/lib/python${{matrix.pyver}}/site-packages/ | |
OPENBLAS_NUM_THREADS=1 pytest benchmarks/bench_blas.py -k 'gesdd' | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@v2 | |
with: | |
token: ${{ secrets.CODSPEED_TOKEN }} | |
run: | | |
cd benchmark/pybench | |
export PYTHONPATH=$PWD/build-install/lib/python${{matrix.pyver}}/site-packages/ | |
OPENBLAS_NUM_THREADS=1 pytest benchmarks/bench_blas.py --codspeed | |