@@ -58,15 +58,15 @@ if ( CMAKE_VERSION VERSION_GREATER "3.0" )
5858endif ( )
5959
6060# version of SuiteSparse:GraphBLAS
61- set ( GraphBLAS_DATE "Apr 2 , 2020" )
61+ set ( GraphBLAS_DATE "June 26 , 2020" )
6262set ( GraphBLAS_VERSION_MAJOR 3 )
63- set ( GraphBLAS_VERSION_MINOR 2 )
64- set ( GraphBLAS_VERSION_SUB 2 )
63+ set ( GraphBLAS_VERSION_MINOR 3 )
64+ set ( GraphBLAS_VERSION_SUB 0 )
6565
6666# GraphBLAS C API Specification version, at graphblas.org
67- set ( GraphBLAS_API_DATE "May 18, 2018 " )
67+ set ( GraphBLAS_API_DATE "Sept 25, 2019 " )
6868set ( GraphBLAS_API_VERSION_MAJOR 1 )
69- set ( GraphBLAS_API_VERSION_MINOR 2 )
69+ set ( GraphBLAS_API_VERSION_MINOR 3 )
7070set ( GraphBLAS_API_VERSION_SUB 0 )
7171
7272if ( CMAKE_MAJOR_VERSION GREATER 2 )
@@ -112,6 +112,12 @@ if ( GBCOMPACT )
112112 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCOMPACT=1 " )
113113endif ( )
114114
115+ set ( GB_AVX2 false )
116+
117+ if ( GB_AVX2 )
118+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2 -DGB_AVX2 " )
119+ endif ( )
120+
115121#-------------------------------------------------------------------------------
116122# Configure Include/GraphBLAS.h and documentation with version number
117123#-------------------------------------------------------------------------------
@@ -140,9 +146,24 @@ configure_file (
140146include ( FindOpenMP )
141147include ( FindThreads )
142148
143- # FUTURE: rely on CUDA
144149# enable_language ( CUDA )
145150# for nvcc, add -DGBCUDA
151+ # set ( CMAKE_CUDA on )
152+ set ( CMAKE_CUDA off )
153+
154+ # LIBS = -L/usr/local/cuda/lib64 -lcudadevrt -lcudart
155+ # LIB += -ldl -L$(CUDA_LIB_DIR) -lcuda -lcudart -lnvrtc
156+
157+ if ( CMAKE_CUDA )
158+ message ( STATUS "CUDA enabled" )
159+ set ( CMAKE_CUDA_FLAG " -DGBCUDA" )
160+ set ( GB_CUDA graphblascuda cuda cudadevrt cudart nvrtc )
161+ link_directories ( "CUDA" "/usr/local/cuda/lib64" )
162+ else ( )
163+ message ( STATUS "CUDA not enabled" )
164+ set ( CMAKE_CUDA_FLAG " " )
165+ set ( GB_CUDA )
166+ endif ( )
146167
147168#-------------------------------------------------------------------------------
148169# report status
@@ -173,6 +194,9 @@ message ( STATUS "CMAKE have OpenMP: " ${OPENMP_FOUND} )
173194# obtained from cblas_saxpy and cblas_daxpy. The Intel MKL can work with
174195# libgomp, but not when libiomp is also included.
175196
197+ # This is fixed in the alternative/Makefile, which only loads libgomp.
198+ # It is not yet fixed in this CMake script.
199+
176200# if ( CMAKE_VERSION VERSION_GREATER "3.13" )
177201# # Look for the parallel 64-bit MKL BLAS by default
178202# set ( BLA_VENDOR Intel10_64ilp )
@@ -216,6 +240,14 @@ if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
216240 # cmake 2.8 workaround: gcc needs to be told to do ANSI C11.
217241 # cmake 3.0 doesn't have this problem.
218242 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -lm -Wno-pragmas " )
243+ # operations may be carried out in higher precision
244+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexcess-precision=fast " )
245+ # faster single complex multiplication and division
246+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcx-limited-range " )
247+ # math functions do not need to report errno
248+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno " )
249+ # integer operations wrap
250+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv " )
219251 # check all warnings (uncomment for development only)
220252# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -Werror " )
221253 # set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" )
@@ -260,6 +292,8 @@ else ( )
260292 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE} " )
261293endif ( )
262294
295+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CUDA_FLAG} " )
296+
263297#-------------------------------------------------------------------------------
264298# dynamic graphblas library properties
265299#-------------------------------------------------------------------------------
@@ -352,43 +386,43 @@ endif ( )
352386if ( USE_OPENMP )
353387 # use OpenMP for user thread synchronization
354388 message ( STATUS "Using OpenMP to synchronize user threads" )
355- target_link_libraries ( graphblas ${M_LIB} ${OpenMP_C_LIBRARIES} )
389+ target_link_libraries ( graphblas ${M_LIB} ${OpenMP_C_LIBRARIES} ${GB_CUDA} )
356390 if ( BUILD_GRB_STATIC_LIBRARY )
357- target_link_libraries ( graphblas_static ${M_LIB} ${OpenMP_C_LIBRARIES} )
391+ target_link_libraries ( graphblas_static ${M_LIB} ${OpenMP_C_LIBRARIES} ${GB_CUDA} )
358392 endif ( )
359393 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -DUSER_OPENMP_THREADS " )
360394elseif ( USE_POSIX )
361395 # use POSIX for user thread synchronization
362396 message ( STATUS "Using POSIX pthreads to synchronize user threads" )
363- target_link_libraries ( graphblas ${M_LIB} )
397+ target_link_libraries ( graphblas ${M_LIB} ${GB_CUDA} )
364398 if ( BUILD_GRB_STATIC_LIBRARY )
365- target_link_libraries ( graphblas_static ${M_LIB} )
399+ target_link_libraries ( graphblas_static ${M_LIB} ${GB_CUDA} )
366400 endif ( )
367401 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -DUSER_POSIX_THREADS " )
368402else ( )
369403 # use no threading at all
370404 message ( WARNING "No support for user threads; GraphBLAS will not be thread-safe" )
371- target_link_libraries ( graphblas ${M_LIB} )
405+ target_link_libraries ( graphblas ${M_LIB} ${GB_CUDA} )
372406 if ( BUILD_GRB_STATIC_LIBRARY )
373- target_link_libraries ( graphblas_static ${M_LIB} )
407+ target_link_libraries ( graphblas_static ${M_LIB} ${GB_CUDA} )
374408 endif ( )
375409 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSER_NO_THREADS " )
376410endif ( )
377411
378412if ( CMAKE_THREAD_LIBS_INIT )
379- target_link_libraries ( graphblas ${CMAKE_THREAD_LIBS_INIT} )
413+ target_link_libraries ( graphblas ${CMAKE_THREAD_LIBS_INIT} ${GB_CUDA} )
380414 if ( BUILD_GRB_STATIC_LIBRARY )
381- target_link_libraries ( graphblas_static ${CMAKE_THREAD_LIBS_INIT} )
415+ target_link_libraries ( graphblas_static ${CMAKE_THREAD_LIBS_INIT} ${GB_CUDA} )
382416 endif ( )
383417endif ( )
384418
385419if ( OPENMP_FOUND )
386420 # use OpenMP for internal parallelism
387421 message ( STATUS "Using OpenMP for internal parallelism" )
388422 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} " )
389- target_link_libraries ( graphblas ${M_LIB} ${OpenMP_C_LIBRARIES} )
423+ target_link_libraries ( graphblas ${M_LIB} ${OpenMP_C_LIBRARIES} ${GB_CUDA} )
390424 if ( BUILD_GRB_STATIC_LIBRARY )
391- target_link_libraries ( graphblas_static ${M_LIB} ${OpenMP_C_LIBRARIES} )
425+ target_link_libraries ( graphblas_static ${M_LIB} ${OpenMP_C_LIBRARIES} ${GB_CUDA} )
392426 endif ( )
393427endif ( )
394428
@@ -434,15 +468,15 @@ SET_TARGET_PROPERTIES ( graphblasdemo PROPERTIES
434468 SOVERSION ${GraphBLAS_VERSION_MAJOR}
435469 C_STANDARD_REQUIRED 11 )
436470set_property ( TARGET graphblasdemo PROPERTY C_STANDARD 11 )
437- target_link_libraries ( graphblasdemo ${M_LIB} graphblas )
471+ target_link_libraries ( graphblasdemo ${M_LIB} graphblas ${GB_CUDA} )
438472
439473if ( BUILD_GRB_STATIC_LIBRARY )
440474 add_library ( graphblasdemo_static STATIC ${DEMO_SOURCES} )
441475 SET_TARGET_PROPERTIES ( graphblasdemo_static PROPERTIES
442476 VERSION ${GraphBLAS_VERSION_MAJOR} .${GraphBLAS_VERSION_MINOR} .${GraphBLAS_VERSION_SUB}
443477 C_STANDARD_REQUIRED 11 )
444478 set_property ( TARGET graphblasdemo_static PROPERTY C_STANDARD 11 )
445- target_link_libraries ( graphblasdemo_static graphblas_static )
479+ target_link_libraries ( graphblasdemo_static graphblas_static ${GB_CUDA} )
446480endif ( )
447481
448482#-------------------------------------------------------------------------------
@@ -463,18 +497,18 @@ add_executable ( reduce_demo "Demo/Program/reduce_demo.c" )
463497add_executable ( import_demo "Demo/Program/import_demo.c" )
464498
465499# Libraries required for Demo programs
466- target_link_libraries ( pagerank_demo graphblas graphblasdemo )
467- target_link_libraries ( bfs_demo graphblas graphblasdemo )
468- target_link_libraries ( tri_demo graphblas graphblasdemo )
469- target_link_libraries ( pthread_demo graphblas graphblasdemo )
470- target_link_libraries ( openmp_demo graphblas graphblasdemo )
471- target_link_libraries ( mis_demo graphblas graphblasdemo )
472- target_link_libraries ( complex_demo graphblas graphblasdemo )
473- target_link_libraries ( kron_demo graphblas graphblasdemo )
474- target_link_libraries ( simple_demo graphblasdemo )
475- target_link_libraries ( wildtype_demo graphblas )
476- target_link_libraries ( reduce_demo graphblas )
477- target_link_libraries ( import_demo graphblas graphblasdemo )
500+ target_link_libraries ( pagerank_demo graphblas graphblasdemo ${GB_CUDA} )
501+ target_link_libraries ( bfs_demo graphblas graphblasdemo ${GB_CUDA} )
502+ target_link_libraries ( tri_demo graphblas graphblasdemo ${GB_CUDA} )
503+ target_link_libraries ( pthread_demo graphblas graphblasdemo ${GB_CUDA} )
504+ target_link_libraries ( openmp_demo graphblas graphblasdemo ${GB_CUDA} )
505+ target_link_libraries ( mis_demo graphblas graphblasdemo ${GB_CUDA} )
506+ target_link_libraries ( complex_demo graphblas graphblasdemo ${GB_CUDA} )
507+ target_link_libraries ( kron_demo graphblas graphblasdemo ${GB_CUDA} )
508+ target_link_libraries ( simple_demo graphblasdemo ${GB_CUDA} )
509+ target_link_libraries ( wildtype_demo graphblas ${GB_CUDA} )
510+ target_link_libraries ( reduce_demo graphblas ${GB_CUDA} )
511+ target_link_libraries ( import_demo graphblas graphblasdemo ${GB_CUDA} )
478512
479513#-------------------------------------------------------------------------------
480514# graphblas installation location
0 commit comments