Skip to content

Commit e335c47

Browse files
committed
Added SuiteSparse GraphBLAS as optional dependency
1 parent a08db72 commit e335c47

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "taco/benchmark"]
55
path = taco/benchmark
66
url = ../../google/benchmark.git
7+
[submodule "taco/suitesparse"]
8+
path = taco/suitesparse
9+
url = ../../DrTimothyAldenDavis/GraphBLAS.git

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ BENCHFLAGS := #"--benchmark-group-by=func"
55
IGNORE += taco
66
IGNORE_FLAGS := $(addprefix --ignore=, $(IGNORE))
77

8+
GRAPHBLAS := "OFF"
9+
OPENMP := "OFF"
10+
811
export TACO_TENSOR_PATH = data/
912

1013
# To group benchmark output by benchmark, use BENCHFLAGS=--benchmark-group-by=func.
@@ -21,7 +24,7 @@ else
2124
endif
2225

2326
taco/build/taco-bench: check-and-reinit-submodules taco/benchmark/googletest
24-
mkdir -p taco/build/ && cd taco/build/ && cmake ../ && make -j4 taco-bench
27+
mkdir -p taco/build/ && cd taco/build/ && cmake -DOPENMP=$(OPENMP) -DGRAPHBLAS=$(GRAPHBLAS) ../ && $(MAKE) taco-bench
2528

2629
taco/benchmark/googletest: check-and-reinit-submodules
2730
if [ ! -d "taco/benchmark/googletest" ] ; then git clone https://github.com/google/googletest taco/benchmark/googletest; fi

taco/CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
22
project(taco-bench)
33
set(CMAKE_BUILD_TYPE "release")
4+
option(GRAPHBLAS "Build GraphBLAS benchmarks" OFF)
5+
6+
if(GRAPHBLAS)
7+
message("-- Will build GraphBLAS benchmarks")
8+
add_definitions(-DGRAPHBLAS)
9+
endif(GRAPHBLAS)
410

511
add_subdirectory(taco)
612
add_subdirectory(benchmark)
13+
if(GRAPHBLAS)
14+
add_subdirectory(suitesparse)
15+
endif(GRAPHBLAS)
716

8-
include_directories(taco taco/include benchmark/include)
17+
include_directories(taco taco/include benchmark/include suitesparse/Include)
918

1019
file(GLOB TEST_SOURCES *.cpp *.h)
1120

@@ -14,4 +23,7 @@ set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS} -std=c++14")
1423
add_executable(taco-bench ${TEST_SOURCES} bench.h)
1524
target_link_libraries(taco-bench benchmark::benchmark)
1625
target_link_libraries(taco-bench taco)
26+
if(GRAPHBLAS)
27+
target_link_libraries(taco-bench graphblas)
28+
endif(GRAPHBLAS)
1729

taco/graphblas.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if GRAPHBLAS
2+
13
#include "bench.h"
24
#include "benchmark/benchmark.h"
35

@@ -6,6 +8,10 @@
68
#include "taco/index_notation/index_notation.h"
79
#include "taco/index_notation/tensor_operator.h"
810

11+
extern "C" {
12+
#include "GraphBLAS.h"
13+
}
14+
915
#include <vector>
1016
#include <limits>
1117

@@ -76,4 +82,24 @@ static void bench_mxv_taco(benchmark::State& state) {
7682
taco_set_num_threads(1);
7783
}
7884

85+
static void bench_mxv_suitesparse(benchmark::State& state) {
86+
GrB_init(GrB_BLOCKING);
87+
88+
Tensor<double> T = read("/data/scratch/s3chou/formats-bench/data/webbase_1M.mtx", CSR);
89+
90+
for (const auto& c : T) {
91+
//A.insert(c.first.toVector(), c.second);
92+
}
93+
94+
GrB_Vector x = nullptr;
95+
GrB_Index n;
96+
GrB_Vector_new(&x, GrB_FP64, n);
97+
98+
for (auto _ : state) {
99+
}
100+
}
101+
79102
TACO_BENCH(bench_mxv_taco);
103+
TACO_BENCH(bench_mxv_suitesparse);
104+
105+
#endif

taco/suitesparse

Submodule suitesparse added at 4716318

0 commit comments

Comments
 (0)