Skip to content

v1.1.6: github workflows and cmake build system revisions #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: stable
Choose a base branch
from
88 changes: 88 additions & 0 deletions .github/workflows/build-arch-emu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: arch-emu

# this workflow takes a long time, so do it on dispatch only

on:
workflow_dispatch:

jobs:

alpine:
# Run armv7 on aarch64 runners
runs-on: ${{ matrix.arch == 'armv7' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}

defaults:
run:
# Use emulated shell as default
shell: alpine.sh {0}

strategy:
matrix:
config:
# FIXME: switch to 10.1.0 when it is released:
- {grb_version: 10.0.5}
# For available CPU architectures, see:
# https://github.com/marketplace/actions/setup-alpine-linux-environment
arch: [riscv64]
include:
- arch: riscv64
ccache-max: 28M

name: alpine (${{ matrix.arch }})

steps:
- name: get CPU information (host)
shell: bash
run: lscpu

- name: checkout repository
uses: actions/checkout@v4
# shell: bash

- name: install dependencies
uses: jirutka/setup-alpine@v1
# shell: bash
with:
arch: ${{ matrix.arch }}
apk-tools-url: ${{ matrix.arch == 'armv7'
&& 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878'
|| 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' }}
packages: >
build-base
ccache
cmake
lscpu
libtool
git
sudo

- name: disable QEMU emulation
if: matrix.arch == 'armv7'
shell: bash
run: sudo update-binfmts --disable qemu-arm

- name: get CPU information (emulated)
run: lscpu

- name: build GraphBLAS
run: |
echo "gcc --version"
gcc --version
echo "gcc -dumpmachine"
gcc -dumpmachine
git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git
cd GraphBLAS
# FIXME: switch to 10.1.0 when it is released:
# git checkout tags/v${{ matrix.config.grb_version }}
git checkout dev2
make compact
sudo make install
cd ..

- name: build and test LAGraph
run: |
cd build
cmake ..
JOBS=2 make
ctest . --verbose

36 changes: 27 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ on:
pull_request:

jobs:

linux:

runs-on: ubuntu-22.04

strategy:
matrix:
config:
# if there are multiple items in this list, only use should
# deployit=true for just one of them.
- {grb_version: 9.3.1, deployit: true}
- {grb_version: 9.0.0, deployit: false}
- {grb_version: 10.0.5, deployit: true}

steps:

- name: Checkout
uses: actions/[email protected]

- name: Install tools for build
run: |
sudo apt install -y lcov

- name: Build GraphBLAS
run: |
git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git
Expand All @@ -30,40 +38,50 @@ jobs:
make compact
sudo make install
cd ..

- name: Build project
run: |
export GRAPHBLAS_INCLUDE_DIR=`pwd`/GraphBLAS/include/suitesparse
export GRAPHBLAS_LIBRARY=`pwd`/GraphBLAS/lib/libgraphblas.so
cd build
cmake .. -DCOVERAGE=1 -DGRAPHBLAS_INCLUDE_DIR=${GRAPHBLAS_INCLUDE_DIR} -DGRAPHBLAS_LIBRARY=${GRAPHBLAS_LIBRARY}
cmake .. -DCOVERAGE=1
JOBS=2 make
make test_coverage

- name: Deploy
uses: JamesIves/[email protected]
if: matrix.config.deployit && github.event_name == 'push' && github.ref == 'refs/heads/stable'
with:
branch: gh-pages
folder: build/test_coverage/
single-commit: true

- name: Save output
uses: actions/[email protected]
if: matrix.config.deployit
with:
name: test_coverage
path: build/test_coverage/

macos:

runs-on: macos-14

strategy:
matrix:
config:
- {grb_version: 9.3.1}
- {grb_version: 9.0.0}
- {grb_version: 10.0.5}

steps:

- name: Checkout
uses: actions/[email protected]

- name: Install dependencies
run: |
brew tap-new libomp/cask
brew extract --version=14.0.6 libomp libomp/cask
brew install [email protected]

- name: Build GraphBLAS
run: |
git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git
Expand All @@ -72,13 +90,13 @@ jobs:
make compact
sudo make install
cd ..

- name: Build project
run: |
export GRAPHBLAS_INCLUDE_DIR=`pwd`/GraphBLAS/include/suitesparse
export GRAPHBLAS_LIBRARY=`pwd`/GraphBLAS/lib/libgraphblas.dylib
# adding an extra line to the CMakeLists.txt file to locate the libomp instance installed by brew
echo 'include_directories("/usr/local/opt/libomp/include")' | cat - CMakeLists.txt
cd build
CC=gcc cmake .. -DGRAPHBLAS_INCLUDE_DIR=${GRAPHBLAS_INCLUDE_DIR} -DGRAPHBLAS_LIBRARY=${GRAPHBLAS_LIBRARY}
cmake ..
JOBS=2 make
make test
ctest .

37 changes: 35 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
cmake_minimum_required ( VERSION 3.20 ) # LAGraph can be built stand-alone

# version of LAGraph
set ( LAGraph_DATE "Feb 20, 2025" )
set ( LAGraph_DATE "May 14, 2025" )
set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE )
set ( LAGraph_VERSION_MINOR 1 CACHE STRING "" FORCE )
set ( LAGraph_VERSION_SUB 5 CACHE STRING "" FORCE )
set ( LAGraph_VERSION_SUB 6 CACHE STRING "" FORCE )

message ( STATUS "Building LAGraph version: v"
${LAGraph_VERSION_MAJOR}.
Expand Down Expand Up @@ -127,6 +127,7 @@ endif ( )

if ( SUITESPARSE_ROOT_CMAKELISTS )

message ( STATUS "Looking for GraphBLAS in SuiteSparse" )
if ( TARGET GraphBLAS )
add_library ( GraphBLAS::GraphBLAS ALIAS GraphBLAS )
else ( )
Expand All @@ -153,6 +154,7 @@ else ( )
# No package version is explicitly stated here; an arbitrary GraphBLAS
# library can have any version number. For SuiteSparse:GraphBLAS, LAGraph
# requires v7.1.0 or later, which is checked in LAGraph.h.
message ( STATUS "Looking for GraphBLAS with FindGraphBLAS.cmake" )
find_package ( GraphBLAS MODULE REQUIRED )

endif ( )
Expand Down Expand Up @@ -247,6 +249,10 @@ elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" )
#if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0 )
# message ( FATAL_ERROR "icc version must be at least 18.0" )
#endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" )
# options for Apple Clang
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" )
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread" )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" )
# options for clang
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 " )
Expand Down Expand Up @@ -287,6 +293,7 @@ message ( STATUS "CMAKE C flags: " ${CMAKE_C_FLAGS} )
# enable testing and add subdirectories
#-------------------------------------------------------------------------------

set ( MEMORYCHECK_COMMAND_OPTIONS "--show-reachable=no" )
include ( CTest )

add_subdirectory ( src )
Expand Down Expand Up @@ -317,6 +324,31 @@ if ( BUILD_STATIC_LIBS )
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
endif ( )

#-------------------------------------------------------------------------------
# LAGraph uses OpenMP by default
#-------------------------------------------------------------------------------

if ( LAGRAPH_HAS_OPENMP )
message ( STATUS "CMAKE OpenMP libraries: ${OpenMP_C_LIBRARIES}" )
message ( STATUS "CMAKE OpenMP include: ${OpenMP_C_INCLUDE_DIRS}" )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( LAGraph PRIVATE OpenMP::OpenMP_C )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( LAGraph_static PRIVATE OpenMP::OpenMP_C )
endif ( )
message ( STATUS "CMAKE OpenMP C flags: ${OpenMP_C_FLAGS}" )
else ( )
if ( NOT COVERAGE )
message ( WARNING
"WARNING: OpenMP was not found (or was disabled with "
"LAGRAPH_USE_OPENMP; some LAGraph methods will be slow.)" )
endif ( )
endif ( )

#-------------------------------------------------------------------------------
# LAGraph targets and package configuration
#-------------------------------------------------------------------------------

# create (temporary) export target file during build
export ( EXPORT LAGraphTargets
Expand Down Expand Up @@ -424,3 +456,4 @@ if ( NOT MSVC )
${CMAKE_CURRENT_BINARY_DIR}/LAGraph.pc
DESTINATION ${SUITESPARSE_PKGFILEDIR}/pkgconfig )
endif ( )

2 changes: 1 addition & 1 deletion cmake_modules/FindGraphBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ endif ( )

# Create target from information found

if ( GRAPHBLAS_LIBRARY )
if ( GRAPHBLAS_FOUND )
message ( STATUS "Create target GraphBLAS::GraphBLAS" )
# Get library name from filename of library
# This might be something like:
Expand Down
17 changes: 14 additions & 3 deletions cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake
#-------------------------------------------------------------------------------

# Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved.
# Copyright (c) 2022-2025, Timothy A. Davis. All Rights Reserved.
# SPDX-License-Identifier: BSD-3-clause

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -111,10 +111,10 @@ endif ( )
# readability (such as "/* do nothing */ ;" in SuiteSparse_config.c). Disable
# the clang warning for these statements:
if ( CMAKE_C_COMPILER_ID STREQUAL "Clang" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-extra-semi-stmt" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-extra-semi" )
endif ( )
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-extra-semi-stmt" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-extra-semi" )
endif ( )

if ( WIN32 )
Expand All @@ -132,6 +132,10 @@ set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
# Use OpenMP
option ( SUITESPARSE_USE_OPENMP "ON (default): Use OpenMP in libraries by default if available. OFF: Do not use OpenMP by default." ON )

# control the use of Python interfaces in SuiteSparse packages (currently only
# for SPEX)
option ( SUITESPARSE_USE_PYTHON "ON (default): build Python interfaces for SuiteSparse packages (SPEX). OFF: do not build Python interfaces for SuiteSparse packages" ON )

# strict usage
option ( SUITESPARSE_USE_STRICT "ON: treat all _USE__ settings as strict if they are ON. OFF (default): consider *_USE_* as preferences, not strict" OFF )

Expand Down Expand Up @@ -239,6 +243,13 @@ if ( INSIDE_SUITESPARSE )
list ( APPEND CMAKE_BUILD_RPATH ${SUITESPARSE_LIBDIR} )
endif ( )

if ( APPLE )
# append /usr/local/lib to the install and build runpaths
message ( STATUS "Add to Mac rpath: " ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} )
list ( APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} )
list ( APPEND CMAKE_BUILD_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} )
endif ( )

set ( SUITESPARSE_PKGFILEDIR ${SUITESPARSE_LIBDIR} CACHE STRING
"Directory where CMake Config and pkg-config files will be installed" )

Expand Down
Loading