Build OpenBLAS #165
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: Build OpenBLAS | |
on: | |
schedule: | |
- cron: "0 12 1/5 * *" | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
# OpenBLAS builds | |
# - 939452ea9dcb57abdcc3f1278c6db668a4690465 <= Fast and works, but there might be a bug? | |
jobs: | |
openblas_linux: | |
name: Build OpenBLAS on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract Branch Name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Set Up Miniconda | |
uses: conda-incubator/[email protected] | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Get Latest CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: Install Conda Packages | |
if: matrix.platform == 'windows-latest' | |
run: | | |
conda config --add channels conda-forge --force | |
conda config --set auto_update_conda false | |
conda install --yes --quiet clangdev cmake ninja flang=11.0.1 | |
# -DBUILD_SHARED_LIBS=ON | |
- name: Configure CMake | |
run: | | |
cd OpenBLAS | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_MT=mt -DBUILD_SHARED_LIBS=ON -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DBINARY=64 -DNUM_THREADS=256 -DUSE_THREAD=1 -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL' -DTARGET=NEHALEM -DCMAKE_BUILD_TYPE=Release | |
- name: Build OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --build . --config Release | |
- name: Install OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --install . --config Release --prefix ../../openblas-ubuntu-latest | |
- name: Push Changes | |
continue-on-error: true | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "[email protected]" | |
git pull | |
git add -A | |
git commit -m "Update OpenBLAS on Ubuntu" | |
git push origin master | |
- name: Archive OpenBLAS Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenBLAS on Ubuntu | |
path: openblas-ubuntu-latest | |
openblas_macos: | |
name: Build OpenBLAS on MacOS | |
runs-on: macos-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Get latest CMake and ninja | |
uses: lukka/get-cmake@latest | |
- name: Setup GNU Fortran | |
uses: modflowpy/install-gfortran-action@v1 | |
- name: Configure CMake | |
run: | | |
cd OpenBLAS | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_MT=mt -DBINARY=64 -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DNUM_THREADS=256 -DUSE_THREAD=1 -DMAX_STACK_ALLOC=4096 -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL;ZEN' -DTARGET=NEHALEM -DCMAKE_BUILD_TYPE=Release | |
- name: Build OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --build . --config Release | |
env: | |
CC: gcc-11 | |
CXX: g++-11 | |
- name: Install OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --install . --config Release --prefix ../../openblas-macos-latest | |
- name: Push Changes | |
continue-on-error: true | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "[email protected]" | |
git pull | |
git add -A | |
git commit -m "Update OpenBLAS on MacOS" | |
git push origin master | |
- name: Archive OpenBLAS Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenBLAS on MacOS | |
path: openblas-macos-latest | |
openblas_windows: | |
name: Build OpenBLAS on Windows | |
runs-on: windows-latest | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Set Up Miniconda | |
uses: conda-incubator/[email protected] | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Get Latest CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: Install Conda Packages | |
run: | | |
conda config --add channels conda-forge --force | |
conda config --set auto_update_conda false | |
conda install --yes --quiet clangdev cmake ninja flang=11.0.1 | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
# - name: Configure CMake | |
# run: | | |
# cd OpenBLAS | |
# mkdir build | |
# cd build | |
# cmake .. -G "Ninja" -DCMAKE_MT=mt -DBUILD_SHARED_LIBS=ON -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DBINARY=64 -DINTERFACE64=1 -DNUM_THREADS=256 -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL' -DTARGET=NEHALEM -DCMAKE_BUILD_TYPE=Release | |
# env: | |
# CC: clang | |
# CXX: clang | |
- name: Configure CMake | |
run: | | |
cd OpenBLAS | |
mkdir build | |
cd build | |
$commonArgs = "-DCMAKE_MT=mt -DBUILD_SHARED_LIBS=ON -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DBINARY=64 -DINTERFACE64=1 -DNUM_THREADS=256 -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL' -DTARGET=NEHALEM -DCMAKE_BUILD_TYPE=Release" | |
$env:CC = "clang" | |
$env:CXX = "clang" | |
$vs2022 = $false | |
$vs2019 = $false | |
$ninja = $false | |
try { | |
cmake .. -G "Visual Studio 17 2022" $commonArgs | |
$vs2022 = $true | |
} catch { | |
Write-Host "Visual Studio 2022 generator failed." | |
} | |
if (-Not $vs2022) { | |
try { | |
cmake .. -G "Visual Studio 16 2019" $commonArgs | |
$vs2019 = $true | |
} catch { | |
Write-Host "Visual Studio 2019 generator failed." | |
} | |
} | |
if (-Not $vs2022 -And -Not $vs2019) { | |
try { | |
cmake .. -G "Ninja" $commonArgs | |
$ninja = $true | |
} catch { | |
Write-Host "Ninja generator failed." | |
} | |
} | |
if (-Not $vs2022 -And -Not $vs2019 -And -Not $ninja) { | |
Write-Host "All generators failed." | |
exit 1 | |
} | |
env: | |
CC: clang | |
CXX: clang | |
- name: Build OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --build . --config Release | |
- name: Install OpenBLAS | |
run: | | |
cd OpenBLAS | |
cd build | |
cmake --install . --config Release --prefix ../../openblas-windows-latest | |
- name: Push Changes | |
continue-on-error: true | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "[email protected]" | |
git pull | |
git add -A | |
git commit -m "Update OpenBLAS on Windows" | |
git push origin master | |
- name: Archive OpenBLAS Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenBLAS on windows-latest | |
path: openblas-windows-latest | |
# jobs: | |
# compile: | |
# name: Build OpenBLAS on ${{ matrix.platform }} | |
# runs-on: ${{ matrix.platform }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# include: | |
# - platform: ubuntu-latest | |
# cc: gcc-11 | |
# cxx: g++-11 | |
# shell: bash | |
# - platform: macos-latest | |
# cc: gcc-11 | |
# cxx: g++-11 | |
# shell: bash | |
# - platform: windows-latest | |
# cc: clang | |
# cxx: clang++ | |
# shell: msys2 {0} | |
# defaults: | |
# run: | |
# shell: ${{ matrix.shell }} | |
# steps: | |
# - name: Extract branch name | |
# shell: bash | |
# run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
# id: extract_branch | |
# - name: Checkout Code | |
# uses: actions/checkout@v3 | |
# with: | |
# submodules: recursive | |
# ref: ${{ steps.extract_branch.outputs.branch }} | |
# # - name: Install Conda Packages | |
# # if: matrix.platform == 'windows-latest' | |
# # run: | | |
# # conda config --add channels conda-forge --force | |
# # conda config --set auto_update_conda false | |
# # conda install --yes --quiet clangdev cmake ninja flang=11.0.1 | |
# - name: Install build dependencies | |
# if: matrix.platform == 'windows-latest' | |
# uses: msys2/setup-msys2@v2 | |
# with: | |
# msystem: CLANG64 | |
# update: true | |
# release: false # Use pre-installed version | |
# install: >- | |
# base-devel | |
# mingw-w64-clang-x86_64-cc | |
# mingw-w64-clang-x86_64-cmake | |
# mingw-w64-clang-x86_64-ninja | |
# mingw-w64-clang-x86_64-ccache | |
# mingw-w64-clang-x86_64-flang | |
# # - name: Set Up Python | |
# # uses: actions/setup-python@v4 | |
# # with: | |
# # python-version: 3.8 | |
# # - name: Get Latest CMake and Ninja | |
# # uses: lukka/get-cmake@latest | |
# # - name: Setup GNU Fortran | |
# # uses: modflowpy/install-gfortran-action@v1 | |
# - name: Add Clang to PATH | |
# if: matrix.platform == 'windows-latest' | |
# run: | | |
# echo "C:\msys64\clang64\bin" >> $GITHUB_PATH | |
# # Taken from OpenBLAS's cmake configuration | |
# - name: Compilation cache | |
# if: matrix.platform == 'windows-latest' | |
# uses: actions/cache@v3 | |
# with: | |
# path: C:/msys64/home/runneradmin/.ccache | |
# key: ccache-msys2-CLANG64-Release-${{ github.ref }}-${{ github.sha }} | |
# restore-keys: | | |
# ccache-msys2-CLANG64-Release-${{ github.ref }} | |
# ccache-msys2-CLANG64-Release | |
# - name: Configure ccache | |
# if: matrix.platform == 'windows-latest' | |
# run: | | |
# which ccache | |
# test -d ~/.ccache || mkdir -p ~/.ccache | |
# echo "max_size = 250M" > ~/.ccache/ccache.conf | |
# echo "compression = true" >> ~/.ccache/ccache.conf | |
# ccache -s | |
# echo $HOME | |
# cygpath -w $HOME | |
# - name: Configure CMake (Windows Only) | |
# if: matrix.platform == 'windows-latest' | |
# run: | | |
# cd OpenBLAS | |
# mkdir build | |
# cd build | |
# cmake .. -DCMAKE_MT=mt \ | |
# -DBUILD_SHARED_LIBS=ON \ | |
# -DBUILD_WITHOUT_LAPACK=no \ | |
# -DNOFORTRAN=0 \ | |
# -DBINARY=64 \ | |
# -DNUM_THREADS=256 \ | |
# -DDYNAMIC_ARCH=ON \ | |
# -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL' \ | |
# -DTARGET=NEHALEM \ | |
# -DCMAKE_BUILD_TYPE=Release \ | |
# -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
# -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache | |
# - name: Configure CMake (Linux and OSX Only) | |
# if: matrix.platform != 'windows-latest' | |
# run: | | |
# cd OpenBLAS | |
# mkdir build | |
# cd build | |
# cmake .. -DCMAKE_MT=mt \ | |
# -DBUILD_SHARED_LIBS=ON \ | |
# -DBUILD_WITHOUT_LAPACK=no \ | |
# -DNOFORTRAN=0 \ | |
# -DBINARY=64 \ | |
# -DNUM_THREADS=256 \ | |
# -DDYNAMIC_ARCH=ON \ | |
# -DDYNAMIC_LIST='CORE2;NEHALEM;SANDYBRIDGE;BULLDOZER;HASWELL' \ | |
# -DTARGET=NEHALEM \ | |
# -DCMAKE_BUILD_TYPE=Release | |
# env: | |
# CC: ${{ matrix.cc }} | |
# CXX: ${{ matrix.cxx }} | |
# - name: Build OpenBLAS | |
# run: | | |
# cd OpenBLAS | |
# cd build | |
# cmake --build . --config Release | |
# env: | |
# CC: ${{ matrix.cc }} | |
# CXX: ${{ matrix.cxx }} | |
# - name: Install OpenBLAS | |
# run: | | |
# cd OpenBLAS | |
# cd build | |
# cmake --install . --config Release --prefix ../../openblas-${{ matrix.platform }} | |
# env: | |
# CC: ${{ matrix.cc }} | |
# CXX: ${{ matrix.cxx }} | |
# - name: Push Changes | |
# continue-on-error: true | |
# run: | | |
# git config --global user.name "github-actions[bot]" | |
# git config --global user.email "[email protected]" | |
# git pull | |
# git add -A | |
# git commit -m "Update OpenBLAS on Ubuntu" | |
# git push origin master | |
# - name: Archive OpenBLAS Build | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: OpenBLAS on Ubuntu | |
# path: openblas-ubuntu-latest |