Skip to content

Commit

Permalink
Merge pull request #323 from lucbv/DeterministicColoring_fix317
Browse files Browse the repository at this point in the history
Deterministic Coloring: reactivating VBD and VBDBIT unit test
  • Loading branch information
ndellingwood authored Oct 12, 2018
2 parents 69e8469 + d3b4620 commit 83fca4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
20 changes: 8 additions & 12 deletions src/graph/impl/KokkosGraph_GraphColor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2494,15 +2494,12 @@ class GraphColor_VBD:public GraphColor <HandleType,lno_row_view_t_,lno_nnz_view_
nnz_lno_t numVertices = this->nv;

size_type maxColors = 0;
const_lno_row_view_t myXadj = this->xadj;
const_lno_nnz_view_t myAdj = this->adj;
nnz_lno_persistent_work_view_t score
= nnz_lno_persistent_work_view_t(Kokkos::ViewAllocateWithoutInitializing("score"), numVertices);
typedef typename Kokkos::Experimental::Max<size_type, MyExecSpace> maxScoreReducerType;
maxScoreReducerType maxScoreReducer(maxColors);
functorScoreCalculation<size_type, MyExecSpace> scoreCalculation(score, myXadj);
Kokkos::parallel_reduce("Deterministic Coloring: compute initial scores", my_exec_space(0, numVertices),
scoreCalculation, maxScoreReducer);
= nnz_lno_persistent_work_view_t(Kokkos::ViewAllocateWithoutInitializing("score"), this->nv);
functorScoreCalculation<size_type, MyExecSpace> scoreCalculation(score, this->xadj);

Kokkos::parallel_reduce("Deterministic Coloring: compute initial scores", my_exec_space(0, this->nv),
scoreCalculation, Kokkos::Max<size_type>(maxColors));

if (this->_ticToc) {
std::cout << "maxColors: " << maxColors << std::endl;
Expand Down Expand Up @@ -2572,17 +2569,16 @@ class GraphColor_VBD:public GraphColor <HandleType,lno_row_view_t_,lno_nnz_view_

template <class max_type, class execution_space>
struct functorScoreCalculation {
typedef typename Kokkos::Experimental::Max<max_type, execution_space>::value_type valueType;
nnz_lno_persistent_work_view_t score_;
const_lno_row_view_t numNeighbors_;

functorScoreCalculation(nnz_lno_persistent_work_view_t score, const_lno_row_view_t numNeighbors)
functorScoreCalculation(nnz_lno_persistent_work_view_t& score, const_lno_row_view_t& numNeighbors)
: score_(score), numNeighbors_(numNeighbors) {}

KOKKOS_INLINE_FUNCTION
void operator() (const int i, valueType &update) const {
void operator() (const int i, size_type &update) const {
score_(i) = numNeighbors_(i + 1) - numNeighbors_(i);
update = ( (valueType) score_(i) < update ? update : (valueType) score_(i) );
update = ( (size_type) score_(i) < update ? update : (size_type) score_(i) );
}
}; // functorScoreCalculation()

Expand Down
2 changes: 0 additions & 2 deletions unit_test/graph/Test_Graph_graph_color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,9 @@ void test_coloring(lno_t numRows,size_type nnz, lno_t bandwidth, lno_t row_size_
if( !std::is_same< typename device::execution_space, Kokkos::Cuda >::value )
{
coloring_algorithms.push_back(COLORING_VBD);
coloring_algorithms.push_back(COLORING_VBDBIT);
}
#else
coloring_algorithms.push_back(COLORING_VBD);
coloring_algorithms.push_back(COLORING_VBDBIT);
#endif

for (size_t ii = 0; ii < coloring_algorithms.size(); ++ii) {
Expand Down
9 changes: 0 additions & 9 deletions unit_test/graph/Test_Graph_graph_color_deterministic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ int run_graphcolor_deter(

kh.create_graph_coloring_handle(coloring_algorithm);


const size_t num_rows_1 = input_mat.numRows();
const size_t num_cols_1 = input_mat.numCols();

Expand Down Expand Up @@ -153,16 +152,8 @@ void test_coloring_deterministic(lno_t numRows, size_type nnz) {

std::vector<ColoringAlgorithm> coloring_algorithms;

#ifdef KOKKOS_ENABLE_CUDA
if( !std::is_same< typename device::execution_space, Kokkos::Cuda >::value )
{
coloring_algorithms.push_back(COLORING_VBD);
coloring_algorithms.push_back(COLORING_VBDBIT);
}
#else
coloring_algorithms.push_back(COLORING_VBD);
coloring_algorithms.push_back(COLORING_VBDBIT);
#endif

for (size_t ii = 0; ii < coloring_algorithms.size(); ++ii) {
ColoringAlgorithm coloring_algorithm = coloring_algorithms[ii];
Expand Down

0 comments on commit 83fca4a

Please sign in to comment.