From 676ae62aa7251fef92eed4c17169b80a23bbf125 Mon Sep 17 00:00:00 2001 From: Alan Humphrey Date: Sat, 27 Jul 2019 17:59:03 -0700 Subject: [PATCH 1/5] Include Kokkos_Macros.hpp, rather than KokkosCore_config.h directly. --- src/KokkosSetup.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KokkosSetup.hpp b/src/KokkosSetup.hpp index 5b01d7b..88573f9 100644 --- a/src/KokkosSetup.hpp +++ b/src/KokkosSetup.hpp @@ -7,7 +7,7 @@ This file is for the intention of creating things needed by Kokkos. #ifndef KOKKOS_SETUP #define KOKKOS_SETUP -#include +#include #include #include From 26333aaec5ba91c5ce09dcd4ebacf94b7644a482 Mon Sep 17 00:00:00 2001 From: Alan Humphrey Date: Sat, 27 Jul 2019 18:03:31 -0700 Subject: [PATCH 2/5] Fix Kokkos include: Kokkos_Sparse.hpp is now KokkosSparse.hpp. --- src/KokkosSetup.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KokkosSetup.hpp b/src/KokkosSetup.hpp index 88573f9..37e0152 100644 --- a/src/KokkosSetup.hpp +++ b/src/KokkosSetup.hpp @@ -10,7 +10,7 @@ This file is for the intention of creating things needed by Kokkos. #include #include -#include +#include #include "Kokkos_UnorderedMap.hpp" #include "Geometry.hpp" // Just so we have the local_int_t and global_int_t definitions. From a482824abcf71edc9e430104396acba4c7239030 Mon Sep 17 00:00:00 2001 From: Alan Humphrey Date: Sat, 27 Jul 2019 18:07:26 -0700 Subject: [PATCH 3/5] Fix Kokkos typedefs: CrsMatrix is now in the KokkosSparse namespace. --- src/KokkosSetup.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/KokkosSetup.hpp b/src/KokkosSetup.hpp index 37e0152..81ba8d0 100644 --- a/src/KokkosSetup.hpp +++ b/src/KokkosSetup.hpp @@ -62,8 +62,8 @@ typedef const_global_int_2d_type::HostMirror host_const_global_int_2d_type; typedef const_char_1d_type::HostMirror host_const_char_1d_type; //CrsMatrix typedefs //CrsMatrix types -typedef Kokkos::CrsMatrix local_matrix_type; -typedef Kokkos::CrsMatrix global_matrix_type; +typedef KokkosSparse::CrsMatrix local_matrix_type; +typedef KokkosSparse::CrsMatrix global_matrix_type; typedef local_matrix_type::values_type values_type; // View for matrix values, similar to double_1d_type. typedef local_matrix_type::index_type local_index_type; // View for column Indices, similar to local_int_1d_type. typedef global_matrix_type::index_type global_index_type; From 5efa8ccffa845c56428359eae1e88e3144945db5 Mon Sep 17 00:00:00 2001 From: Alan Humphrey Date: Sat, 27 Jul 2019 18:29:21 -0700 Subject: [PATCH 4/5] Update deprecated 'dimension' functions in favor of ISO/C++ vocabulary, 'extent'. --- src/CG.cpp | 6 +++--- src/ColorReorder.cpp | 14 +++++++------- src/Coloring.cpp | 20 ++++++++++---------- src/LevelSYMGS.cpp | 4 ++-- src/LevelScheduler.cpp | 6 +++--- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/CG.cpp b/src/CG.cpp index c174fcd..5b45a6b 100644 --- a/src/CG.cpp +++ b/src/CG.cpp @@ -147,12 +147,12 @@ int CG(const SparseMatrix & A, CGData & data, const Vector & b, Vector & x, local_int_1d_type orig_rows = A_Optimized-> orig_rows; Optivector * x_Optimized = (Optivector *) x.optimizationData; double_1d_type x_values = x_Optimized->values; - double_1d_type x_copy = double_1d_type("", x_values.dimension_0()); + double_1d_type x_copy = double_1d_type("", x_values.extent(0)); /* - for(int i = 0; i < x_values.dimension_0(); i++) + for(int i = 0; i < x_values.extent(0); i++) x_copy(orig_rows(i)) = x_values(i); */ - Kokkos::parallel_for(x_values.dimension_0(), PermuteX(orig_rows, x_copy, x_values)); + Kokkos::parallel_for(x_values.extent(0), PermuteX(orig_rows, x_copy, x_values)); //for(int i = 0; i < 10; i++) // std::cout<<"Px("<localMatrix; Coloring::array_type colors("colors", A.localNumberOfRows); - Coloring::array_type idx("idx", localMatrix.graph.row_map.dimension_0()); // Should be A.localNumberOfRows+1 length - Coloring::array_type adj("adj", localMatrix.graph.entries.dimension_0()); // Should be A.LocalNumberOfNonzeros. - Kokkos::parallel_for(localMatrix.graph.row_map.dimension_0(), fillIdx(idx, localMatrix.graph.row_map)); - Kokkos::parallel_for(localMatrix.graph.entries.dimension_0(), fillAdj(adj, localMatrix.graph.entries)); + Coloring::array_type idx("idx", localMatrix.graph.row_map.extent(0)); // Should be A.localNumberOfRows+1 length + Coloring::array_type adj("adj", localMatrix.graph.entries.extent(0)); // Should be A.LocalNumberOfNonzeros. + Kokkos::parallel_for(localMatrix.graph.row_map.extent(0), fillIdx(idx, localMatrix.graph.row_map)); + Kokkos::parallel_for(localMatrix.graph.entries.extent(0), fillAdj(adj, localMatrix.graph.entries)); Coloring c(A.localNumberOfRows, idx, adj, colors); c.color(false, false, false); // Flags are as follows... Use conflict List, Serial Resolve Conflict, Time and show. int numColors = c.getNumColors(); @@ -303,4 +303,4 @@ int doColoring(SparseMatrix & A){ if(A.Ac != 0) return doColoring(*A.Ac); return(0); } -#endif \ No newline at end of file +#endif diff --git a/src/LevelSYMGS.cpp b/src/LevelSYMGS.cpp index d851428..d9b291e 100644 --- a/src/LevelSYMGS.cpp +++ b/src/LevelSYMGS.cpp @@ -107,7 +107,7 @@ assert(x.localLength == A.localNumberOfColumns); // Make sure x contains space f Optivector * x_Optimized = (Optivector *) x.optimizationData; double_1d_type x_values = x_Optimized->values; - double_1d_type z("z", x_values.dimension_0()); + double_1d_type z("z", x_values.extent(0)); #ifdef KOKKOS_TEAM const int row_per_team=256; const int vector_size = 32; @@ -129,7 +129,7 @@ assert(x.localLength == A.localNumberOfColumns); // Make sure x contains space f execution_space::fence(); } - + #else for(int i = 0; i < f_numLevels; i++){ int start = f_lev_map(i); diff --git a/src/LevelScheduler.cpp b/src/LevelScheduler.cpp index 69f8f81..187ca25 100644 --- a/src/LevelScheduler.cpp +++ b/src/LevelScheduler.cpp @@ -14,7 +14,7 @@ class fillColorsMap{ void operator()(const int & i)const{ int color = i+1; int total = 0; - for(unsigned j = 0; j < colors.dimension_0(); j++) + for(unsigned j = 0; j < colors.extent(0); j++) if(colors(j) == color) total++; colors_map(color) = total; } @@ -50,7 +50,7 @@ class fillColorsInd{ void operator()(const int & i)const{ int color = i+1; // Colors start at 1 and i starts at 0. int start = colors_map(i); - for(unsigned j = 0; j < colors.dimension_0(); j++){ + for(unsigned j = 0; j < colors.extent(0); j++){ if(colors(j) == color){ colors_ind(start) = j; start++; @@ -162,4 +162,4 @@ int levelSchedule(SparseMatrix & A){ else return(0); } -#endif \ No newline at end of file +#endif From 8504c51b88f1fb1270592a1706a100bd937a84d9 Mon Sep 17 00:00:00 2001 From: Alan Humphrey Date: Sat, 27 Jul 2019 18:36:11 -0700 Subject: [PATCH 5/5] Update 'fence' calls. 'fence' is now a member function, so needs and object instance. --- src/LevelSYMGS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LevelSYMGS.cpp b/src/LevelSYMGS.cpp index d9b291e..d08234b 100644 --- a/src/LevelSYMGS.cpp +++ b/src/LevelSYMGS.cpp @@ -118,7 +118,7 @@ assert(x.localLength == A.localNumberOfColumns); // Make sure x contains space f int numberOfTeams = level_index_end - level_index_begin; Kokkos::parallel_for(team_policy(numberOfTeams/teamSizeMax + 1, teamSizeMax, vector_size), LeveledSweep(level_index_begin, level_index_end, localMatrix, f_lev_ind, r_values, x_values)); - execution_space::fence(); + execution_space().fence(); } for(int i = 0; i < b_numLevels; i++){ int level_index_begin = b_lev_map(i); @@ -126,7 +126,7 @@ assert(x.localLength == A.localNumberOfColumns); // Make sure x contains space f int numberOfTeams = level_index_end - level_index_begin; Kokkos::parallel_for(team_policy(numberOfTeams/teamSizeMax + 1, teamSizeMax, vector_size), LeveledSweep(level_index_begin, level_index_end, localMatrix, b_lev_ind, r_values, x_values)); - execution_space::fence(); + execution_space().fence(); }