diff --git a/.github/workflows/build-arch-emu.yaml b/.github/workflows/build-arch-emu.yaml new file mode 100644 index 0000000000..813d16aa3d --- /dev/null +++ b/.github/workflows/build-arch-emu.yaml @@ -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 + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 079d9b7c32..40599be3c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/checkout@v2.0.0 + - name: Install tools for build run: | sudo apt install -y lcov + - name: Build GraphBLAS run: | git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git @@ -30,14 +38,14 @@ 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/github-pages-deploy-action@4.1.1 if: matrix.config.deployit && github.event_name == 'push' && github.ref == 'refs/heads/stable' @@ -45,25 +53,35 @@ jobs: branch: gh-pages folder: build/test_coverage/ single-commit: true + - name: Save output uses: actions/upload-artifact@v4.6.0 + 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/checkout@v2.0.0 + - name: Install dependencies run: | brew tap-new libomp/cask brew extract --version=14.0.6 libomp libomp/cask brew install libomp@14.0.6 + - name: Build GraphBLAS run: | git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git @@ -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 . + diff --git a/CMakeLists.txt b/CMakeLists.txt index 02d7289e70..603ccce9cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}. @@ -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 ( ) @@ -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 ( ) @@ -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 " ) @@ -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 ) @@ -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 @@ -424,3 +456,4 @@ if ( NOT MSVC ) ${CMAKE_CURRENT_BINARY_DIR}/LAGraph.pc DESTINATION ${SUITESPARSE_PKGFILEDIR}/pkgconfig ) endif ( ) + diff --git a/cmake_modules/FindGraphBLAS.cmake b/cmake_modules/FindGraphBLAS.cmake index 086eaf4351..64b8a9a3b3 100644 --- a/cmake_modules/FindGraphBLAS.cmake +++ b/cmake_modules/FindGraphBLAS.cmake @@ -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: diff --git a/cmake_modules/SuiteSparsePolicy.cmake b/cmake_modules/SuiteSparsePolicy.cmake index b6b195407c..4f62be6cbe 100644 --- a/cmake_modules/SuiteSparsePolicy.cmake +++ b/cmake_modules/SuiteSparsePolicy.cmake @@ -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 #------------------------------------------------------------------------------- @@ -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 ) @@ -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 ) @@ -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" )