Skip to content

Commit

Permalink
Merge pull request #121 from DrTimothyAldenDavis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
DrTimothyAldenDavis authored Mar 14, 2022
2 parents 0e1fb1c + cdf14bf commit 0bef414
Show file tree
Hide file tree
Showing 1,998 changed files with 3,802 additions and 2,711 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Mar 9, 2022, SuiteSparse 5.11.0
Mar 14, 2022, SuiteSparse 5.11.0

* GraphBLAS v6.2.4: see GraphBLAS/Doc/ChangeLog for changes.
* GraphBLAS v6.2.5: see GraphBLAS/Doc/ChangeLog for changes.
Primary ones highlighted here:
* v2.0 API: v6.x complies with the v2.0 C API of the GraphBLAS Spec.
Note that GrB_wait, GrB_Info are now different than in the v1.3
Expand Down
21 changes: 13 additions & 8 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 "Mar 8, 2022" )
set ( GraphBLAS_DATE "Mar 14, 2022" )
set ( GraphBLAS_VERSION_MAJOR 6 )
set ( GraphBLAS_VERSION_MINOR 2 )
set ( GraphBLAS_VERSION_SUB 4 )
set ( GraphBLAS_VERSION_SUB 5 )

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

Expand Down Expand Up @@ -103,17 +103,19 @@ 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 ( GBCOMPACT true )
# set ( CMAKE_BUILD_TYPE Debug )

if ( CMAKE_CUDA )
# for CUDA development only; not for production use
set ( CMAKE_CUDA_DEV on )
project ( graphblas
VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}"
LANGUAGES CUDA C )
else ( )
set ( CMAKE_CUDA_DEV off )
project ( graphblas
VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}"
LANGUAGES C )
Expand Down Expand Up @@ -206,8 +208,9 @@ else ( )
message ( STATUS "Building dynamic GraphBLAS library" )
endif ( )

if ( GBCOMPACT )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCOMPACT=1 " )
if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCUDA_DEV=1 " )
endif ( )

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -252,7 +255,8 @@ message ( STATUS "CMAKE have OpenMP: " ${OPENMP_FOUND} )

set ( CMAKE_INCLUDE_CURRENT_DIR ON )

if ( GBCOMPACT )
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 )
else ( )
include_directories ( Source/Template Source Include Source/Generated1 lz4 Source/Generated2 Demo/Include rmm_wrap )
Expand Down Expand Up @@ -352,7 +356,8 @@ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CUDA_FLAG}" )
# - a public enum is extended (by adding a new item at the end, but without
# changing the already existing items)

