Skip to content

Commit

Permalink
Merge pull request #94 from DrTimothyAldenDavis/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
DrTimothyAldenDavis authored Jan 14, 2022
2 parents 1b97623 + 8a7e059 commit a7a61e0
Show file tree
Hide file tree
Showing 4,131 changed files with 6,235 additions and 5,186 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
188 changes: 126 additions & 62 deletions 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 "Jan 1, 2022")
set ( GraphBLAS_DATE "Jan 13, 2022" )
set ( GraphBLAS_VERSION_MAJOR 6 )
set ( GraphBLAS_VERSION_MINOR 1 )
set ( GraphBLAS_VERSION_SUB 3 )
set ( GraphBLAS_VERSION_SUB 4 )

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

Expand Down Expand Up @@ -93,10 +93,10 @@ else ( )
# CUDA 11.2 or later present
enable_language ( CUDA )
set ( CMAKE_CUDA on )
endif ()
endif ( )
else ( )
# without CUDA:
message ( STATUS "CUDA: not found")
message ( STATUS "CUDA: not found" )
set ( CMAKE_CUDA off )
endif ( )

Expand All @@ -118,6 +118,72 @@ else ( )
LANGUAGES C )
endif ( )

#-------------------------------------------------------------------------------
# find OpenMP, CUDA, RMM, and cpu_features
#-------------------------------------------------------------------------------

find_package ( OpenMP )

if ( CMAKE_CUDA )
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++ )
add_subdirectory ( rmm_wrap )
include_directories ( "rmm_wrap" ${CUDA_INCLUDE_DIRS} )
link_directories ( "CUDA" "${CUDA_LIBRARIES}" "/usr/local/cuda/lib64/stubs" "rmm_wrap" )
else ( )
message ( STATUS "CUDA: not enabled" )
set ( CMAKE_RMM_FLAG " " )
set ( GB_RMM )
endif ( )

if ( NOT GBNCPUFEAT )
# default: enable Google's cpu_features package
message ( STATUS "cpu_features (by google.com): enabled " )
include_directories ( "cpu_features/include" "cpu_features" "cpu_features/src" "cpu_features/include/internal" )
else ( )
# disable Google's cpu_features package
message ( STATUS "cpu_features (by google.com): disabled" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBNCPUFEAT " )
endif ( )

if ( DEFINED GBX86 )
# default: this is detected automatically, but can be set here also
if ( GBX86 )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBX86=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBX86=0 " )
endif ( )
endif ( )

if ( DEFINED GBAVX2 )
# default: this is detected automatically, but can be set here also
if ( GBAVX2 )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX2=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX2=0 " )
endif ( )
endif ( )

if ( DEFINED GBAVX512F )
# default: this is detected automatically, but can be set here also
if ( GBAVX512F )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX512F=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX512F=0 " )
endif ( )
endif ( )

#-------------------------------------------------------------------------------
# determine build type
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -164,47 +230,13 @@ configure_file (
"${PROJECT_SOURCE_DIR}/README.md"
)

#-------------------------------------------------------------------------------
# find OpenMP, CUDA, RMM, and cpu_features
#-------------------------------------------------------------------------------

find_package ( OpenMP )

if ( CMAKE_CUDA )
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++ )
add_subdirectory(rmm_wrap)
include_directories ( "rmm_wrap" ${CUDA_INCLUDE_DIRS})
link_directories ( "CUDA" "${CUDA_LIBRARIES}" "/usr/local/cuda/lib64/stubs" "rmm_wrap" )
else ( )
message ( STATUS "CUDA: not enabled" )
set ( CMAKE_RMM_FLAG " " )
set ( GB_RMM )
endif ( )

set ( BUILD_TESTING off )
message ( STATUS "Adding cpu_features (by google.com): " )
add_subdirectory ( cpu_features )
include_directories ( "cpu_features/include" )

#-------------------------------------------------------------------------------
# report status
#-------------------------------------------------------------------------------

message ( STATUS "CMAKE build type: " ${CMAKE_BUILD_TYPE} )

if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
message ( STATUS "CMAKE C Flags debug: " ${CMAKE_C_FLAGS_DEBUG} )
else ( )
message ( STATUS "CMAKE C Flags release: " ${CMAKE_C_FLAGS_RELEASE} )
Expand All @@ -220,9 +252,9 @@ message ( STATUS "CMAKE have OpenMP: " ${OPENMP_FOUND} )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )

if ( GBCOMPACT )
include_directories ( Source/Template Source Include Source/Generated1 lz4 cpu_features/include Demo/Include rmm_wrap )
include_directories ( Source/Template Source Include Source/Generated1 lz4 Demo/Include rmm_wrap )
else ( )
include_directories ( Source/Template Source Include Source/Generated1 lz4 cpu_features/include Source/Generated2 Demo/Include rmm_wrap )
include_directories ( Source/Template Source Include Source/Generated1 lz4 Source/Generated2 Demo/Include rmm_wrap )
endif ( )

#-------------------------------------------------------------------------------
Expand All @@ -231,8 +263,8 @@ endif ( )

