Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Feature merge (dev to master) #75

Merged
merged 55 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
1107b48
first pass at bc
Apr 22, 2021
df83603
bc working ... but not implemented correctly
Apr 22, 2021
09c7c70
testing bc
Apr 22, 2021
cf5f9e3
docs
Apr 22, 2021
2e71d47
docs
Apr 22, 2021
d392ef9
docs
Apr 22, 2021
fc014c9
fixing bc
Apr 28, 2021
68dc356
improved bc implementation
Apr 28, 2021
68bd367
multi-frontier bc
Apr 28, 2021
cd5a8df
Update convert.hxx
bkj Apr 29, 2021
de1a5cc
implementing COO functions
Apr 29, 2021
4e32832
[BUGFIX] Order of values passed to `csc.set`
bkj Apr 29, 2021
c75449b
implementing CSC builder + function
Apr 29, 2021
8eb4d57
Merge pull request #61 from gunrock/bugfix/offsets_to_indices
neoblizz Apr 29, 2021
9893f52
Merge branch 'devel' into dev/csc_functions
Apr 29, 2021
3d0451f
making CSR/CSC/COO names more obvious
Apr 29, 2021
c306799
Merge pull request #63 from gunrock/bugfix/csc_construction
neoblizz Apr 29, 2021
b2d442c
Merge branch 'dev' into dev/csc_functions
neoblizz Apr 29, 2021
71c1dc7
Separating advance i/o: supports complete graph as an input and no ou…
neoblizz Apr 30, 2021
8bcecd8
Updating the interface
neoblizz Apr 30, 2021
0af2261
advance enhancements and disabling frontier management
neoblizz Apr 30, 2021
d516911
Disable frontier management
neoblizz Apr 30, 2021
2a773d5
Clean-up
neoblizz Apr 30, 2021
f1acc68
Merge pull request #60 from bkj/dev/bc3
neoblizz Apr 30, 2021
b350d44
typo in the template list
neoblizz Apr 30, 2021
600d0ab
Merge branch 'dev' of github.com:gunrock/essentials into dev
neoblizz Apr 30, 2021
c51ef9d
Fixed the empty_*_t bug with a weird hack.
neoblizz May 1, 2021
0746fdd
Moved tests to unit_test directory
neoblizz May 1, 2021
f059285
Merge branch 'bkj-dev/coo_functions' into dev (PR #62)
neoblizz May 1, 2021
578445f
Merge branch 'dev' into dev/csc_functions
neoblizz May 1, 2021
f9530e3
Merge pull request #64 from bkj/dev/csc_functions
neoblizz May 1, 2021
fb7a298
more clean-up, minor bug-fixes.
neoblizz May 1, 2021
8393230
Moved csc to unit tests
neoblizz May 1, 2021
8ae9f88
bug-fix: bfs uses both csc + csr.
neoblizz May 1, 2021
2af7216
Missing policy
neoblizz May 1, 2021
ee4af69
Minor clean-up before we try dynamic .
neoblizz May 3, 2021
2cc8c69
Advance::backwards (using CSC) & clean-up.
neoblizz May 3, 2021
f31f6e7
(WIP) Local graph clustering
neoblizz May 3, 2021
70b2c6e
Batched betweeness centrality (full)
neoblizz May 4, 2021
6f6e8ba
BC results match networkx & minor improvements
neoblizz May 4, 2021
a27d4ed
Merge pull request #66 from gunrock/lgc
neoblizz May 5, 2021
41234b2
Merge pull request #68 from gunrock/master
neoblizz May 5, 2021
0d44829
dropping version
bkj May 7, 2021
10ead6d
Improve sssp_cpu performance
bkj May 12, 2021
52a288d
Typo
bkj May 12, 2021
0e14985
Merge pull request #72 from gunrock/hotfix/sssp_cpu_performance
neoblizz May 12, 2021
9a2803b
adding ppr
May 13, 2021
c6b7722
Merge branch 'dev' of https://github.com/gunrock/essentials into dev/ppr
May 13, 2021
b3066d2
testing ppr
May 13, 2021
f30b0d3
Update CMakeLists.txt
neoblizz May 13, 2021
5436e70
Move default fetch dir to _cmake_fetch.
li-yi-dong May 15, 2021
8121b38
Merge pull request #73 from bkj/dev/ppr
neoblizz May 16, 2021
f7c4532
Merge pull request #74 from li-yi-dong/master
neoblizz May 17, 2021
24c619c
Do not like how verbose FC is. JSON not being used right now
neoblizz May 17, 2021
2a736f3
AtomicMax support
neoblizz May 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ eval/

# Ignore build directory
build

# Ignore external fetched content
externals/*
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(PROJECT_DEPS_DIR externals)
# end /* Dependencies directory */

# begin /* Include cmake modules */
include(${PROJECT_SOURCE_DIR}/cmake/FetchRapidJSON.cmake)
# include(${PROJECT_SOURCE_DIR}/cmake/FetchRapidJSON.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FetchThrustCUB.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FetchModernGPU.cmake)
# end /* Include cmake modules */
Expand Down Expand Up @@ -157,4 +157,4 @@ option(ESSENTIALS_BUILD_TESTS
# Subdirectories for examples, testing and documentation
if(ESSENTIALS_BUILD_TESTS)
add_subdirectory(unittests)
endif(ESSENTIALS_BUILD_TESTS)
endif(ESSENTIALS_BUILD_TESTS)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ make sssp # or for all applications, use: make -j$(nproc)
bin/sssp ../datasets/chesapeake.mtx
```

##### Preferred **CUDA v11.2.1** due to support for stream ordered memory allocators (e.g. `cudaFreeAsync()`).

## Getting Started with Gunrock

- **Tutorial:** [Gunrock's programming model]()
Expand Down
10 changes: 8 additions & 2 deletions cmake/FetchModernGPU.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
include(FetchContent)
set(FETCHCONTENT_QUIET ON)

message("-- Cloning External Project: ModernGPU")
get_filename_component(FC_BASE "../externals"
REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(FETCHCONTENT_BASE_DIR ${FC_BASE})

FetchContent_Declare(
moderngpu
GIT_REPOSITORY https://github.com/moderngpu/moderngpu.git
# tag at master branch:
GIT_TAG 2b3985541c8e88a133769598c406c33ddde9d0a5

)

FetchContent_GetProperties(moderngpu)
Expand All @@ -13,4 +19,4 @@ if(NOT moderngpu_POPULATED)
moderngpu
)
endif()
set(MODERNGPU_INCLUDE_DIR "${moderngpu_SOURCE_DIR}/src")
set(MODERNGPU_INCLUDE_DIR "${moderngpu_SOURCE_DIR}/src")
9 changes: 8 additions & 1 deletion cmake/FetchRapidJSON.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
include(FetchContent)
set(FETCHCONTENT_QUIET ON)

message("-- Cloning External Project: RapidJSON")
get_filename_component(FC_BASE "../externals"
REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(FETCHCONTENT_BASE_DIR ${FC_BASE})

FetchContent_Declare(
rapidjson
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
Expand All @@ -11,4 +18,4 @@ if(NOT rapidjson_POPULATED)
rapidjson
)
endif()
set(RAPIDJSON_INCLUDE_DIR "${rapidjson_SOURCE_DIR}/include")
set(RAPIDJSON_INCLUDE_DIR "${rapidjson_SOURCE_DIR}/include")
9 changes: 8 additions & 1 deletion cmake/FetchThrustCUB.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
include(FetchContent)
set(FETCHCONTENT_QUIET ON)

message("-- Cloning External Project: Thrust")
get_filename_component(FC_BASE "../externals"
REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(FETCHCONTENT_BASE_DIR ${FC_BASE})

FetchContent_Declare(
thrust
GIT_REPOSITORY https://github.com/thrust/thrust.git
Expand All @@ -12,4 +19,4 @@ if(NOT thrust_POPULATED)
)
endif()
set(THRUST_INCLUDE_DIR "${thrust_SOURCE_DIR}")
set(CUB_INCLUDE_DIR "${thrust_SOURCE_DIR}/cub")
set(CUB_INCLUDE_DIR "${thrust_SOURCE_DIR}/cub")
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ add_subdirectory(bfs)
add_subdirectory(color)
add_subdirectory(geo)
add_subdirectory(pr)
add_subdirectory(ppr)
add_subdirectory(bc)
# end /* Add examples' subdirectories */
21 changes: 21 additions & 0 deletions examples/bc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# begin /* Set the application name. */
set(APPLICATION_NAME bc)
# end /* Set the application name. */

# begin /* Add CUDA executables */
add_executable(${APPLICATION_NAME})

set(SOURCE_LIST
${APPLICATION_NAME}.cu
)

target_sources(${APPLICATION_NAME} PRIVATE ${SOURCE_LIST})
target_link_libraries(${APPLICATION_NAME} PRIVATE essentials)
get_target_property(ESSENTIALS_ARCHITECTURES essentials CUDA_ARCHITECTURES)
set_target_properties(${APPLICATION_NAME}
PROPERTIES
CUDA_ARCHITECTURES ${ESSENTIALS_ARCHITECTURES}
) # XXX: Find a better way to inherit essentials properties.

message("-- Example Added: ${APPLICATION_NAME}")
# end /* Add CUDA executables */
71 changes: 71 additions & 0 deletions examples/bc/bc.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <gunrock/applications/bc.hxx>

using namespace gunrock;
using namespace memory;

void test_bc(int num_arguments, char** argument_array) {
if (num_arguments != 2) {
std::cerr << "usage: ./bin/<program-name> filename.mtx" << std::endl;
exit(1);
}

// --
// Define types

using vertex_t = int;
using edge_t = int;
using weight_t = float;

// --
// IO

std::string filename = argument_array[1];

io::matrix_market_t<vertex_t, edge_t, weight_t> mm;

using csr_t =
format::csr_t<memory_space_t::device, vertex_t, edge_t, weight_t>;
csr_t csr;
csr.from_coo(mm.load(filename));

// --
// Build graph

auto G = graph::build::from_csr<memory_space_t::device, graph::view_t::csr>(
csr.number_of_rows, // rows
csr.number_of_columns, // columns
csr.number_of_nonzeros, // nonzeros
csr.row_offsets.data().get(), // row_offsets
csr.column_indices.data().get(), // column_indices
csr.nonzero_values.data().get() // values
); // supports row_indices and column_offsets (default = nullptr)

// --
// Params and memory allocation

// vertex_t single_source = 0;
vertex_t n_vertices = G.get_number_of_vertices();
thrust::device_vector<weight_t> bc_values(n_vertices);

// --
// GPU Run

float gpu_elapsed =
gunrock::bc::run(G, /* single_source, */ bc_values.data().get());

// --
// Log + Validate

std::cout << "GPU bc_values (output) = ";
thrust::copy(bc_values.begin(),
(bc_values.size() < 40) ? bc_values.begin() + bc_values.size()
: bc_values.begin() + 40,
std::ostream_iterator<weight_t>(std::cout, " "));
std::cout << std::endl;

std::cout << "GPU Elapsed Time : " << gpu_elapsed << " (ms)" << std::endl;
}

int main(int argc, char** argv) {
test_bc(argc, argv);
}
31 changes: 16 additions & 15 deletions examples/bfs/bfs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,26 @@ void test_bfs(int num_arguments, char** argument_array) {
format::csr_t<memory_space_t::device, vertex_t, edge_t, weight_t>;
csr_t csr;
csr.from_coo(mm.load(filename));

thrust::device_vector<vertex_t> row_indices(csr.number_of_nonzeros);
thrust::device_vector<vertex_t> column_indices(csr.number_of_nonzeros);
thrust::device_vector<edge_t> column_offsets(csr.number_of_columns + 1);

// --
// Build graph + metadata

auto G = graph::build::from_csr<memory_space_t::device,
graph::view_t::csr | graph::view_t::csc>(
csr.number_of_rows, // rows
csr.number_of_columns, // columns
csr.number_of_nonzeros, // nonzeros
csr.row_offsets.data().get(), // row_offsets
csr.column_indices.data().get(), // column_indices
csr.nonzero_values.data().get(), // values
row_indices.data().get(), // row_indices
column_offsets.data().get() // column_offsets
);
auto G =
graph::build::from_csr<memory_space_t::device,
graph::view_t::csr /* | graph::view_t::csc */>(
csr.number_of_rows, // rows
csr.number_of_columns, // columns
csr.number_of_nonzeros, // nonzeros
csr.row_offsets.data().get(), // row_offsets
csr.column_indices.data().get(), // column_indices
csr.nonzero_values.data().get(), // values
row_indices.data().get(), // row_indices
column_offsets.data().get() // column_offsets
);

// --
// Params and memory allocation
Expand All @@ -59,8 +61,8 @@ void test_bfs(int num_arguments, char** argument_array) {
// --
// Run problem

float gpu_elapsed = gunrock::bfs::run(G, single_source, distances.data().get(),
predecessors.data().get());
float gpu_elapsed = gunrock::bfs::run(
G, single_source, distances.data().get(), predecessors.data().get());

// --
// CPU Run
Expand Down Expand Up @@ -94,7 +96,6 @@ void test_bfs(int num_arguments, char** argument_array) {
std::cout << "GPU Elapsed Time : " << gpu_elapsed << " (ms)" << std::endl;
std::cout << "CPU Elapsed Time : " << cpu_elapsed << " (ms)" << std::endl;
std::cout << "Number of errors : " << n_errors << std::endl;

}

int main(int argc, char** argv) {
Expand Down
21 changes: 21 additions & 0 deletions examples/lgc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# begin /* Set the application name. */
set(APPLICATION_NAME lgc)
# end /* Set the application name. */

# begin /* Add CUDA executables */
add_executable(${APPLICATION_NAME})

set(SOURCE_LIST
${APPLICATION_NAME}.cu
)

target_sources(${APPLICATION_NAME} PRIVATE ${SOURCE_LIST})
target_link_libraries(${APPLICATION_NAME} PRIVATE essentials)
get_target_property(ESSENTIALS_ARCHITECTURES essentials CUDA_ARCHITECTURES)
set_target_properties(${APPLICATION_NAME}
PROPERTIES
CUDA_ARCHITECTURES ${ESSENTIALS_ARCHITECTURES}
) # XXX: Find a better way to inherit essentials properties.

message("-- Example Added: ${APPLICATION_NAME}")
# end /* Add CUDA executables */
76 changes: 76 additions & 0 deletions examples/lgc/lgc.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#include <gunrock/applications/lgc.hxx>

using namespace gunrock;
using namespace memory;

void test_lgc(int num_arguments, char** argument_array) {
if (num_arguments != 2) {
std::cerr << "usage: ./bin/<program-name> filename.mtx" << std::endl;
exit(1);
}

// --
// Define types

using vertex_t = int;
using edge_t = int;
using weight_t = float;

using csr_t =
format::csr_t<memory_space_t::device, vertex_t, edge_t, weight_t>;
csr_t csr;

// --
// IO

std::string filename = argument_array[1];

if (util::is_market(filename)) {
io::matrix_market_t<vertex_t, edge_t, weight_t> mm;
csr.from_coo(mm.load(filename));
} else if (util::is_binary_csr(filename)) {
csr.read_binary(filename);
} else {
std::cerr << "Unknown file format: " << filename << std::endl;
exit(1);
}

// --
// Build graph

auto G = graph::build::from_csr<memory_space_t::device, graph::view_t::csr>(
csr.number_of_rows, // rows
csr.number_of_columns, // columns
csr.number_of_nonzeros, // nonzeros
csr.row_offsets.data().get(), // row_offsets
csr.column_indices.data().get(), // column_indices
csr.nonzero_values.data().get() // values
); // supports row_indices and column_offsets (default = nullptr)

// --
// Params and memory allocation

srand(time(NULL));

weight_t alpha = 0.85;
weight_t tol = 1e-6;

vertex_t n_vertices = G.get_number_of_vertices();
thrust::device_vector<weight_t> p(n_vertices);

// --
// GPU Run

float gpu_elapsed = gunrock::pr::run(G, alpha, tol, p.data().get());

// --
// Log + Validate

std::cout << "GPU p[:40] = ";
gunrock::print::head<weight_t>(p, 40);
std::cout << "GPU Elapsed Time : " << gpu_elapsed << " (ms)" << std::endl;
}

int main(int argc, char** argv) {
test_lgc(argc, argv);
}
21 changes: 21 additions & 0 deletions examples/ppr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# begin /* Set the application name. */
set(APPLICATION_NAME ppr)
# end /* Set the application name. */

# begin /* Add CUDA executables */
add_executable(${APPLICATION_NAME})

set(SOURCE_LIST
${APPLICATION_NAME}.cu
)

target_sources(${APPLICATION_NAME} PRIVATE ${SOURCE_LIST})
target_link_libraries(${APPLICATION_NAME} PRIVATE essentials)
get_target_property(ESSENTIALS_ARCHITECTURES essentials CUDA_ARCHITECTURES)
set_target_properties(${APPLICATION_NAME}
PROPERTIES
CUDA_ARCHITECTURES ${ESSENTIALS_ARCHITECTURES}
) # XXX: Find a better way to inherit essentials properties.

message("-- Example Added: ${APPLICATION_NAME}")
# end /* Add CUDA executables */
Loading