if ( GBCOMPACT )
if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c" )
else ( )
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c" "Source/Generated2/*.c" )
Expand Down
3 changes: 2 additions & 1 deletion GraphBLAS/CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ project(GRAPHBLAS_CUDA VERSION 0.1 LANGUAGES CXX CUDA)
set(CMAKE_CUDA_FLAGS "-cudart static -lineinfo -G")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17 -fPIC ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBNCPUFEAT=OFF")
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}")
Expand Down
3 changes: 3 additions & 0 deletions GraphBLAS/CUDA/GB_AxB_dot3_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ GrB_Info GB_AxB_dot3_cuda // C<M> = A'*B using dot product method
C->nvec_nonempty = M->nvec_nonempty ;
C->nvec = M->nvec ;

// the dot3 CUDA kernel will produce C->i with jumbled indices
C->jumbled = true ;

GBURBLE ("(GPU C created and copied from M) ") ;
//--------------------------------------------------------------------------
// stringify the semiring and the mask
Expand Down
11 changes: 5 additions & 6 deletions GraphBLAS/CUDA/GB_AxB_dot3_cuda_branch.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ bool GB_AxB_dot3_cuda_branch
// that are not built-in, but consist solely of built-in types and
// operators (such as BOR_BSHIFT on INT32 inputs).

int ngpus_to_use = 1 ; //GB_ngpus_to_use (work) ;)
GBURBLE (" work:%g gpus:%d ", work, ngpus_to_use) ;
if (
// FIXME: user control over # GPUs to use
ngpus_to_use > 0
int ngpus_to_use = GB_ngpus_to_use (work) ;
GBURBLE (" work:%g GPUs:%d ", work, ngpus_to_use) ;
if (ngpus_to_use > 0
// FIXME: FUTURE: user-defined types and operators
&& (semiring->header_size == 0) // semiring is built-in
&& (A->type->code != GB_UDT_code)
Expand All @@ -47,7 +45,8 @@ bool GB_AxB_dot3_cuda_branch
// FIXME: this is easy
&& !A->iso && !B->iso
// FIXME:
&& !GB_IS_BITMAP (A) && !GB_IS_BITMAP (B))
&& !GB_IS_BITMAP (A) && !GB_IS_BITMAP (B)
&& !GB_IS_FULL (A) && !GB_IS_FULL (B))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion GraphBLAS/CUDA/GB_cuda_semiring_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GB_cuda_semiring_factory: public jit::File_Desc {
B_sparsity // sparsity structure of B
) ;

printf("scode=%uld\n", scode);
printf("scode=%lu\n", scode);
std::cout << "done stringify semiring" << std::endl;
this->sr_code = scode;

Expand Down
1 change: 1 addition & 0 deletions GraphBLAS/CUDA/GB_reduce_to_scalar_cuda_branch.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bool GB_reduce_to_scalar_cuda_branch

int ngpus_to_use = GB_ngpus_to_use (work) ;
GBURBLE (" work:%g gpus:%d ", work, ngpus_to_use) ;
printf (" work:%g gpus:%d ", work, ngpus_to_use) ;
if (ngpus_to_use > 0
&& (reduce->header_size == 0) // semiring is built-in
&& (A->type->code != GB_UDT_code))
Expand Down
40 changes: 29 additions & 11 deletions GraphBLAS/CUDA/GB_stringify_semiring.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ void GB_enumify_semiring // enumerate a semiring
//--------------------------------------------------------------------------
// get the semiring
//--------------------------------------------------------------------------
printf("inside enumify: %lu\n", semiring);
printf("inside enumify: %p\n", semiring);
GxB_print (semiring, 3) ;

printf("Getting semiring add\n");
GrB_Monoid add = semiring->add ;
Expand Down Expand Up @@ -232,11 +233,15 @@ void GB_enumify_semiring // enumerate a semiring

// total scode bits: 60

printf("coinstructing semiring scode\n");
printf("constructing semiring scode\n");

#define LSHIFT(x,k) (((uint64_t) x) << k)
// TODO: We need to
printf("add_ecode: %d, mult_ecode: %d\n", add_ecode, mult_ecode);
printf("before: add_ecode: %d, id_ecode: %d, term_ecode: %d, mult_ecode: %d, flipxy: %d, zcode: %d, "
"xcode: %d, ycode: %d, mask_ecode: %d, ccode: %d, acode: %d, bcode: %d, csparsity: %d, msparsity: %d, "
"asparsity: %d, bsparsity: %d\n", add_ecode, id_ecode, term_ecode, mult_ecode, flipxy, zcode, xcode, ycode, mask_ecode,
ccode, acode, bcode, csparsity, msparsity, asparsity, bsparsity);



(*scode) =
// range bits
Expand All @@ -255,8 +260,6 @@ void GB_enumify_semiring // enumerate a semiring
// mask
LSHIFT (mask_ecode , 20) | // 0 to 13 4

printf("serialized mask ecode: %d\n", mask_ecode);

// types of C, A, and B (bool, int*, uint*, etc)
LSHIFT (ccode , 16) | // 1 to 14 4
LSHIFT (acode , 12) | // 0 to 14 4
Expand All @@ -268,6 +271,8 @@ void GB_enumify_semiring // enumerate a semiring
LSHIFT (asparsity , 2) | // 0 to 3 2
LSHIFT (bsparsity , 0) ; // 0 to 3 2

printf("serialized_scode: %lu\n", *scode);


printf("done enumify semiring\n");

Expand All @@ -291,8 +296,8 @@ void GB_macrofy_semiring // construct all macros for a semiring
// extract the semiring scode
//--------------------------------------------------------------------------

#define RSHIFT(x,k,b) (x >> k) & ((0x00000001 << b) -1)
//#define RSHIFT(x,k,b) (x >> k) & ((((uint64_t) 1) << b) - 1)
#define RSHIFT(x,k,b) (x >> k) & ((((uint64_t)0x00000001) << b) -1)
//#define RSHIFT(x,k,b) (x >> k) & ((((uint64_t) 1) << (64-k) + b) - 1)

// monoid
int add_ecode = RSHIFT (scode, 55, 5) ;
Expand All @@ -313,16 +318,29 @@ void GB_macrofy_semiring // construct all macros for a semiring
printf("deserialized mask ecode: %d\n", mask_ecode);

// types of C, A, and B
int acode = RSHIFT (scode, 16, 4) ;
int bcode = RSHIFT (scode, 12, 4) ;
int ccode = RSHIFT (scode, 8, 4) ;
int ccode = RSHIFT (scode, 16, 4) ;
int acode = RSHIFT (scode, 12, 4) ;
int bcode = RSHIFT (scode, 8, 4) ;

printf("deserialized acode: %d\n", acode);

// TODO: I have a suspicion here that these might not
// be getting serialized properly because they are the
// only elements which require only 2 bits.
// formats of C, A, and B
int csparsity = RSHIFT (scode, 6, 2) ;
int msparsity = RSHIFT (scode, 4, 2) ;
int asparsity = RSHIFT (scode, 2, 2) ;
int bsparsity = RSHIFT (scode, 0, 2) ;

printf("after: add_ecode: %d, id_ecode: %d, term_ecode: %d, mult_ecode: %d, flipxy: %d, zcode: %d, "
"xcode: %d, ycode: %d, mask_ecode: %d, ccode: %d, acode: %d, bcode: %d, csparsity: %d, msparsity: %d, "
"asparsity: %d, bsparsity: %d\n", add_ecode, id_ecode, term_ecode, mult_ecode, flipxy, zcode, xcode, ycode, mask_ecode,
ccode, acode, bcode, csparsity, msparsity, asparsity, bsparsity);

printf("a sparsity ecode after rshift: %d\n", asparsity);


//--------------------------------------------------------------------------
// construct macros to load scalars from A and B (and typecast) them
//--------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 0bef414

Please sign in to comment.