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

Commit

Permalink
Merge pull request #149 from gunrock/dev
Browse files Browse the repository at this point in the history
Fixes for Graph Coloring and minor edits.
  • Loading branch information
neoblizz authored Jul 27, 2022
2 parents 4ac6c6d + 05ec65f commit 80c0d17
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 75 # Set required architecture.
# CUDA_PTX_COMPILATION ON # Can only be applied to OBJ.
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/FetchCUB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FetchThrustCUB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions examples/algorithms/color/color.cu
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,24 @@ void test_color(int num_arguments, char** argument_array) {

thrust::host_vector<vertex_t> h_colors(n_vertices);

float cpu_elapsed =
color_cpu::run<csr_t, vertex_t, edge_t, weight_t>(csr, h_colors.data());
float cpu_elapsed =
color_cpu::run<csr_t, vertex_t, edge_t, weight_t>(csr, h_colors.data());

int n_errors = color_cpu::compute_error<csr_t, vertex_t, edge_t, weight_t>(
csr, colors, h_colors);

std::vector<int> 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");

std::cout << "GPU Elapsed Time : " << gpu_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;
}

Expand Down
6 changes: 3 additions & 3 deletions include/gunrock/algorithms/color.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ struct enactor_t : gunrock::enactor_t<problem_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;
}

Expand Down Expand Up @@ -179,4 +179,4 @@ float run(graph_t& G,
}

} // namespace color
} // namespace gunrock
} // namespace gunrock
4 changes: 2 additions & 2 deletions include/gunrock/graph/csr.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/gunrock/graph/properties.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace graph {
*/
struct graph_properties_t {
bool directed{false};
bool weighted{false};
bool weighted{true};
graph_properties_t() = default;
};

Expand Down

0 comments on commit 80c0d17

Please sign in to comment.