From 563524f70e3ba5a4d787fb9bf24beb3974d7d0e1 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 1 Oct 2025 10:52:58 +1300 Subject: [PATCH] Refactor the HiPO build system to support cross compilation --- .github/julia/build_tarballs.jl | 7 +- .github/workflows/hipo-macos.yml | 306 ------------------ .github/workflows/hipo-ubuntu.yml | 386 ----------------------- .github/workflows/hipo-win.yml | 239 -------------- .github/workflows/hipo.yml | 72 +++++ .github/workflows/julia-tests-ubuntu.yml | 63 ---- .github/workflows/julia-tests.yml | 112 +++++++ CMakeLists.txt | 3 - cmake/FindHipoDeps.cmake | 81 ++--- docs/src/parallel.md | 2 +- highs/CMakeLists.txt | 42 +-- highs/ipm/hipo/factorhighs/Analyse.cpp | 1 - 12 files changed, 222 insertions(+), 1092 deletions(-) delete mode 100644 .github/workflows/hipo-macos.yml delete mode 100644 .github/workflows/hipo-ubuntu.yml delete mode 100644 .github/workflows/hipo-win.yml create mode 100644 .github/workflows/hipo.yml delete mode 100644 .github/workflows/julia-tests-ubuntu.yml create mode 100644 .github/workflows/julia-tests.yml diff --git a/.github/julia/build_tarballs.jl b/.github/julia/build_tarballs.jl index 655e6968d2..9d37210870 100644 --- a/.github/julia/build_tarballs.jl +++ b/.github/julia/build_tarballs.jl @@ -33,7 +33,10 @@ cmake -DCMAKE_INSTALL_PREFIX=${prefix} \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=${BUILD_SHARED} \ -DZLIB_USE_STATIC_LIBS=${BUILD_STATIC} \ - -DFAST_BUILD=ON .. + -DHIPO=ON \ + -DBLAS_LIBRARIES="${libdir}/libopenblas.${dlext}" \ + -DMETIS_ROOT=${prefix} \ + .. if [[ "${target}" == *-linux-* ]]; then make -j ${nproc} @@ -60,6 +63,8 @@ platforms = expand_cxxstring_abis(platforms) dependencies = [ Dependency("CompilerSupportLibraries_jll"), Dependency("Zlib_jll"), + Dependency("METIS_jll"), + Dependency("OpenBLAS32_jll"), HostBuildDependency(PackageSpec(; name="CMake_jll")), ] diff --git a/.github/workflows/hipo-macos.yml b/.github/workflows/hipo-macos.yml deleted file mode 100644 index 317993b99e..0000000000 --- a/.github/workflows/hipo-macos.yml +++ /dev/null @@ -1,306 +0,0 @@ -name: hipo-macos - -on: [push, pull_request] - -jobs: - release: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Install METIS - run: | - cd METIS - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Check METIS and GKlib - working-directory: ${{runner.workspace}} - run: | - cd installs - ls - ls lib - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - debug: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Install METIS - run: | - cd METIS - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Check METIS and GKlib - working-directory: ${{runner.workspace}} - run: | - cd installs - ls - ls lib - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs \ - -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - release_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Install METIS - run: | - cd METIS - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Check METIS and GKlib - working-directory: ${{runner.workspace}} - run: | - cd installs - ls - ls lib - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON -DALL_TESTS=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - debug_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Install METIS - run: | - cd METIS - make config prefix=${{runner.workspace}}/installs - make - make install - - - name: Check METIS and GKlib - working-directory: ${{runner.workspace}} - run: | - cd installs - ls - ls lib - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON -DALL_TESTS=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs \ - -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure \ No newline at end of file diff --git a/.github/workflows/hipo-ubuntu.yml b/.github/workflows/hipo-ubuntu.yml deleted file mode 100644 index de9cdafc39..0000000000 --- a/.github/workflows/hipo-ubuntu.yml +++ /dev/null @@ -1,386 +0,0 @@ -name: hipo-ubuntu - -on: [push, pull_request] - -jobs: - release: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - # - name: Check installs - # working-directory: ${{runner.workspace}} - # run: | - # cd installs - # ls - # ls lib - - - name: Copy GKlib shared (bug) - working-directory: ${{runner.workspace}} - run: | - cd installs - cd lib - ln libGKlib.so.0 libGKlib.so - ls - - - name: Install METIS - run: | - cd METIS - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - # no default blas available on runner - - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: | - /var/cache/apt/archives - /var/lib/apt/lists - key: ${{ runner.os }}-apt-libopenblas - - - name: Install OpenBLAS - shell: bash - run: | - sudo apt update - sudo apt install libopenblas-dev - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - debug: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - - name: Copy GKlib shared (bug) - working-directory: ${{runner.workspace}} - run: | - cd installs - cd lib - ln libGKlib.so.0 libGKlib.so - ls - - - name: Install METIS - shell: bash - run: | - cd METIS - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: | - /var/cache/apt/archives - /var/lib/apt/lists - key: ${{ runner.os }}-apt-libopenblas - - - name: Install OpenBLAS - shell: bash - run: | - sudo apt update - sudo apt install libopenblas-dev - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs \ - -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - release_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - # - name: Check installs - # working-directory: ${{runner.workspace}} - # run: | - # cd installs - # ls - # ls lib - - - name: Copy GKlib shared (bug) - working-directory: ${{runner.workspace}} - run: | - cd installs - cd lib - ln libGKlib.so.0 libGKlib.so - ls - - - name: Install METIS - run: | - cd METIS - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - # no default blas available on runner - - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: | - /var/cache/apt/archives - /var/lib/apt/lists - key: ${{ runner.os }}-apt-libopenblas - - - name: Install OpenBLAS - shell: bash - run: | - sudo apt update - sudo apt install libopenblas-dev - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON -DALL_TESTS=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure - - debug_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Checkout GKlib - uses: actions/checkout@v4 - with: - repository: KarypisLab/GKlib - ref: master - path: GKlib - - - name: Checkout METIS - uses: actions/checkout@v4 - with: - repository: KarypisLab/METIS - ref: master - path: METIS - - - name: Create installs dir - working-directory: ${{runner.workspace}} - run: | - mkdir installs - ls - - - name: Install GKLIB - run: | - cd GKlib - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - - name: Copy GKlib shared (bug) - working-directory: ${{runner.workspace}} - run: | - cd installs - cd lib - ln libGKlib.so.0 libGKlib.so - ls - - - name: Install METIS - shell: bash - run: | - cd METIS - make config shared=1 prefix=${{runner.workspace}}/installs - make - make install - - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: | - /var/cache/apt/archives - /var/lib/apt/lists - key: ${{ runner.os }}-apt-libopenblas - - - name: Install OpenBLAS - shell: bash - run: | - sudo apt update - sudo apt install libopenblas-dev - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE -DHIPO=ON -DALL_TESTS=ON \ - -DMETIS_ROOT=${{runner.workspace}}/installs \ - -DGKLIB_ROOT=${{runner.workspace}}/installs \ - -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel - - - name: Test executable - working-directory: ${{runner.workspace}}/build - run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure \ No newline at end of file diff --git a/.github/workflows/hipo-win.yml b/.github/workflows/hipo-win.yml deleted file mode 100644 index 4341401e62..0000000000 --- a/.github/workflows/hipo-win.yml +++ /dev/null @@ -1,239 +0,0 @@ -name: hipo-win - -on: [push, pull_request] - -jobs: - release: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest] - - steps: - - uses: actions/checkout@v4 - - # 2. Set up caching for vcpkg - - name: Cache vcpkg - uses: actions/cache@v3 - with: - path: | - ./vcpkg/installed - ./vcpkg/downloads - key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ runner.os }}- - - # - name: Install GKlib - # run: vcpkg install gklib - - # - name: ls - # run: ls C:/vcpkg/packages/gklib_x64-windows/share/gklib - - - name: Install METIS - run: vcpkg install metis - - # run: ls C:/vcpkg/packages/metis_x64-windows/ - # run: ls C:/vcpkg/packages/metis_x64-windows/lib - # run: ls C:/vcpkg/packages/metis_x64-windows/share - # run: ls C:/vcpkg/packages/gklib_x64-windows/share/gklib - - - name: Install OpenBLAS - run: vcpkg install openblas[threads] - - - name: Create build dir - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure cmake - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE \ - -DHIPO=ON \ - -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake - - # -DCMAKE_CXX_FLAGS="-I C:/vcpkg/packages/gklib_x64-windows/include/GKlib" - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel --config Release - - - name: Test executable - shell: bash - working-directory: ${{runner.workspace}}/build - run: ./Release/bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure -C Release - - debug: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest] - - steps: - - uses: actions/checkout@v4 - - # 2. Set up caching for vcpkg - - name: Cache vcpkg - uses: actions/cache@v3 - with: - path: | - ./vcpkg/installed - ./vcpkg/downloads - key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ runner.os }}- - - - name: Install METIS - run: vcpkg install metis - - - name: Install OpenBLAS - run: vcpkg install openblas[threads] - - - name: Create build dir - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure cmake - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE \ - -DHIPO=ON \ - -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel --config Debug - - - name: Test executable - shell: bash - working-directory: ${{runner.workspace}}/build - run: ./Debug/bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure -C Debug - - release_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest] - - steps: - - uses: actions/checkout@v4 - - # 2. Set up caching for vcpkg - - name: Cache vcpkg - uses: actions/cache@v3 - with: - path: | - ./vcpkg/installed - ./vcpkg/downloads - key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ runner.os }}- - - - name: Install METIS - run: vcpkg install metis - - - name: Install OpenBLAS - run: vcpkg install openblas[threads] - - - name: Create build dir - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure cmake - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE \ - -DHIPO=ON \ - -DALL_TESTS=ON \ - -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel --config Release - - - name: Test executable - shell: bash - working-directory: ${{runner.workspace}}/build - run: ./Release/bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure -C Release - - debug_all_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest] - - steps: - - uses: actions/checkout@v4 - - # 2. Set up caching for vcpkg - - name: Cache vcpkg - uses: actions/cache@v3 - with: - path: | - ./vcpkg/installed - ./vcpkg/downloads - key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ runner.os }}- - - - name: Install METIS - run: vcpkg install metis - - - name: Install OpenBLAS - run: vcpkg install openblas[threads] - - - name: Create build dir - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure cmake - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake $GITHUB_WORKSPACE \ - -DHIPO=ON \ - -DALL_TESTS=ON \ - -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake --build . --parallel --config Debug - - - name: Test executable - shell: bash - working-directory: ${{runner.workspace}}/build - run: ./Debug/bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps - - - name: Ctest - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ctest --parallel --timeout 300 --output-on-failure -C Debug \ No newline at end of file diff --git a/.github/workflows/hipo.yml b/.github/workflows/hipo.yml new file mode 100644 index 0000000000..9c810137d1 --- /dev/null +++ b/.github/workflows/hipo.yml @@ -0,0 +1,72 @@ +name: hipo +on: [push, pull_request] +jobs: + test-nix: + name: hipo ${{ matrix.os }} CMAKE_BUILD_TYPE=${{ matrix.build_type }} ALL_TESTS=${{ matrix.all_tests }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest'] + build_type: ['Release', 'Debug'] + all_tests: ['OFF', 'ON'] + steps: + - uses: actions/checkout@v4 + - if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + sudo apt update + sudo apt install libopenblas-dev + echo "TRIPLET=x86_64-linux-gnu" >> $GITHUB_ENV + - if : ${{ matrix.os == 'macos-latest' }} + run: echo "TRIPLET=aarch64-apple-darwin" >> $GITHUB_ENV + - run: | + mkdir installs + curl -L -o installs/METIS.tar.gz \ + "https://github.com/JuliaBinaryWrappers/METIS_jll.jl/releases/download/METIS-v5.1.3%2B0/METIS.v5.1.3.${TRIPLET}.tar.gz" + tar -xzf installs/METIS.tar.gz -C installs + mkdir -p build + cd build + cmake \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DALL_TESTS=${{ matrix.all_tests }} \ + -DHIPO=ON \ + -DMETIS_ROOT=installs \ + .. + cmake --build . --parallel + ctest --parallel --timeout 300 --output-on-failure --no-tests=error + test-win: + name: hipo windows-latest CMAKE_BUILD_TYPE=${{ matrix.build_type }} ALL_TESTS=${{ matrix.all_tests }} + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_type: ['Release', 'Debug'] + all_tests: ['OFF', 'ON'] + steps: + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: galabovaa/METIS + ref: 510-w + path: METIS + - shell: bash + run: | + mkdir installs + INSTALLS_PREFIX=$(cygpath "${{ runner.workspace }}")/installs + cd METIS + cmake -S. -B build -DGKLIB_PATH=GKlib -DCMAKE_INSTALL_PREFIX=$INSTALLS_PREFIX + cmake --build build --parallel --config ${{ matrix.build_type }} + cmake --install build --config ${{ matrix.build_type }} + cd .. + vcpkg install openblas[threads] + cmake -E make_directory build + cd build + cmake \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DALL_TESTS=${{ matrix.all_tests }} \ + -DHIPO=ON \ + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DMETIS_ROOT=$INSTALLS_PREFIX \ + .. + cmake --build . --parallel --config ${{ matrix.build_type }} + ctest -C ${{ matrix.build_type }} --timeout 300 --output-on-failure --no-tests=error diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml deleted file mode 100644 index 357c877e98..0000000000 --- a/.github/workflows/julia-tests-ubuntu.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: JuliaCompileAndTest -on: - push: - branches: [master, latest] - pull_request: - types: [opened, synchronize, ready_for_review, reopened] -# needed to allow julia-actions/cache to delete old caches that it has created -permissions: - actions: write - contents: read -jobs: - test: - name: Julia - ${{ github.event_name }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - # Install Julia 1.7 for BinaryBuilder. Note that this is an old version of - # Julia, but it is required for compatibility with BinaryBuilder. - - uses: julia-actions/setup-julia@v2 - with: - version: "1.7" - arch: x64 - - uses: julia-actions/cache@v2 - # Set the environment variables required by BinaryBuilder. - - run: | - git fetch --tags - echo "HIGHS_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1) | sed 's/^v//')" >> $GITHUB_ENV - if [ "${{ github.event_name }}" = "pull_request" ]; then - echo "HIGHS_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV - echo "HIGHS_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV - else - echo "HIGHS_COMMIT=${{ github.sha }}" >> $GITHUB_ENV - echo "HIGHS_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV - fi - - run: | - julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-cxx11 --verbose --deploy="local" - # Now install a newer version of Julia to actually test HiGHS_jll. We - # choose v1.10 because it is the current Long-Term Support (LTS). - - uses: julia-actions/setup-julia@v2 - with: - version: "1.10" - arch: x64 - # We want to install the latest version of HiGHS.jl, but we also want it - # to be compatible with our newly compiled HiGHS_jll. To do so, we - # manually edit HiGHS.jl's Project.toml file to allow any v1.X.Y version - # of HiGHS_jll - - shell: julia --color=yes {0} - run: | - using Pkg - Pkg.develop("HiGHS") - project_filename = "/home/runner/.julia/dev/HiGHS/Project.toml" - project = read(project_filename, String) - write( - project_filename, - replace(project, r"HiGHS_jll = \"=.+?\"" => "HiGHS_jll = \"1\""), - ) - # Now we can add HiGHS_jll and run the tests for HiGHS. - - shell: julia --color=yes {0} - run: | - using Pkg - Pkg.develop(; path="/home/runner/.julia/dev/HiGHS_jll") - Pkg.test("HiGHS") diff --git a/.github/workflows/julia-tests.yml b/.github/workflows/julia-tests.yml new file mode 100644 index 0000000000..65fc18b19d --- /dev/null +++ b/.github/workflows/julia-tests.yml @@ -0,0 +1,112 @@ +name: JuliaCompileAndTest +on: [push, pull_request] +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + triplet: ['x86_64-linux-gnu-cxx11', 'aarch64-apple-darwin', 'x86_64-w64-mingw32-cxx11'] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1.7" + arch: x64 + - uses: julia-actions/cache@v2 + - run: | + git fetch --tags + echo "HIGHS_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1) | sed 's/^v//')" >> $GITHUB_ENV + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "HIGHS_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV + echo "HIGHS_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV + else + echo "HIGHS_COMMIT=${{ github.sha }}" >> $GITHUB_ENV + echo "HIGHS_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV + fi + - run: | + julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' + julia --color=yes .github/julia/build_tarballs.jl ${{ matrix.triplet }} --verbose --deploy="local" + env: + BINARYBUILDER_AUTOMATIC_APPLE: true + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.triplet }} + path: ${{ github.workspace }}/products/* + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.triplet }}-jll + path: /home/runner/.julia/dev/HiGHS_jll + test: + runs-on: ${{ matrix.os }} + needs: build + strategy: + fail-fast: false + matrix: + include: + - triplet: 'x86_64-linux-gnu-cxx11' + os: 'ubuntu-latest' + arch: x64 + - triplet: 'aarch64-apple-darwin' + os: 'macos-14' + arch: aarch64 + - triplet: 'x86_64-w64-mingw32-cxx11' + os: 'windows-latest' + arch: x64 + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1.10" + arch: ${{ matrix.arch }} + # Download and setup the artifact + - uses: actions/download-artifact@v4 + with: + name: ${{ matrix.triplet }} + path: ${{ github.workspace }}/products + - shell: bash + run: tar -xzf products/HiGHS.*.${{ matrix.triplet }}.tar.gz -C products + # We also need to download the JLL package, because it contains the new + # dependencies + - uses: actions/download-artifact@v4 + with: + name: ${{ matrix.triplet }}-jll + path: ${{ github.workspace }}/HiGHS_jll + # We need to update the [compat] section in HiGHS to support HiGHS_jll + - shell: julia --color=yes {0} + run: | + using Pkg + Pkg.develop("HiGHS") + project_filename = joinpath(Pkg.devdir(), "HiGHS", "Project.toml") + project = read(project_filename, String) + write( + project_filename, + replace(project, r"HiGHS_jll = \"=.+?\"" => "HiGHS_jll = \"1\""), + ) + # Now we need to update the Artifacts.toml in the HiGHS_jll that we've + # downloaded. Otherwise Julia will try to download the default on install. + - shell: julia --color=yes {0} + run: | + import Pkg + file = joinpath(ENV["GITHUB_WORKSPACE"], "HiGHS_jll", "Artifacts.toml") + m = match(r"git-tree-sha1 = \"(.+?)\"", read(file, String)) + dir = escape_string(joinpath(ENV["GITHUB_WORKSPACE"], "products")) + write( + joinpath(homedir(), ".julia", "artifacts", "Overrides.toml"), + "$(m[1]) = \"$(dir)\"\n", + ) + Pkg.develop(; path = joinpath(ENV["GITHUB_WORKSPACE"], "HiGHS_jll")) + - shell: julia --color=yes {0} + run: | + import HiGHS_jll + file = joinpath(ENV["GITHUB_WORKSPACE"], "check", "instances", "flugpl.mps") + run(`$(HiGHS_jll.highs()) --solver=hipo $file`) + run(`$(HiGHS_jll.highs()) $file`) + - shell: julia --color=yes {0} + run: | + using Pkg + Pkg.test("HiGHS") diff --git a/CMakeLists.txt b/CMakeLists.txt index 84272a878e..06d6c675b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,9 +189,6 @@ endif() # HiPO deps if(HIPO) - # find_package(METIS REQUIRED) - # find_package(GKlib REQUIRED) - # does not work with outdated CMake include(FindHipoDeps) endif() diff --git a/cmake/FindHipoDeps.cmake b/cmake/FindHipoDeps.cmake index bd7cf6bcf4..52afa0a041 100644 --- a/cmake/FindHipoDeps.cmake +++ b/cmake/FindHipoDeps.cmake @@ -1,73 +1,34 @@ # BLAS -option(BLAS_ROOT "Root directory of BLAS or OpenBLAS" "") -message(STATUS "BLAS_ROOT is " ${BLAS_ROOT}) -if (WIN32) - - find_package(OpenBLAS CONFIG REQUIRED) - message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}") - - find_package(metis CONFIG REQUIRED) - message(STATUS "metis CMake config path: ${metis_DIR}") - - # find_package(gklib CONFIG REQUIRED) - # message(STATUS "gklib CMake config path: ${gklib_DIR}") -elseif(NOT APPLE) - # LINUX - find_library(OPENBLAS_LIB - NAMES openblas - HINTS "${BLAS_ROOT}/lib") - - if(OPENBLAS_LIB) - message("Found OpenBLAS library at ${OPENBLAS_LIB}") - - else(OPENBLAS_LIB) - find_library(BLAS_LIB - NAMES blas HINTS - "${BLAS_ROOT}/lib") - - if(NOT BLAS_LIB) - message(FATAL_ERROR "No BLAS library found") - endif(NOT BLAS_LIB) - message("Found BLAS library at ${BLAS_LIB}") - endif(OPENBLAS_LIB) +find_package(BLAS REQUIRED) +if(BLAS_FOUND) + message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}") + message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}") endif() -if (NOT WIN32) - # Find_package works if deps are installed with vcpkg. +# METIS +option(METIS_ROOT "Root directory of METIS" "") +message(STATUS "METIS_ROOT is " ${METIS_ROOT}) - # METIS - option(METIS_ROOT "Root directory of METIS" "") - message(STATUS "METIS_ROOT is " ${METIS_ROOT}) +find_package(metis CONFIG) - find_path(METIS_PATH - NAMES "metis.h" +if(metis_FOUND) + message(STATUS "metis CMake config path: ${metis_DIR}") +else() + find_path(METIS_PATH + NAMES "metis.h" REQUIRED - HINTS "${METIS_ROOT}/include") + PATHS "${METIS_ROOT}/include" + NO_DEFAULT_PATH) message("Found Metis header at ${METIS_PATH}") - find_library(METIS_LIB - NAMES metis + find_library(METIS_LIB + NAMES metis libmetis REQUIRED - HINTS "${METIS_ROOT}/lib") - message("Found Metis library at ${METIS_LIB}") - - # GKlib - option(GKLIB_ROOT "Root directory of GKlib" "") - message(STATUS "GKLIB_ROOT is " ${GKLIB_ROOT}) - - find_path(GKLIB_PATH - NAMES "GKlib.h" REQUIRED - HINTS "${GKLIB_ROOT}/include") - - message("Found GKlib header at ${GKLIB_PATH}") + PATHS "${METIS_ROOT}/lib" "${METIS_ROOT}/bin" + NO_DEFAULT_PATH) - find_library(GKLIB_LIB - NAMES GKlib - REQUIRED - HINTS "${GKLIB_ROOT}/lib") - - message("Found GKlib library at ${GKLIB_LIB}") -endif() \ No newline at end of file + message("Found Metis library at ${METIS_LIB}") +endif() diff --git a/docs/src/parallel.md b/docs/src/parallel.md index 1432f94131..e639ac691b 100644 --- a/docs/src/parallel.md +++ b/docs/src/parallel.md @@ -7,7 +7,7 @@ computing. When using a CPU, these are currently restricted to the dual simplex solver for LP, the factorisation-based interior point solver, and the MIP solver. Details of these and future plans are set out below. HiGHS has an implementation of a first order method (PDLP) for solving LPs -that can exploit the availability of a [GPU](@ref highs-gpu). +that can exploit the availability of a [GPU](@ref gpu). By default, when running in parallel, HiGHS will use half the available threads on a machine. This number can be modified by setting diff --git a/highs/CMakeLists.txt b/highs/CMakeLists.txt index d415deb959..d0032800d3 100644 --- a/highs/CMakeLists.txt +++ b/highs/CMakeLists.txt @@ -178,49 +178,27 @@ else() # Optional HIPO if (HIPO) - - target_include_directories(highs PRIVATE + target_include_directories(highs PRIVATE $ $ $ $ ) - - if(APPLE) - target_link_libraries(highs "-framework Accelerate") - target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS) - elseif(WIN32) - target_link_libraries(highs OpenBLAS::OpenBLAS) + target_link_libraries(highs BLAS::BLAS) + string(TOLOWER "${BLAS_LIBRARIES}" blas_lower) + if(blas_lower MATCHES "openblas") target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS) - target_link_libraries(highs metis) - # target_link_libraries(highs gklib) - else() - # LINUX - if(BLAS_LIB) - target_link_libraries(highs "${BLAS_LIB}") - elseif(OPENBLAS_LIB) - target_link_libraries(highs "${OPENBLAS_LIB}") - target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS) - else() - message(FATAL_ERROR "No BLAS library available") - endif(BLAS_LIB) - endif(APPLE) - - if (NOT WIN32) - # Find_package works if deps are installed with vcpkg. - - # Metis + elseif(blas_lower MATCHES "accelerate") + target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS) + endif() + if(metis_FOUND) + target_link_libraries(highs metis) + else() target_include_directories(highs PRIVATE "${METIS_PATH}") target_link_libraries(highs "${METIS_LIB}") - - # GKlib - target_include_directories(highs PRIVATE "${GKLIB_PATH}") - target_link_libraries(highs "${GKLIB_LIB}") endif() - endif() - if(MSVC) list(APPEND highs_compile_opts "/bigobj" # Allow big object diff --git a/highs/ipm/hipo/factorhighs/Analyse.cpp b/highs/ipm/hipo/factorhighs/Analyse.cpp index eb88daf17c..06fa449e89 100644 --- a/highs/ipm/hipo/factorhighs/Analyse.cpp +++ b/highs/ipm/hipo/factorhighs/Analyse.cpp @@ -7,7 +7,6 @@ #include "DataCollector.h" #include "FactorHiGHSSettings.h" -// #include "GKlib.h" #include "ReturnValues.h" #include "ipm/hipo/auxiliary/Auxiliary.h" #include "ipm/hipo/auxiliary/Log.h"