]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Deal with empty ranges in CUDAWrappers::MatrixFree::internal_reinit
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Apr 2019 20:31:38 +0000 (22:31 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Apr 2019 20:31:38 +0000 (22:31 +0200)
include/deal.II/matrix_free/cuda_matrix_free.templates.h

index 67720c10edd27c71b0fe637b52304faff795c19b..64a399bb68cdd60588a448b3e9bc90969a327cfd 100644 (file)
@@ -866,8 +866,9 @@ namespace CUDAWrappers
       return internal::get_conflict_indices<dim, Number>(filter, constraints);
     };
 
-    std::vector<std::vector<CellFilter>> graph =
-      GraphColoring::make_graph_coloring(begin, end, fun);
+    std::vector<std::vector<CellFilter>> graph;
+    if (begin != end)
+      graph = GraphColoring::make_graph_coloring(begin, end, fun);
     n_colors = graph.size();
 
     helper.setup_color_arrays(n_colors);
@@ -894,8 +895,8 @@ namespace CUDAWrappers
 
     // Setup row starts
     row_start[0] = 0;
-    for (unsigned int i = 0; i < n_colors - 1; ++i)
-      row_start[i + 1] = row_start[i] + n_cells[i] * get_padding_length();
+    for (unsigned int i = 1; i < n_colors; ++i)
+      row_start[i] = row_start[i - 1] + n_cells[i - 1] * get_padding_length();
 
     // Constrained indices
     n_constrained_dofs = constraints.n_constraints();

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.