This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from gunrock/dev
Feature merge (dev to master)
- Loading branch information
Showing
53 changed files
with
2,002 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,6 @@ eval/ | |
|
||
# Ignore build directory | ||
build | ||
|
||
# Ignore external fetched content | ||
externals/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
Oops, something went wrong.