From f2b8d0e96a39b6038110ea89c9319556fab9f1cd Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Sat, 25 May 2024 00:33:43 -0400 Subject: [PATCH] Add libhsl.yml --- .github/julia/libhsl.jl | 1 - .github/workflows/libhsl.yml | 274 +++++++++++++++++++++++++++++++++++ .github/workflows/meson.yml | 61 +------- 3 files changed, 275 insertions(+), 61 deletions(-) delete mode 100644 .github/julia/libhsl.jl create mode 100644 .github/workflows/libhsl.yml diff --git a/.github/julia/libhsl.jl b/.github/julia/libhsl.jl deleted file mode 100644 index 11b4719134..0000000000 --- a/.github/julia/libhsl.jl +++ /dev/null @@ -1 +0,0 @@ -download(ENV["LIBHSL"], "libhsl.zip") diff --git a/.github/workflows/libhsl.yml b/.github/workflows/libhsl.yml new file mode 100644 index 0000000000..a7e1ce23d4 --- /dev/null +++ b/.github/workflows/libhsl.yml @@ -0,0 +1,274 @@ +name: libHSL +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: ${{ matrix.os }}/${{ matrix.compiler }}-v${{ matrix.version }}/Int${{ matrix.int }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-13] + arch: ['x64'] + version: ['11'] + int: ['32'] + include: + - compiler: gcc + - os: windows-latest + compiler: intel-classic + version: '2021.10' + int: '32' + - os: ubuntu-latest + compiler: intel-classic + version: '2021.10' + int: '32' + - os: windows-latest + compiler: intel + version: '2023.2' + int: '32' + - os: ubuntu-latest + compiler: intel + version: '2023.2' + int: '32' + # - os: ubuntu-latest + # compiler: nvidia-hpc + # version: '23.11' + # int: '32' + runs-on: ${{ matrix.os }} + steps: + - name: Check out GALAHAD + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Meson and Ninja + run: pip install meson ninja numpy + + - name: Set the environment variables GALAHAD, JULIA_GALAHAD_LIBRARY_PATH, DEPS and LIBDIR + shell: bash + run: | + echo "GALAHAD=$GITHUB_WORKSPACE" >> $GITHUB_ENV + echo "DEPS=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV + if [[ "${{matrix.os}}" == "ubuntu-latest" ]]; then + echo "LIBDIR=lib" >> $GITHUB_ENV + echo "JULIA_GALAHAD_LIBRARY_PATH=$GITHUB_WORKSPACE/galahad/lib" >> $GITHUB_ENV + fi + if [[ "${{matrix.os}}" == "macos-13" ]]; then + echo "LIBDIR=lib" >> $GITHUB_ENV + echo "JULIA_GALAHAD_LIBRARY_PATH=$GITHUB_WORKSPACE/galahad/lib" >> $GITHUB_ENV + fi + if [[ "${{matrix.os}}" == "windows-latest" ]]; then + echo "LIBDIR=bin" >> $GITHUB_ENV + echo "JULIA_GALAHAD_LIBRARY_PATH=$GITHUB_WORKSPACE/galahad/bin" >> $GITHUB_ENV + fi + + - name: Install dependencies + shell: bash + run: | + cd $DEPS + mkdir deps + PLATFORM="" + if [[ "${{matrix.os}}" == "ubuntu-latest" ]]; then + PLATFORM="x86_64-linux-gnu" + fi + if [[ "${{matrix.os}}" == "macos-13" ]]; then + PLATFORM="x86_64-apple-darwin" + fi + if [[ "${{matrix.os}}" == "windows-latest" ]]; then + PLATFORM="x86_64-w64-mingw32"/OpenBLAS_jll.jl/releases/download/OpenBLAS-v0.3.26%2B0/OpenBLAS.v0.3.26.$PLATFORM-libgfortran5.tar.gz + # tar -xzvf OpenBLAS.v0.3.26.$PLATFORM-libgfortran5.tar.gz -C deps + # fi + # wget https://github.com/JuliaBinaryWrappers/OpenBLAS32_jll.jl/releases/download/OpenBLAS32-v0.3.26%2B0/OpenBLAS32.v0.3.26.$PLATFORM-libgfortran5.tar.gz + # tar -xzvf OpenBLAS32.v0.3.26.$PLATFORM-libgfortran5.tar.gz -C deps + choco install wget + fi + + - name: Set the environment variables LIBRARY_PATH, LD_LIBRARY_PATH and DYLD_LIBRARY_PATH + if: matrix.os != 'windows-latest' + shell: bash + run: | + if [[ "${{matrix.os}}" == "ubuntu-latest" ]]; then + echo "LIBRARY_PATH=$LIBRARY_PATH:$GITHUB_WORKSPACE/galahad/lib:$GITHUB_WORKSPACE/../deps/lib" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/galahad/lib:$GITHUB_WORKSPACE/../deps/lib" >> $GITHUB_ENV + fi + if [[ "${{matrix.os}}" == "macos-13" ]]; then + echo "LIBRARY_PATH=$LIBRARY_PATH:$GITHUB_WORKSPACE/galahad/lib:$GITHUB_WORKSPACE/../deps/lib" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/galahad/lib:$GITHUB_WORKSPACE/../deps/lib" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GITHUB_WORKSPACE/galahad/lib:$GITHUB_WORKSPACE/../deps/lib" >> $GITHUB_ENV + echo "DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/intel/oneapi/compiler/2023.2.0/mac/compiler/lib" >> $GITHUB_ENV + fi + + - name: Set environment variables for OpenMP + if: matrix.os != 'windows-latest' + shell: bash + run: | + echo "OMP_CANCELLATION=TRUE" >> $GITHUB_ENV + echo "OMP_PROC_BIND=TRUE" >> $GITHUB_ENV + + - name: Install Julia + if: (matrix.int == '32') && !(matrix.os == 'windows-latest' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')) + uses: julia-actions/setup-julia@v2 + + - name: Install compilers + uses: fortran-lang/setup-fortran@main + with: + compiler: ${{ matrix.compiler }} + version: ${{ matrix.version }} + + - name: Update Intel compilers + if: matrix.compiler == 'intel' + shell: bash + run: echo "FC=ifort" >> $GITHUB_ENV + + # Uncomment this section to obtain ssh access to VM + # - name: Setup tmate session + # if: matrix.os == 'macos-13' + # uses: mxschmitt/action-tmate@v3 + + - name: Download libHSL + if: matrix.libhsl == 'true' + env: + LIBHSL: ${{ secrets.LIBHSL }} + shell: bash + run: | + curl -O ${LIBHSL} + unzip libhsl.zip + + - name: Setup libHSL + if: matrix.libhsl == 'true' + shell: bash + run: | + BLAS="blas" + LAPACK="lapack" + BLAS_PATH="" + LAPACK_PATH="" + SHARED_STATIC="shared" + if [[ ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) ]]; then + SHARED_STATIC="static" + fi + cd libHSL-* + meson setup builddir -Ddefault_library=${SHARED_STATIC} \ + --buildtype=debug \ + --prefix=$GITHUB_WORKSPACE/libhsl \ + -Dlibblas_path=${BLAS_PATH} \ + -Dliblapack_path=${LAPACK_PATH} \ + -Dlibblas=$BLAS \ + -Dliblapack=$LAPACK + + - name: Compile libHSL + if: matrix.libhsl == 'true' + shell: bash + run: meson compile -C builddir + + - name: Install libHSL + if: matrix.libhsl == 'true' + shell: bash + run: meson install -C builddir + + - name: Setup GALAHAD + shell: bash + run: | + CSTD="c99" + CPPSTD="c++11" + INT64="false" + SSIDS="true" + BLAS="openblas" + LAPACK="openblas" + BLAS_PATH="" + LAPACK_PATH="" + HSL_PATH="" + HSL_MODULES="" + PYTHON_INTERFACE="true" + SHARED_STATIC="shared" + LD_CLASSIC="" + if [[ "${{matrix.os}}" == "macos-13" ]]; then + LD_CLASSIC="-Wl,-ld_classic" + fi + if [[ "${{matrix.compiler}}" == "nvidia-hpc" ]]; then + CSTD="none" + CPPSTD="none" + BLAS="blas_lp64" + LAPACK="lapack_lp64" + BLAS_PATH="/opt/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/lib" + LAPACK_PATH="/opt/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/lib" + fi + if [[ "${{matrix.int}}" == "64" ]]; then + INT64="true" + BLAS="openblas64_" + LAPACK="openblas64_" + BLAS_PATH="$DEPS/deps/$LIBDIR" + LAPACK_PATH="$DEPS/deps/$LIBDIR" + fi + if [[ "${{matrix.libhsl}}" == "true" ]]; then + HSL_PATH="$GITHUB_WORKSPACE/libhsl/lib" + HSL_MODULES="$GITHUB_WORKSPACE/libhsl/modules" + fi + if [[ ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) ]]; then + SHARED_STATIC="static" + fi + if [[ ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "macos-13" ) ]]; then + PYTHON_INTERFACE="false" + fi + if [[ "${{matrix.compiler}}" == "nvidia-hpc" || "${{matrix.compiler}}" == "intel-classic" || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) ]]; then + SSIDS="false" + fi + + meson setup builddir -Ddefault_library=${SHARED_STATIC} \ + --buildtype=debug \ + --prefix=$GITHUB_WORKSPACE/galahad \ + -Dc_std=$CSTD \ + -Dcpp_std=$CPPSTD \ + -Dexamples=true \ + -Dtests=true \ + -Dssids=$SSIDS \ + -Dpythoniface=${PYTHON_INTERFACE} \ + -Dgalahad_int64=$INT64 \ + -Dlibblas_path=${BLAS_PATH} \ + -Dliblapack_path=${LAPACK_PATH} \ + -Dlibhsl_path=${HSL_PATH} \ + -Dlibhsl_modules=${HSL_MODULES} \ + -Dlibblas=$BLAS \ + -Dliblapack=$LAPACK \ + -Dfortran_link_args=${LD_CLASSIC} \ + -Dc_link_args=${LD_CLASSIC} + + - name: Build GALAHAD + shell: bash + run: | + meson compile -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_meson-log.txt + path: builddir/meson-logs/meson-log.txt + + - name: Install GALAHAD + shell: bash + run: | + meson install -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_install-log.txt + path: builddir/meson-logs/install-log.txt + + - name: Test GALAHAD + shell: bash + run: | + meson test -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_testlog.txt + path: builddir/meson-logs/testlog.txt + + - name: Test GALAHAD.jl + if: (matrix.int == '32') && !(matrix.os == 'windows-latest' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')) + shell: bash + run: julia --color=yes -e 'using Pkg; Pkg.develop(path="GALAHAD.jl"); Pkg.test("GALAHAD")' diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index dacd1407fa..8a121e927b 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -7,7 +7,7 @@ on: types: [opened, synchronize, reopened] jobs: build: - name: ${{ matrix.os }}/${{ matrix.compiler }}-v${{ matrix.version }}/Int${{ matrix.int }}/libHSL=${{ matrix.libhsl }} + name: ${{ matrix.os }}/${{ matrix.compiler }}-v${{ matrix.version }}/Int${{ matrix.int }} strategy: fail-fast: false matrix: @@ -15,59 +15,48 @@ jobs: arch: ['x64'] version: ['11'] int: ['32', '64'] - libhsl: ['false'] include: - compiler: gcc - os: windows-latest compiler: intel-classic version: '2021.10' int: '32' - libhsl: 'true' - os: windows-latest compiler: intel-classic version: '2021.10' int: '64' - libhsl: 'false' - os: ubuntu-latest compiler: intel-classic version: '2021.10' int: '32' - libhsl: 'true' - os: ubuntu-latest compiler: intel-classic version: '2021.10' int: '64' - libhsl: 'false' - os: windows-latest compiler: intel version: '2023.2' int: '32' - libhsl: 'true' - os: windows-latest compiler: intel version: '2023.2' int: '64' - libhsl: 'false' - os: ubuntu-latest compiler: intel version: '2023.2' int: '32' - libhsl: 'true' - os: ubuntu-latest compiler: intel version: '2023.2' int: '64' - libhsl: 'false' # - os: ubuntu-latest # compiler: nvidia-hpc # version: '23.11' # int: '32' - # libhsl: 'true' # - os: ubuntu-latest # compiler: nvidia-hpc # version: '23.11' # int: '64' - # libhsl: 'false' runs-on: ${{ matrix.os }} steps: - name: Check out GALAHAD @@ -167,46 +156,6 @@ jobs: # if: matrix.os == 'macos-13' # uses: mxschmitt/action-tmate@v3 - - name: Download libHSL - if: matrix.libhsl == 'true' - env: - LIBHSL: ${{ secrets.LIBHSL }} - shell: bash - run: | - julia --color=yes .github/julia/libhsl.jl - unzip libhsl.zip - - - name: Setup libHSL - if: matrix.libhsl == 'true' - shell: bash - run: | - BLAS="blas" - LAPACK="lapack" - BLAS_PATH="" - LAPACK_PATH="" - SHARED_STATIC="shared" - if [[ ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) ]]; then - SHARED_STATIC="static" - fi - cd libHSL-* - meson setup builddir -Ddefault_library=${SHARED_STATIC} \ - --buildtype=debug \ - --prefix=$GITHUB_WORKSPACE/libhsl \ - -Dlibblas_path=${BLAS_PATH} \ - -Dliblapack_path=${LAPACK_PATH} \ - -Dlibblas=$BLAS \ - -Dliblapack=$LAPACK - - - name: Compile libHSL - if: matrix.libhsl == 'true' - shell: bash - run: meson compile -C builddir - - - name: Install libHSL - if: matrix.libhsl == 'true' - shell: bash - run: meson install -C builddir - - name: Setup GALAHAD shell: bash run: | @@ -218,8 +167,6 @@ jobs: LAPACK="openblas" BLAS_PATH="" LAPACK_PATH="" - HSL_PATH="" - HSL_MODULES="" PYTHON_INTERFACE="true" SHARED_STATIC="shared" LD_CLASSIC="" @@ -241,10 +188,6 @@ jobs: BLAS_PATH="$DEPS/deps/$LIBDIR" LAPACK_PATH="$DEPS/deps/$LIBDIR" fi - if [[ "${{matrix.libhsl}}" == "true" ]]; then - HSL_PATH="$GITHUB_WORKSPACE/libhsl/lib" - HSL_MODULES="$GITHUB_WORKSPACE/libhsl/modules" - fi if [[ ( "${{matrix.compiler}}" == "intel-classic" && "${{matrix.os}}" == "windows-latest" ) || ( "${{matrix.compiler}}" == "intel" && "${{matrix.os}}" == "windows-latest" ) ]]; then SHARED_STATIC="static" fi @@ -267,8 +210,6 @@ jobs: -Dgalahad_int64=$INT64 \ -Dlibblas_path=${BLAS_PATH} \ -Dliblapack_path=${LAPACK_PATH} \ - -Dlibhsl_path=${HSL_PATH} \ - -Dlibhsl_modules=${HSL_MODULES} \ -Dlibblas=$BLAS \ -Dliblapack=$LAPACK \ -Dfortran_link_args=${LD_CLASSIC} \