Various improvements for highspy #58
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: blas-override | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| uno-hipo-blas-override: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout HiGHS (current branch) | |
| uses: actions/checkout@v4 | |
| with: | |
| path: HiGHS | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake g++ git libblas-dev liblapack-dev | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install cmake openblas | |
| - name: Build HiGHS with HiPO against reference BLAS via BLAS_LIBRARIES only (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| blas_lib=$(find /usr/lib -name "libblas.so*" | head -n1) | |
| echo "Reference BLAS library: $blas_lib" | |
| cmake -S HiGHS -B HiGHS/build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DHIPO=ON \ | |
| -DFAST_BUILD=ON \ | |
| -DBUILD_SHARED_LIBS=OFF \ | |
| -DBUILD_SHARED_EXTRAS_LIB=OFF \ | |
| -DALL_TESTS=OFF \ | |
| -DZLIB=OFF \ | |
| -DBLAS_LIBRARIES=$blas_lib \ | |
| -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/highs-install | |
| cmake --build HiGHS/build --parallel | |
| cmake --install HiGHS/build | |
| - name: Re-link into a single shared library, as downstream static packaging does (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| # This is the step from the UnoUtils_jll reproducer in issue #3160: | |
| # it fails with "undefined reference to openblas_set_num_threads" | |
| # if HiGHS wrongly assumed OpenBLAS just because BLAS_LIBRARIES | |
| # was set explicitly. | |
| cd ${{ github.workspace }}/highs-install/lib | |
| g++ -shared -Wl,--whole-archive libhighs.a libhighs_extras.a \ | |
| -Wl,--no-whole-archive -Wl,--no-undefined -lblas -o libhighs_combined.so | |
| - name: Build HiGHS with HiPO against an explicit non-default BLAS vendor (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| cmake -S HiGHS -B HiGHS/build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DHIPO=ON \ | |
| -DFAST_BUILD=ON \ | |
| -DBUILD_SHARED_EXTRAS_LIB=ON \ | |
| -DALL_TESTS=OFF \ | |
| -DBLA_VENDOR=OpenBLAS \ | |
| -DBLAS_ROOT=$(brew --prefix openblas) \ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/highs-install | |
| cmake --build HiGHS/build --parallel | |
| cmake --install HiGHS/build | |
| - name: Verify HiGHS linked the requested OpenBLAS, not Apple Accelerate (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| lib=$(find ${{ github.workspace }}/highs-install/lib -name "libhighs_extras*.dylib" | head -n1) | |
| if [ -z "$lib" ]; then | |
| echo "::error::libhighs_extras*.dylib not found under highs-install/lib" | |
| exit 1 | |
| fi | |
| echo "Checking linked libraries for $lib" | |
| otool -L "$lib" | |
| if otool -L "$lib" | grep -q "/Accelerate.framework/"; then | |
| echo "::error::libhighs_extras linked Apple Accelerate despite -DBLA_VENDOR=OpenBLAS" | |
| exit 1 | |
| fi | |
| otool -L "$lib" | grep -qi "openblas" || { echo "::error::libhighs_extras did not link the requested OpenBLAS"; exit 1; } |