# check which compiler is being used. If you need to make
# compiler-specific modifications, here is the place to do it.
if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
# The -g option is useful for the Intel(R) VTune tool, but it should be
if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# The -g option is useful for the Intel VTune tool, but it should be
# removed in production. Comment this line out if not in use:
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" )
# cmake 2.8 workaround: gcc needs to be told to do ANSI C11.
Expand All @@ -243,9 +275,9 @@ if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
# faster single complex multiplication and division
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcx-limited-range " )
# math functions do not need to report errno
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno ")
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno " )
# integer operations wrap
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv ")
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 " )
if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9 )
Expand Down Expand Up @@ -278,18 +310,18 @@ elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
# options for MicroSoft Visual Studio
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 -wd\"4244\" -wd\"4146\" -wd\"4018\" -wd\"4996\" -wd\"4047\" -wd\"4554\"")
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 -wd\"4244\" -wd\"4146\" -wd\"4018\" -wd\"4996\" -wd\"4047\" -wd\"4554\"" )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "PGI" )
# options for PGI pgcc compiler. The compiler has a bug, and the
# -DPGI_COMPILER_BUG causes GraphBLAS to use a workaround.
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mnoopenmp -noswitcherror -c11 -lm -DPGI_COMPILER_BUG" )
set ( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Mnoopenmp -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1 -noswitcherror --c++11 -lm -DPGI_COMPILER_BUG" )
endif ( )

if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}" )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}" )
endif ( )

set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CUDA_FLAG}" )
Expand Down Expand Up @@ -327,31 +359,64 @@ endif ( )

add_library ( graphblas SHARED ${GRAPHBLAS_SOURCES} )

if ( CMAKE_CUDA )
add_dependencies(graphblas graphblascuda)
add_dependencies(graphblas rmm_wrap)
endif()

SET_TARGET_PROPERTIES ( graphblas PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11
PUBLIC_HEADER "Include/GraphBLAS.h" )
set_property ( TARGET graphblas PROPERTY C_STANDARD 11 )

if ( CMAKE_CUDA )
add_dependencies ( graphblas graphblascuda )
add_dependencies ( graphblas rmm_wrap )
endif ( )

#-------------------------------------------------------------------------------
# static graphblas library properties
#-------------------------------------------------------------------------------

if ( BUILD_GRB_STATIC_LIBRARY )

add_library ( graphblas_static STATIC ${GRAPHBLAS_SOURCES} )

SET_TARGET_PROPERTIES ( graphblas_static PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblas
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11
PUBLIC_HEADER "Include/GraphBLAS.h" )
set_property ( TARGET graphblas_static PROPERTY C_STANDARD 11 )
set_property ( TARGET graphblas_static PROPERTY C_STANDARD 11 )

if ( CMAKE_CUDA )
add_dependencies ( graphblas_static graphblascuda )
add_dependencies ( graphblas_static rmm_wrap )
endif ( )
endif ( )

#-------------------------------------------------------------------------------
# cpu_features settings
#-------------------------------------------------------------------------------

if ( NOT GBNCPUFEAT )
if ( UNIX )
# look for requirements for cpu_features/src/hwcaps.c
include ( CheckIncludeFile )
include ( CheckSymbolExists )
check_include_file ( dlfcn.h HAVE_DLFCN_H )
if ( HAVE_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 ( )
endif ( )
check_symbol_exists ( getauxval "sys/auxv.h" HAVE_STRONG_GETAUXVAL )
if ( HAVE_STRONG_GETAUXVAL )
target_compile_definitions ( graphblas PRIVATE HAVE_STRONG_GETAUXVAL )
if ( BUILD_GRB_STATIC_LIBRARY )
target_compile_definitions ( graphblas_static PRIVATE HAVE_STRONG_GETAUXVAL )
endif ( )
endif ( )
endif ( )
endif ( )

#-------------------------------------------------------------------------------
Expand All @@ -373,8 +438,6 @@ endif ( )
# add the OpenMP, IPP, CUDA, BLAS, etc libraries
#-------------------------------------------------------------------------------

target_link_libraries ( graphblas PUBLIC cpu_features )

if ( OPENMP_FOUND )
message ( STATUS "CMAKE OpenMP libraries: " ${OpenMP_C_LIBRARIES} )
message ( STATUS "CMAKE OpenMP include: " ${OpenMP_C_INCLUDE_DIRS} )
Expand Down Expand Up @@ -420,7 +483,7 @@ if ( DEMO )
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11 )
set_property ( TARGET graphblasdemo PROPERTY C_STANDARD 11 )
target_link_libraries ( graphblasdemo PUBLIC ${M_LIB} graphblas ${GB_CUDA} ${GB_RMM})
target_link_libraries ( graphblasdemo PUBLIC ${M_LIB} graphblas ${GB_CUDA} ${GB_RMM} )

if ( BUILD_GRB_STATIC_LIBRARY )
add_library ( graphblasdemo_static STATIC ${DEMO_SOURCES} )
Expand Down Expand Up @@ -488,9 +551,10 @@ endif ( )
# set ( DUMP true )

if ( DUMP )
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
get_cmake_property ( _variableNames VARIABLES )
list ( SORT _variableNames )
foreach ( _variableName ${_variableNames} )
message ( STATUS "${_variableName}=${${_variableName}}" )
endforeach ( )
endif ( )

Loading

0 comments on commit a7a61e0

Please sign in to comment.