Skip to content

Performance improvements and updates #801

Performance improvements and updates

Performance improvements and updates #801

name: Continuous Integration
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:
workflow_call:
jobs:
compile:
name: Compile on ${{ matrix.os }} with ${{ matrix.cxx }} (BLAS ${{ matrix.blas }}, Get BLAS ${{ matrix.getBlas }}, FFTW ${{ matrix.fftw }}, MPFR ${{ matrix.mpfr }}, C++ ${{ matrix.cpp }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
clangVer: "16.0"
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
clangVer: "16.0"
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 23
pretty: "LibRapid_Ubuntu_Clang_C++23_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 23
pretty: "LibRapid_Ubuntu_Clang_C++23_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 23
pretty: "LibRapid_Ubuntu_Clang_C++23_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 23
pretty: "LibRapid_Ubuntu_Clang_C++23_BLAS_FFTW_MPFR"
- os: macos-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
clangVer: "15.0"
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_Clang++_C++20_MPFR"
- os: macos-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
clangVer: "15.0"
blas: on
getBlas: off # Included with XCode
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_Clang++_C++20_BLAS_FFTW_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_GCC-11_C++20_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: on # Accelerate requires clang so we get blas
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_GCC-11_C++20_BLAS_FFTW_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 23
pretty: "LibRapid_MacOS_GCC-11_C++23_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: on # Accelerate Requires clang, so we get blas
getBlas: on
fftw: on
mpfr: on
cpp: 23
pretty: "LibRapid_MacOS_GCC-11_C++23_BLAS_FFTW_MPFR"
- os: windows-latest
cc: ../llvm/clang
cxx: ../llvm/clang++
clangVer: "16.0"
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Windows_Clang_C++20_MPFR"
- os: windows-latest
cc: ../llvm/clang
cxx: ../llvm/clang++
clangVer: "16.0"
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Windows_Clang_C++20_BLAS_FFTW_MPFR"
- os: windows-latest
cc: ./llvm/clang
cxx: ./llvm/clang++
clangVer: "16.0"
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 23
pretty: "LibRapid_Windows_Clang_C++23_MPFR"
- os: windows-latest
cc: ./llvm/clang
cxx: ./llvm/clang++
clangVer: "16.0"
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 23
pretty: "LibRapid_Windows_Clang_C++23_BLAS_FFTW_MPFR"
- os: windows-latest
cc: msvc
cxx: msvc
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Windows-Latest_MSVC_C++20"
- os: windows-latest
cc: msvc
cxx: msvc
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Windows-Latest_MSVC_C++20"
- os: windows-latest
cc: msvc
cxx: msvc
blas: off
getBlas: off
fftw: off
mpfr: on
cpp: 23
pretty: "LibRapid_Windows-Latest_MSVC_C++23"
- os: windows-latest
cc: msvc
cxx: msvc
blas: on
getBlas: on
fftw: on
mpfr: on
cpp: 23
pretty: "LibRapid_Windows-Latest_MSVC_C++23"
steps:
- name: Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1.8.7
with:
theme: "dark"
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Clang
if: matrix.clangVer != null
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ matrix.clangVer }}
directory: "./llvm"
env: on
- name: Install XCode
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1.5.1
with:
xcode-version: latest
# Tests must pass in both debug and release mode
- name: Compile (Debug)
run: |
mkdir buildDebug
cd buildDebug
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_BLAS=${{ matrix.blas }} -DLIBRAPID_GET_BLAS=${{ matrix.getBlas }} -DLIBRAPID_USE_MULTIPREC=${{ matrix.mpfr }} -DLIBRAPID_USE_OPENCL=off
cmake --build . --config Debug
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Run Tests (Debug)
run: |
cd buildDebug
ctest -C Debug --output-on-failure
- name: Compile (Release)
run: |
mkdir buildRelease
cd buildRelease
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_BLAS=${{ matrix.blas }} -DLIBRAPID_GET_BLAS=${{ matrix.getBlas }} -DLIBRAPID_USE_MULTIPREC=${{ matrix.mpfr }} -DLIBRAPID_USE_OPENCL=off
cmake --build . --config Release
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Run Tests (Release)
run: |
cd buildRelease
ctest -C Release --output-on-failure
build-docs:
name: Build Documentation Locally
runs-on: ubuntu-latest
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "15.0"
directory: "./llvm"
env: on
- name: Build Doxygen
id: build_doxygen
continue-on-error: true
run: |
git clone --recursive https://github.com/doxygen/doxygen.git
cd doxygen
git checkout Release_1_9_7
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
cmake --build . --config Release
sudo make install
env:
CC: gcc
CXX: g++
- name: Install Doxygen on Error
if: steps.build_doxygen.outcome != 'success'
run: |
sudo apt install doxygen
- name: Upgrade Source Distribution
continue-on-error: true
run: |
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
- name: Install LaTeX
continue-on-error: true
# run: |
# sudo apt-get install -y texlive-full
run: |
sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- name: Install Requirements
continue-on-error: true
run: |
cd docs
pip install -r requirements.txt
- name: Force install Sphinx Build
continue-on-error: true
run: |
sudo apt --fix-broken install
sudo apt-get install python3-sphinx
- name: Configure Files
run: |
touch .is_local
- name: Build HTML Documentation
run: |
cd docs
make html
- name: Build PDf Documentation
# continue-on-error: true
run: |
cd docs
make latexpdf
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: Documentation
path: docs/build/**
run-benchmarks:
name: Run Benchmarks on ${{ matrix.os }} with ${{ matrix.cxx }}
needs: [ compile, build-docs ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cc: ../../llvm/bin/clang
cxx: ../../llvm/bin/clang++
clangVer: "16.0"
smallArrays: ON
pretty: "LibRapid_Ubuntu_Clang_OptimiseSmallArrays"
- os: ubuntu-latest
cc: ../../llvm/bin/clang
cxx: ../../llvm/bin/clang++
clangVer: "16.0"
smallArrays: OFF
pretty: "LibRapid_Ubuntu_Clang"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
smallArrays: ON
pretty: "LibRapid_Ubuntu_GCC_OptimiseSmallArrays"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
smallArrays: OFF
pretty: "LibRapid_Ubuntu_GCC"
- os: macos-latest
cc: ../../llvm/bin/clang
cxx: ../../llvm/bin/clang++
clangVer: "16.0"
smallArrays: ON
pretty: "LibRapid_MacOS_Clang_OptimiseSmallArrays"
- os: macos-latest
cc: ../../llvm/bin/clang
cxx: ../../llvm/bin/clang++
clangVer: "16.0"
smallArrays: OFF
pretty: "LibRapid_MacOS_Clang"
- os: macos-latest
cc: gcc-11
cxx: g++-11
smallArrays: ON
pretty: "LibRapid_MacOS_GCC_OptimiseSmallArrays"
- os: macos-latest
cc: gcc-11
cxx: g++-11
smallArrays: OFF
pretty: "LibRapid_MacOS_GCC"
- os: windows-latest
cc: ../../llvm/clang
cxx: ../../llvm/clang++
clangVer: "16.0"
smallArrays: ON
pretty: "LibRapid_Windows_Clang_OptimiseSmallArrays"
- os: windows-latest
cc: ../../llvm/clang
cxx: ../../llvm/clang++
clangVer: "16.0"
smallArrays: OFF
pretty: "LibRapid_Windows_Clang"
- os: windows-latest
cc: msvc
cxx: msvc
smallArrays: ON
pretty: "LibRapid_Windows_MSVC_OptimiseSmallArrays"
- os: windows-latest
cc: msvc
cxx: msvc
smallArrays: OFF
pretty: "LibRapid_Windows_MSVC"
steps:
- name: Install Clang
if: matrix.clangVer != null
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ matrix.clangVer }}
directory: "./llvm"
env: on
- name: Install XCode
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1.5.1
- name: Clone Benchmark Repository
run: |
git clone https://github.com/LibRapid/BenchmarksCPP.git --recursive
- name: Update LibRapid Submodule
run: |
cd BenchmarksCPP
cd vendor/librapid
git checkout ${{ github.head_ref || github.ref_name }} -- || git checkout ${{ github.ref }}
git pull
git submodule update --init --recursive
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install Requirements
run: |
pip install --upgrade pip
cd BenchmarksCPP
pip install -r requirements.txt
- name: Compile Benchmarks
run: |
cd BenchmarksCPP
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSING_GITHUB_ACTIONS=ON -DLIBRAPID_OPTIMISE_SMALL_ARRAYS=${{ matrix.smallArrays }} -DLIBRAPID_GET_BLAS=ON -DLIBRAPID_USE_BLAS=ON -DLIBRAPID_USE_MULTIPREC=ON -DLIBRAPID_USE_OPENCL=OFF
cmake --build . --config Release
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
# On Windows, the generated executable is in "build/Release"
- name: Run Benchmarks
if: matrix.os == 'windows-latest'
run: |
cd BenchmarksCPP/build/Release
./BenchmarksCPP.exe
# On Unix systems, the generated executable is in "build"
- name: Run Benchmarks
if: matrix.os != 'windows-latest'
run: |
cd BenchmarksCPP/build
./BenchmarksCPP
- name: Generate Benchmark Graphs
if: matrix.os == 'windows-latest'
run: |
cd BenchmarksCPP/scripts
python dataProcessor.py --directory ../build/Release --output ../../${{ matrix.pretty }} --relative Eigen --verbose
- name: Generate Benchmark Graphs
if: matrix.os != 'windows-latest'
run: |
cd BenchmarksCPP/scripts
python dataProcessor.py --directory ../build --output ../../${{ matrix.pretty }} --relative Eigen --verbose
- name: Upload Intermediate Benchmark Results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pretty }}
path: ${{ matrix.pretty }}
upload-benchmarks:
name: Upload Benchmark Results
needs: run-benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Download Intermediate Benchmark Results
uses: actions/download-artifact@v3
with:
path: IntermediateBenchmarkResults
- name: Tree IntermediateBenchmarkResults
run: |
cd IntermediateBenchmarkResults
tree
- name: Upload Intermediate Benchmark Results
uses: actions/upload-artifact@v4
with:
name: IntermediateBenchmarkResults
path: IntermediateBenchmarkResults
- name: Auto-Generate Benchmark Documentation
run: |
git clone https://github.com/LibRapid/BenchmarksCPP.git
cd BenchmarksCPP
pip install --upgrade pip
pip install -r requirements.txt
cd scripts
python docGenerator.py --input ../../IntermediateBenchmarkResults --output ../../BenchmarkDocumentation
- name: Tree BenchmarkDocumentation
run: |
cd BenchmarkDocumentation
tree
- name: Upload Benchmark Documentation
uses: actions/upload-artifact@v4
with:
name: LibRapid_Benchmark_SHA_${{ github.sha }}
path: BenchmarkDocumentation
quodona:
name: Run Qodana
needs: [ compile, upload-benchmarks ]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
# - name: Qodana Scan
# uses: JetBrains/qodana-action@main
# env:
# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
code-coverage:
name: Code Coverage
needs: [ compile, upload-benchmarks ]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install Coverage Tools
run: |
sudo apt install lcov
sudo apt install gcovr
- name: Compile and Run
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBRAPID_CODE_COV=on -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_BLAS=ON -DLIBRAPID_GET_FFTW=on -DLIBRAPID_USE_MULTIPREC=on
cmake --build .
env:
CC: gcc-11
CXX: g++-11
- name: Run Tests
run: |
cd build
ctest -C Debug --output-on-failure
- name: Upload Coverage Reports
uses: codecov/codecov-action@v3
trigger-docs:
name: Trigger Documentation Build
needs: [ compile, build-docs, quodona, code-coverage ]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
with:
submodules: recursive
- name: Trigger RTDs build
if: github.event_name != 'pull_request'
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}
success:
name: Success
needs: trigger-docs
runs-on: ubuntu-latest
steps:
- name: Print Success
run: |
echo "Success!"