From 181dedac2dbfe6500f693dec59d61a0c3b9c7c52 Mon Sep 17 00:00:00 2001 From: neoblizz Date: Mon, 27 Jun 2022 14:17:19 -0700 Subject: [PATCH 1/5] Bump CUB/Thrust. --- cmake/FetchCUB.cmake | 2 +- cmake/FetchThrustCUB.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FetchCUB.cmake b/cmake/FetchCUB.cmake index 4ac5e1dd..a70a25e9 100644 --- a/cmake/FetchCUB.cmake +++ b/cmake/FetchCUB.cmake @@ -9,7 +9,7 @@ set(FETCHCONTENT_BASE_DIR ${FC_BASE}) FetchContent_Declare( cub GIT_REPOSITORY https://github.com/NVIDIA/cub.git - GIT_TAG 1.15.0 + GIT_TAG 1.17.0 ) FetchContent_GetProperties(cub) diff --git a/cmake/FetchThrustCUB.cmake b/cmake/FetchThrustCUB.cmake index 01aa5162..eb23b488 100644 --- a/cmake/FetchThrustCUB.cmake +++ b/cmake/FetchThrustCUB.cmake @@ -9,7 +9,7 @@ set(FETCHCONTENT_BASE_DIR ${FC_BASE}) FetchContent_Declare( thrust GIT_REPOSITORY https://github.com/thrust/thrust.git - GIT_TAG 1.16.0 + GIT_TAG 1.17.0 ) FetchContent_GetProperties(thrust) From 300b08106943207695eb7e09b440a6e8b034f15c Mon Sep 17 00:00:00 2001 From: neoblizz Date: Mon, 27 Jun 2022 14:18:10 -0700 Subject: [PATCH 2/5] Minor changes. --- include/gunrock/graph/csr.hxx | 4 ++-- include/gunrock/graph/properties.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gunrock/graph/csr.hxx b/include/gunrock/graph/csr.hxx index 1dfc2b6f..f7400a2f 100644 --- a/include/gunrock/graph/csr.hxx +++ b/include/gunrock/graph/csr.hxx @@ -93,8 +93,8 @@ class graph_csr_t { __host__ __device__ __forceinline__ edge_type get_edge(const vertex_type& source, const vertex_type& destination) const { return (edge_type)search::binary::execute(get_column_indices(), destination, - offsets[source], - offsets[source + 1] - 1); + get_starting_edge(source), + get_starting_edge(source + 1) - 1); } /** diff --git a/include/gunrock/graph/properties.hxx b/include/gunrock/graph/properties.hxx index 0fc239a7..4165c941 100644 --- a/include/gunrock/graph/properties.hxx +++ b/include/gunrock/graph/properties.hxx @@ -12,7 +12,7 @@ namespace graph { */ struct graph_properties_t { bool directed{false}; - bool weighted{false}; + bool weighted{true}; graph_properties_t() = default; }; From 350835fc9d44e35313f28f57ce4e0ed3336e1b6c Mon Sep 17 00:00:00 2001 From: LeaX-XIV Date: Thu, 30 Jun 2022 15:54:16 +0200 Subject: [PATCH 3/5] Change settings to match preferences --- CMakeLists.txt | 2 +- examples/algorithms/color/color.cu | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 368acf29..2256dcf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ set_target_properties(essentials CUDA_EXTENSIONS OFF CUDA_RESOLVE_DEVICE_SYMBOLS ON CUDA_SEPARABLE_COMPILATION ON - CUDA_ARCHITECTURES 61 # Set required architecture. + CUDA_ARCHITECTURES 80 # Set required architecture. # CUDA_PTX_COMPILATION ON # Can only be applied to OBJ. ) diff --git a/examples/algorithms/color/color.cu b/examples/algorithms/color/color.cu index 0e076e5e..aa0c9e96 100644 --- a/examples/algorithms/color/color.cu +++ b/examples/algorithms/color/color.cu @@ -59,19 +59,24 @@ void test_color(int num_arguments, char** argument_array) { thrust::host_vector h_colors(n_vertices); - float cpu_elapsed = - color_cpu::run(csr, h_colors.data()); + // float cpu_elapsed = + // color_cpu::run(csr, h_colors.data()); int n_errors = color_cpu::compute_error( csr, colors, h_colors); + std::vector stl_colors(n_vertices); + thrust::copy(colors.begin(), colors.end(), stl_colors.begin()); + int n_colors = std::set(stl_colors.begin(), stl_colors.end()).size(); + // -- // Log print::head(colors, 40, "GPU colors"); - print::head(h_colors, 40, "CPU colors"); + // print::head(h_colors, 40, "CPU colors"); std::cout << "GPU Elapsed Time : " << gpu_elapsed << " (ms)" << std::endl; - std::cout << "CPU Elapsed Time : " << cpu_elapsed << " (ms)" << std::endl; + // std::cout << "CPU Elapsed Time : " << cpu_elapsed << " (ms)" << std::endl; + std::cout << "Number of colors : " << n_colors << std::endl; std::cout << "Number of errors : " << n_errors << std::endl; } From 52f72614efc37eca8feb486184d198b296558c11 Mon Sep 17 00:00:00 2001 From: LeaX-XIV Date: Thu, 30 Jun 2022 15:56:19 +0200 Subject: [PATCH 4/5] Add tie breaking conditionals to GPU code --- include/gunrock/algorithms/color.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gunrock/algorithms/color.hxx b/include/gunrock/algorithms/color.hxx index c862a548..6f110158 100644 --- a/include/gunrock/algorithms/color.hxx +++ b/include/gunrock/algorithms/color.hxx @@ -126,9 +126,9 @@ struct enactor_t : gunrock::enactor_t { continue; auto rand_u = randoms[u]; - if (rand_v <= rand_u) + if (rand_v < rand_u || (rand_v == rand_u && vertex < u)) colormax = false; - if (rand_v >= rand_u) + if (rand_v > rand_u || (rand_v == rand_u && vertex > u)) colormin = false; } @@ -179,4 +179,4 @@ float run(graph_t& G, } } // namespace color -} // namespace gunrock \ No newline at end of file +} // namespace gunrock From 05ec65f309e60f665e45a4cf97079c86506fafbf Mon Sep 17 00:00:00 2001 From: neoblizz Date: Tue, 12 Jul 2022 11:44:49 -0700 Subject: [PATCH 5/5] Minor changes, uncommenting cpu_color. --- CMakeLists.txt | 2 +- examples/algorithms/color/color.cu | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2256dcf0..582a4466 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ set_target_properties(essentials CUDA_EXTENSIONS OFF CUDA_RESOLVE_DEVICE_SYMBOLS ON CUDA_SEPARABLE_COMPILATION ON - CUDA_ARCHITECTURES 80 # Set required architecture. + CUDA_ARCHITECTURES 75 # Set required architecture. # CUDA_PTX_COMPILATION ON # Can only be applied to OBJ. ) diff --git a/examples/algorithms/color/color.cu b/examples/algorithms/color/color.cu index aa0c9e96..dd5c953e 100644 --- a/examples/algorithms/color/color.cu +++ b/examples/algorithms/color/color.cu @@ -59,8 +59,8 @@ void test_color(int num_arguments, char** argument_array) { thrust::host_vector h_colors(n_vertices); - // float cpu_elapsed = - // color_cpu::run(csr, h_colors.data()); + float cpu_elapsed = + color_cpu::run(csr, h_colors.data()); int n_errors = color_cpu::compute_error( csr, colors, h_colors); @@ -72,10 +72,10 @@ void test_color(int num_arguments, char** argument_array) { // -- // Log print::head(colors, 40, "GPU colors"); - // print::head(h_colors, 40, "CPU colors"); + print::head(h_colors, 40, "CPU colors"); std::cout << "GPU Elapsed Time : " << gpu_elapsed << " (ms)" << std::endl; - // std::cout << "CPU Elapsed Time : " << cpu_elapsed << " (ms)" << std::endl; + std::cout << "CPU Elapsed Time : " << cpu_elapsed << " (ms)" << std::endl; std::cout << "Number of colors : " << n_colors << std::endl; std::cout << "Number of errors : " << n_errors << std::endl; }