Skip to content

Commit

Permalink
Merge pull request #2648 from rppawlo/kokkos-view-of-crs-matrices
Browse files Browse the repository at this point in the history
Kokkos/Kokkos-Kernels: support view of crs matrices on cuda
  • Loading branch information
rppawlo authored Apr 26, 2018
2 parents 34292a1 + f27825c commit cd6dc17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/kokkos-kernels/src/sparse/KokkosSparse_CrsMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ inline int RowsPerThread<Kokkos::Cuda>(const int NNZPerRow) {
struct DeviceConfig {
struct Dim3 {
size_t x, y, z;
KOKKOS_INLINE_FUNCTION
Dim3(const size_t x_, const size_t y_ = 1, const size_t z_ = 1) :
x(x_), y(y_), z(z_) {}
};
Expand All @@ -121,6 +122,7 @@ struct DeviceConfig {
size_t num_blocks;
size_t num_threads_per_block;

KOKKOS_INLINE_FUNCTION
DeviceConfig(const size_t num_blocks_ = 0,
const size_t threads_per_block_x_ = 0,
const size_t threads_per_block_y_ = 0,
Expand Down Expand Up @@ -454,6 +456,7 @@ class CrsMatrix {
/// FIXME (mfh 09 Aug 2013) numCols and nnz should be properties of
/// the graph, not the matrix. Then CrsMatrix needs methods to get
/// these from the graph.
KOKKOS_INLINE_FUNCTION
CrsMatrix () :
numCols_ (0)
{}
Expand All @@ -464,6 +467,7 @@ class CrsMatrix {
class DType,
class MTType,
typename IType>
KOKKOS_INLINE_FUNCTION
CrsMatrix (const CrsMatrix<SType,OType,DType,MTType,IType> & B) :
graph (B.graph.entries, B.graph.row_map),
values (B.values),
Expand Down
5 changes: 5 additions & 0 deletions packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,17 @@ class StaticCrsGraph {
row_block_type row_block_offsets;

//! Construct an empty view.
KOKKOS_INLINE_FUNCTION
StaticCrsGraph () : entries(), row_map(), row_block_offsets() {}

//! Copy constructor (shallow copy).
KOKKOS_INLINE_FUNCTION
StaticCrsGraph (const StaticCrsGraph& rhs) : entries (rhs.entries), row_map (rhs.row_map),
row_block_offsets(rhs.row_block_offsets)
{}

template<class EntriesType, class RowMapType>
KOKKOS_INLINE_FUNCTION
StaticCrsGraph (const EntriesType& entries_,const RowMapType& row_map_) : entries (entries_), row_map (row_map_),
row_block_offsets()
{}
Expand All @@ -314,6 +317,7 @@ class StaticCrsGraph {
* If the old view is the last view
* then allocated memory is deallocated.
*/
KOKKOS_INLINE_FUNCTION
StaticCrsGraph& operator= (const StaticCrsGraph& rhs) {
entries = rhs.entries;
row_map = rhs.row_map;
Expand All @@ -324,6 +328,7 @@ class StaticCrsGraph {
/** \brief Destroy this view of the array.
* If the last view then allocated memory is deallocated.
*/
KOKKOS_INLINE_FUNCTION
~StaticCrsGraph() {}

/** \brief Return number of rows in the graph
Expand Down

0 comments on commit cd6dc17

Please sign in to comment.