Skip to content

Commit

Permalink
Merge branch 'master' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Nov 5, 2022
2 parents bc5ae1e + 4eb68a3 commit 7ae0f44
Show file tree
Hide file tree
Showing 442 changed files with 60,759 additions and 48,399 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ project (SuiteSparse
DESCRIPTION "A suite of sparse matrix packages"
HOMEPAGE_URL http://faculty.cse.tamu.edu/davis/suitesparse.html
LANGUAGES C
VERSION 5.12.0
VERSION 5.13.0
)

set (CMAKE_DEBUG_POSTFIX _debug)
Expand Down
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Aug 25, 2022, SuiteSparse 5.13.0

* GraphBLAS v7.2.0: see GraphBLAS/Doc/ChangeLog for details.
* performance: more compact serialization (ZSTD added, now the
default compression method).
* MATLAB interface: faster linear indexing, reshape, bandwidth,
istril, istriu, isbanded, isdiag. C(I,J)=A can now grow the
size of C.
* features: reshape methods, cube root operator, isStoredElement
* bugs: a minor bug; user-defined types were incorrectly limited to
128 bytes in size in v7.0.3.

Apr 10, 2022, SuiteSparse 5.12.0

* GraphBLAS v7.0.3: see GraphBLAS/Doc/ChangeLog for details.
Expand Down
2 changes: 2 additions & 0 deletions GraphBLAS/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ alternative/*.out
alternative/*_out.m
alternative/*_out2.m
alternative/*_demo
alternative/*.so*
alternative/*.dylib*

Test/*.log
Test/errlog.txt
Expand Down
43 changes: 22 additions & 21 deletions GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ endif ( )
set ( CMAKE_MACOSX_RPATH TRUE )

# version of SuiteSparse:GraphBLAS
set ( GraphBLAS_DATE "Apr 8, 2022" )
set ( GraphBLAS_DATE "Aug 8, 2022" )
set ( GraphBLAS_VERSION_MAJOR 7 )
set ( GraphBLAS_VERSION_MINOR 0 )
set ( GraphBLAS_VERSION_SUB 3 )
set ( GraphBLAS_VERSION_MINOR 2 )
set ( GraphBLAS_VERSION_SUB 0 )

message ( STATUS "Building SuiteSparse:GraphBLAS version: v" ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB} " date: " ${GraphBLAS_DATE} )

Expand Down Expand Up @@ -58,14 +58,13 @@ message ( STATUS "GraphBLAS C API: v" "${GraphBLAS_API_VERSION_MAJOR}.${GraphBLA

# TODO: use something like this:
# if ( set some flag to ignore cuda )
# set ( CMAKE_CUDA off )
# ... disable CUDA
# message ( STATUS "CUDA: disabled" )
# elseif ( ${CMAKE_VERSION} VERSION_LESS "3.17.0" )
# ...

if ( ${CMAKE_VERSION} VERSION_LESS "3.17.0" )


# CUDA requires cmake 3.17 or later
set ( CMAKE_CUDA off )
message ( STATUS "CUDA: not enabled (cmake 3.17.0 or later required)" )
Expand Down Expand Up @@ -103,14 +102,14 @@ else ( )
endif ( )

# CUDA is under development for now, and not deployed in production:
set ( CMAKE_CUDA off)
set ( CMAKE_CUDA off )

# Edit these lines for code development only, not for end-users:
# set ( CMAKE_BUILD_TYPE Debug )

if ( CMAKE_CUDA )
# for CUDA development only; not for production use
set ( CMAKE_CUDA_DEV on )
set ( CMAKE_CUDA_DEV off )
project ( graphblas
VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}"
LANGUAGES CUDA C )
Expand All @@ -128,25 +127,21 @@ endif ( )
find_package ( OpenMP )

if ( CMAKE_CUDA )
# with CUDA and RMM
message ( STATUS "CUDA: enabled" )
set ( CMAKE_CUDA_FLAG " -DGBCUDA" )
add_subdirectory ( CUDA )
set ( GB_CUDA graphblascuda ${CUDA_LIBRARIES} )
link_directories ( "CUDA" ${CUDA_LIBRARIES} )
else ( )
set ( CMAKE_CUDA_FLAG " " )
set ( GB_CUDA )
endif ( )

if ( CMAKE_CUDA )
message ( STATUS "CUDA: enabled" )
set ( CMAKE_RMM_FLAG " -DGBRMM" )
set ( GB_RMM rmm_wrap ${CUDA_LIBRARIES} stdc++ )
set ( GB_RMM rmm_wrap ${CUDA_LIBRARIES} )
add_subdirectory ( rmm_wrap )
include_directories ( "rmm_wrap" ${CUDA_INCLUDE_DIRS} )
link_directories ( "CUDA" "${CUDA_LIBRARIES}" "/usr/local/cuda/lib64/stubs" "rmm_wrap" )
link_directories ( "CUDA" "${CUDA_LIBRARIES}" "/usr/local/cuda/lib64/stubs" "rmm_wrap" "/usr/local/cuda/lib64" )
else ( )
# without CUDA and RMM
message ( STATUS "CUDA: not enabled" )
set ( CMAKE_CUDA_FLAG " " )
set ( CMAKE_RMM_FLAG " " )
set ( GB_CUDA )
set ( GB_RMM )
endif ( )

Expand Down Expand Up @@ -257,9 +252,9 @@ set ( CMAKE_INCLUDE_CURRENT_DIR ON )

if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
include_directories ( Source/Template Source Include Source/Generated1 lz4 Demo/Include rmm_wrap )
include_directories ( Source/Template Source Include Source/Generated1 lz4 zstd zstd/zstd_subset Demo/Include rmm_wrap )
else ( )
include_directories ( Source/Template Source Include Source/Generated1 lz4 Source/Generated2 Demo/Include rmm_wrap )
include_directories ( Source/Template Source Include Source/Generated1 lz4 zstd zstd/zstd_subset Source/Generated2 Demo/Include rmm_wrap )
endif ( )

#-------------------------------------------------------------------------------
Expand All @@ -284,7 +279,7 @@ if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# integer operations wrap
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv " )
# check all warnings (uncomment for development only)
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -Werror " )
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic " )
if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9 )
message ( FATAL_ERROR "gcc version must be at least 4.9" )
endif ( )
Expand Down Expand Up @@ -410,17 +405,23 @@ if ( NOT GBNCPUFEAT )
include ( CheckSymbolExists )
check_include_file ( dlfcn.h HAVE_DLFCN_H )
if ( HAVE_DLFCN_H )
message ( STATUS "cpu_feautures has dlfcn.h" )
target_compile_definitions ( graphblas PRIVATE HAVE_DLFCN_H )
if ( BUILD_GRB_STATIC_LIBRARY )
target_compile_definitions ( graphblas_static PRIVATE HAVE_DLFCN_H )
endif ( )
else ( )
message ( STATUS "cpu_feautures without dlfcn.h" )
endif ( )
check_symbol_exists ( getauxval "sys/auxv.h" HAVE_STRONG_GETAUXVAL )
if ( HAVE_STRONG_GETAUXVAL )
message ( STATUS "cpu_feautures has getauxval from sys/auxv.h" )
target_compile_definitions ( graphblas PRIVATE HAVE_STRONG_GETAUXVAL )
if ( BUILD_GRB_STATIC_LIBRARY )
target_compile_definitions ( graphblas_static PRIVATE HAVE_STRONG_GETAUXVAL )
endif ( )
else ( )
message ( STATUS "cpu_feautures doesn't have getauxval from sys/auxv.h" )
endif ( )
endif ( )
endif ( )
Expand Down
1 change: 1 addition & 0 deletions GraphBLAS/CUDA/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.so
jitFactory
stringify
rmm_log.txt

# Do not ignore this file
!.gitignore
Expand Down
77 changes: 48 additions & 29 deletions GraphBLAS/CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ cmake_minimum_required(VERSION 3.20.1)

project(GRAPHBLAS_CUDA VERSION 0.1 LANGUAGES CXX CUDA)

set(CMAKE_CUDA_FLAGS "-cudart=static -lineinfo -G")
set(CMAKE_CUDA_FLAGS "-cudart=static -lineinfo ")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17 -fPIC ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBNCPUFEAT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGBNCPUFEAT")
set(CMAKE_C_STANDARD 11)

message(STATUS "${CMAKE_CXX_FLAGS}")
message(STATUS "C++ flags for CUDA:" "${CMAKE_CXX_FLAGS}")

file(GLOB GRAPHBLAS_CUDA_SOURCES "*.cu" "*.c" "*.cpp")

Expand All @@ -32,21 +32,37 @@ set(GRAPHBLAS_CUDA_INCLUDES
../Include
../CUDA)

message(STATUS "${GRAPHBLAS_CUDA_INCLUDES}")
message(STATUS "GraphBLAS CUDA includes: " "${GRAPHBLAS_CUDA_INCLUDES}")

target_include_directories(graphblascuda PUBLIC ${CUDAToolkit_INCLUDE_DIRS} ${GRAPHBLAS_CUDA_INCLUDES})
set(EXTERNAL_INCLUDES_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external_includes)

IF(NOT EXISTS ${EXTERNAL_INCLUDES_DIRECTORY})
file(MAKE_DIRECTORY ${EXTERNAL_INCLUDES_DIRECTORY})
endif()

IF(NOT EXISTS ${EXTERNAL_INCLUDES_DIRECTORY}/cuco)
execute_process(
COMMAND git clone "https://github.com/NVIDIA/cuCollections.git" --branch main --recursive cuco
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external_includes)
endif()

include_directories(${CMAKE_CURRENT_BINARY_DIR}/external_includes/cuco/include)

target_include_directories(graphblascuda PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/external_includes/cuco/include
${CUDAToolkit_INCLUDE_DIRS}
${GRAPHBLAS_CUDA_INCLUDES})
set_target_properties(graphblascuda PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(graphblascuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(graphblascuda PROPERTIES CUDA_ARCHITECTURES "75")

target_link_libraries(graphblascuda CUDA::nvrtc CUDA::cudart_static)
target_link_libraries(graphblascuda CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt )

install ( TARGETS graphblascuda
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )


# 1. Execute enumify/stringify/jitify logic to compile ptx kernels and compile/link w/ relevant *.cu files.

# TODO: Need to do this piece in cmake
Expand All @@ -58,11 +74,12 @@ set(CUDA_TEST_SUITES
)

#
set(CUDA_TEST_MONOIDS PLUS) #MIN MAX TIMES ANY)
set(CUDA_TEST_BINOPS TIMES) #PLUS MIN MAX DIV MINUS RDIV RMINUS FIRST SECOND PAIR)
set(CUDA_TEST_SEMIRINGS PLUS_TIMES) # MIN_PLUS MAX_PLUS)
set(CUDA_TEST_DATATYPES int32_t ) #int64_t uint32_t uint64_t float double)
set(CUDA_TEST_MONOIDS PLUS MIN MAX) # TIMES ANY)
set(CUDA_TEST_BINOPS TIMES PLUS MIN MAX DIV) #MINUS RDIV RMINUS FIRST SECOND PAIR)
set(CUDA_TEST_SEMIRINGS PLUS_TIMES MIN_PLUS MAX_PLUS)
set(CUDA_TEST_DATATYPES int32_t int64_t uint32_t uint64_t float double)
set(CUDA_TEST_KERNELS vsvs) # mp vsvs dndn spdn vssp)
set(CUDA_TEST_FORMATS sparse dense sparse_dense reduce)


# TODO: Update testGen.py to accept the above CUDA_TEST_* params as arguments
Expand All @@ -77,23 +94,25 @@ set(CUDA_TEST_CPP_FILES "")
foreach(var ${CUDA_TEST_SUITES})
foreach(semiring ${CUDA_TEST_SEMIRINGS})
foreach(kernel ${CUDA_TEST_KERNELS})

# TODO: Have Python script also build separate cudaTest.cpp (named something
# like AxB_dot3_cuda_tests.cpp) for each suite. This way we should be able to
# easily ignore them from the build
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_test_instances.hpp
${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_cuda_tests.cpp
DEPENDS
jitFactory.hpp
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/test/testGen_cmake.py "\"${CMAKE_CURRENT_SOURCE_DIR}\"" "\"${var}\"" "\"${CUDA_TEST_MONOIDS}\""
"\"${CUDA_TEST_BINOPS}\"" "\"${semiring}\"" "\"${CUDA_TEST_DATATYPES}\""
"\"${kernel}\""
)

# Construct final list of files to compile (in parallel)
list(APPEND CUDA_TEST_CPP_FILES ${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_cuda_tests.cpp)
foreach(format ${CUDA_TEST_FORMATS})

# TODO: Have Python script also build separate cudaTest.cpp (named something
# like AxB_dot3_cuda_tests.cpp) for each suite. This way we should be able to
# easily ignore them from the build
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_${format}_test_instances.hpp
${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_${format}_cuda_tests.cpp
DEPENDS
jitFactory.hpp
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/test/testGen_cmake.py "\"${CMAKE_CURRENT_SOURCE_DIR}\"" "\"${var}\"" "\"${CUDA_TEST_MONOIDS}\""
"\"${CUDA_TEST_BINOPS}\"" "\"${semiring}\"" "\"${CUDA_TEST_DATATYPES}\""
"\"${kernel}\""
)

# Construct final list of files to compile (in parallel)
list(APPEND CUDA_TEST_CPP_FILES ${CMAKE_CURRENT_BINARY_DIR}/${var}_${semiring}_${format}_cuda_tests.cpp)
endforeach()
endforeach()
endforeach()
endforeach()
Expand Down Expand Up @@ -127,13 +146,13 @@ endif()
# 3. Compile/link individual {test_suite_name}_cuda_tests.cpp files into a gtest executable
set(GRAPHBLAS_CUDA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/test)

message(STATUS "${CUDA_TEST_CPP_FILES}")
message(STATUS "CUDA tests files: " "${CUDA_TEST_CPP_FILES}")

add_executable(graphblascuda_test ${CUDA_TEST_CPP_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/test/run_tests.cpp)

set_target_properties(graphblascuda_test PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(graphblascuda_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(graphblascuda_test PROPERTIES CUDA_ARCHITECTURES "70")
set_target_properties(graphblascuda_test PROPERTIES CUDA_ARCHITECTURES "75")

include(GoogleTest)

Expand Down
Loading

0 comments on commit 7ae0f44

Please sign in to comment.