Skip to content

CHOLMOD: Automatically look for additional dependency in downstream projects if building with CUDA #310

CHOLMOD: Automatically look for additional dependency in downstream projects if building with CUDA

CHOLMOD: Automatically look for additional dependency in downstream projects if building with CUDA #310

Workflow file for this run

name: build
on:
push:
branches-ignore:
- '**/dev2'
pull_request:
concurrency: ci-${{ github.ref }}
env:
# string with name of libraries to be built
BUILD_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:RBio:SuiteSparse_GPURuntime:GPUQREngine:SPQR:GraphBLAS:SPEX"
# string with name of libraries to be checked
CHECK_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:RBio:SPQR:GraphBLAS:SPEX"
jobs:
ubuntu:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
compiler: [gcc, clang]
include:
- compiler: gcc
compiler-pkgs: "g++ gcc"
cc: "gcc"
cxx: "g++"
- compiler: clang
compiler-pkgs: "clang libomp-dev"
cc: "clang"
cxx: "clang++"
# Clang seems to generally require less cache size (smaller object files?).
- compiler: gcc
ccache-max: 600M
- compiler: clang
ccache-max: 500M
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
env:
COMPILER_PKGS: ${{ matrix.compiler-pkgs }}
run: |
sudo apt -qq update
sudo apt install -y ${COMPILER_PKGS} autoconf automake ccache cmake \
dvipng gfortran libgmp-dev liblapack-dev libmpfr-dev \
libopenblas-dev
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:ubuntu:${{ matrix.compiler }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v3
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:ubuntu:${{ matrix.compiler }}:${{ github.ref }}
ccache:ubuntu:${{ matrix.compiler }}
- name: configure ccache
env:
CCACHE_MAX: ${{ matrix.ccache-max }}
run: |
test -d ~/.ccache || mkdir ~/.ccache
echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
ccache -s
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: build
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n"
echo "::group::Configure $lib"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="OpenBLAS" \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
- name: check
run: |
IFS=':' read -r -a libs <<< "${CHECK_LIBS}"
for lib in "${libs[@]}"; do
printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}
make demos
echo "::endgroup::"
done
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v3
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake --install .
echo "::endgroup::"
done
- name: build example
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DBLA_VENDOR="OpenBLAS" \
..
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
cmake --build .
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo
echo "::endgroup::"
macos:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: macos-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
# Homebrew's Python conflicts with the Python that comes pre-installed
# on the GitHub runners. Some of SuiteSparse's dependencies depend on
# different versions of Homebrew's Python. Enforce using the ones from
# Homebrew to avoid errors on updates.
# See: https://github.com/orgs/Homebrew/discussions/3928
# It looks like "gfortran" isn't working correctly unless "gcc" is
# re-installed.
run: |
brew update
brew install --overwrite [email protected] [email protected]
brew reinstall gcc
brew install autoconf automake ccache cmake gmp lapack libomp mpfr openblas
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:macos-latest:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:macos-latest:${{ github.ref }}
ccache:macos-latest
- name: configure ccache
# Limit the maximum size to avoid exceeding the total cache limits.
run: |
test -d /Users/runner/Library/Preferences/ccache || mkdir /Users/runner/Library/Preferences/ccache
echo "max_size = 300M" >> /Users/runner/Library/Preferences/ccache/ccache.conf
ccache -s
- name: build
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n"
echo "::group::Configure $lib"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="OpenBLAS" \
-DCMAKE_PREFIX_PATH="/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/opt/libomp" \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
- name: check
run: |
IFS=':' read -r -a libs <<< "${CHECK_LIBS}"
for lib in "${libs[@]}"; do
printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}
make demos
echo "::endgroup::"
done
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake --install .
echo "::endgroup::"
done
- name: build example
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DCMAKE_PREFIX_PATH="/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/opt/libomp" \
..
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
cmake --build .
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
./my_demo
echo "::endgroup::"
mingw:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-latest
defaults:
run:
# Use MSYS2 as default shell
shell: msys2 {0}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
msystem: [MINGW64, MINGW32, CLANG64, CLANG32]
include:
- msystem: MINGW64
target-prefix: mingw-w64-x86_64
f77-package: mingw-w64-x86_64-fc
- msystem: MINGW32
target-prefix: mingw-w64-i686
f77-package: mingw-w64-i686-fc
- msystem: CLANG64
target-prefix: mingw-w64-clang-x86_64
f77-package: mingw-w64-clang-x86_64-fc
- msystem: CLANG32
target-prefix: mingw-w64-clang-i686
# There's no Fortran compiler for this environment.
f77-package: mingw-w64-clang-i686-cc
env:
CHERE_INVOKING: 1
steps:
- name: get CPU name
shell: pwsh
run : |
Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name
- name: install MSYS2 build environment
uses: msys2/setup-msys2@v2
with:
update: true
# Use pre-installed version to save disc space on partition with source.
release: false
install: >-
base-devel
${{ matrix.target-prefix }}-autotools
${{ matrix.target-prefix }}-cmake
${{ matrix.target-prefix }}-cc
${{ matrix.f77-package }}
${{ matrix.target-prefix }}-ccache
${{ matrix.target-prefix }}-openblas
${{ matrix.target-prefix }}-omp
${{ matrix.target-prefix }}-gmp
${{ matrix.target-prefix }}-mpfr
msystem: ${{ matrix.msystem }}
- name: checkout repository
uses: actions/checkout@v3
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT
echo "key=ccache:mingw:${{ matrix.msystem }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# Setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:mingw:${{ matrix.msystem }}:${{ github.ref }}
ccache:mingw:${{ matrix.msystem }}
- name: configure ccache
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
run: |
which ccache
test -d ${{ steps.ccache_cache_timestamp.outputs.ccachedir }} || mkdir -p ${{ steps.ccache_cache_timestamp.outputs.ccachedir }}
echo "max_size = 250M" > ${{ steps.ccache_cache_timestamp.outputs.ccachedir }}/ccache.conf
echo "compression = true" >> ${{ steps.ccache_cache_timestamp.outputs.ccachedir }}/ccache.conf
ccache -p
ccache -s
- name: build
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n"
echo "::group::Configure $lib"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="OpenBLAS" \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
- name: check
# Need to install the libraries for the tests
run: |
echo "::group::Install libraries"
make install
echo "::endgroup::"
IFS=':' read -r -a libs <<< "${CHECK_LIBS}"
for lib in "${libs[@]}"; do
printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}
PATH="${GITHUB_WORKSPACE}/bin:${PATH}" \
make demos
echo "::endgroup::"
done
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
- name: build example
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DCMAKE_MODULE_PATH="${MINGW_PREFIX}/lib/cmake/SuiteSparse" \
..
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
cmake --build .
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
PATH="${GITHUB_WORKSPACE}/bin:${PATH}" \
./my_demo
echo "::endgroup::"
msvc:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-latest
defaults:
run:
# Use bash as default shell
shell: bash -el {0}
env:
CHERE_INVOKING: 1
steps:
- name: get CPU name
shell: pwsh
run : |
Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name
- name: checkout repository
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: cache conda packages
id: conda-cache
uses: actions/cache/restore@v3
with:
path: C:/Miniconda/envs/test
key: conda:msvc
- name: install packages with conda
if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }}
run: |
echo ${{ steps.conda-cache.outputs.cache-hit }}
conda info
conda list
conda install -y -c intel mkl-devel
conda install -y -c conda-forge --override-channels ccache
- name: save conda cache
if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: C:/Miniconda/envs/test
key: ${{ steps.conda-cache.outputs.cache-primary-key }}
- name: install libraries from MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
# Use pre-installed version to save disc space on partition with source.
release: false
install: >-
mingw-w64-ucrt-x86_64-gmp
mingw-w64-ucrt-x86_64-mpfr
msystem: UCRT64
- name: setup build environment
# get packages from MSYS2
# Copy only relevant parts to avoid picking up headers and libraries
# that are thought for MinGW only.
run: |
mkdir -p ./dependencies/{bin,lib,include}
# GMP
cp C:/msys64/ucrt64/bin/libgmp*.dll ./dependencies/bin/
cp C:/msys64/ucrt64/include/gmp.h ./dependencies/include/
cp C:/msys64/ucrt64/lib/libgmp.dll.a ./dependencies/lib/gmp.lib
# MPFR
cp C:/msys64/ucrt64/bin/libmpfr*.dll ./dependencies/bin/
cp C:/msys64/ucrt64/include/mpf2mpfr.h ./dependencies/include/
cp C:/msys64/ucrt64/include/mpfr.h ./dependencies/include/
cp C:/msys64/ucrt64/lib/libmpfr.dll.a ./dependencies/lib/mpfr.lib
# run-time dependencies
cp C:/msys64/ucrt64/bin/libgcc_s_seh*.dll ./dependencies/bin/
cp C:/msys64/ucrt64/bin/libwinpthread*.dll ./dependencies/bin/
# create environment variable for easier access
echo "CCACHE=C:/Miniconda/envs/test/Library/bin/ccache.exe" >> ${GITHUB_ENV}
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
shell: msys2 {0}
run: |
echo "ccachedir=$(cygpath -m $(${CCACHE} -k cache_dir))" >> $GITHUB_OUTPUT
echo "key=ccache:msvc:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# Setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:msvc:${{ github.ref }}
ccache:msvc
- name: configure ccache
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
run: |
test -d ${{ steps.ccache-prepare.outputs.ccachedir }} || mkdir -p ${{ steps.ccache-prepare.outputs.ccachedir }}
echo "max_size = 250M" > ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf
echo "compression = true" >> ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf
${CCACHE} -p
${CCACHE} -s
- name: setup MSVC toolchain
uses: ilammy/msvc-dev-cmd@v1
- name: build
# The default generator doesn't use ccache. Use "Ninja Multi-Config" generator instead.
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n"
echo "::group::Configure $lib"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake -G"Ninja Multi-Config" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_PREFIX_PATH="C:/Miniconda/envs/test/Library;${GITHUB_WORKSPACE}/dependencies" \
-DCMAKE_C_COMPILER_LAUNCHER=${CCACHE} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE} \
-DCMAKE_Fortran_COMPILER_LAUNCHER=${CCACHE} \
-DNFORTRAN=ON \
-DBLA_VENDOR="All" \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
# FIXME: Run demos after building
- name: ccache status
continue-on-error: true
run: ${CCACHE} -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake --install .
echo "::endgroup::"
done
- name: build example
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DCMAKE_PREFIX_PATH="C:/Miniconda/envs/test/Library;${GITHUB_WORKSPACE}/dependencies" \
-DBLA_VENDOR="All" \
..
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
cmake --build . --config Release
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
PATH="${GITHUB_WORKSPACE}/bin;${GITHUB_WORKSPACE}/dependencies/bin;${PATH}" ./Release/my_demo
echo "::endgroup::"