16template<
class MatrixType,
class ContainerType1,
class ContainerType2>
17void symv( MatrixType&& M,
18 const ContainerType1&
x,
20template<
class FunctorType,
class MatrixType,
class ContainerType1,
class ContainerType2>
21void stencil( FunctorType f, MatrixType&& M,
22 const ContainerType1&
x,
24template<
class MatrixType,
class ContainerType1,
class ContainerType2>
27 const ContainerType1&
x,
63template<
class LocalMatrixInner,
class LocalMatrixOuter,
class Collective >
77 RowColDistMat(
const LocalMatrixInner& inside,
const LocalMatrixOuter& outside,
const Collective& c):
78 m_i(inside), m_o(outside), m_c(c), m_buffer( c.allocate_buffer()) { }
92 template<
class OtherMatrixInner,
class OtherMatrixOuter,
class OtherCollective>
118 template<
class ContainerType1,
class ContainerType2>
122 if( !m_c.isCommunicating())
129 MPI_Comm_compare(
x.communicator(),
y.communicator(), &result);
130 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
131 MPI_Comm_compare(
x.communicator(), m_c.communicator(), &result);
132 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
136 const value_type * x_ptr = thrust::raw_pointer_cast(
x.data().data());
137 value_type * y_ptr = thrust::raw_pointer_cast(
y.data().data());
138 m_c.global_gather_init( x_ptr, m_buffer.
data(), rqst);
142 m_c.global_gather_wait( x_ptr, m_buffer.
data(), rqst);
144 const value_type** b_ptr = thrust::raw_pointer_cast(m_buffer.
data().data());
158 template<
class ContainerType1,
class ContainerType2>
159 void symv(
const ContainerType1& x, ContainerType2& y)
const
162 if( !m_c.isCommunicating())
169 MPI_Comm_compare(
x.communicator(),
y.communicator(), &result);
170 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
171 MPI_Comm_compare(
x.communicator(), m_c.communicator(), &result);
172 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
176 const value_type * x_ptr = thrust::raw_pointer_cast(
x.data().data());
177 value_type * y_ptr = thrust::raw_pointer_cast(
y.data().data());
178 m_c.global_gather_init( x_ptr, m_buffer.
data(), rqst);
182 m_c.global_gather_wait( x_ptr, m_buffer.
data(), rqst);
184 const value_type** b_ptr = thrust::raw_pointer_cast(m_buffer.
data().data());
189 LocalMatrixInner m_i;
190 LocalMatrixOuter m_o;
217template<
class LocalMatrix,
class Collective >
231 m_m(m), m_c(c), m_buffer( c.allocate_buffer()), m_dist( dist) { }
240 template<
class OtherMatrix,
class OtherCollective>
248 const LocalMatrix&
matrix()
const{
return m_m;}
259 template<
class ContainerType1,
class ContainerType2>
263 if( !m_c->isCommunicating())
270 MPI_Comm_compare(
x.communicator(),
y.communicator(), &result);
271 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
272 MPI_Comm_compare(
x.communicator(), m_c->communicator(), &result);
273 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
275 const value_type * x_ptr = thrust::raw_pointer_cast(
x.data().data());
276 m_c->global_gather( x_ptr, m_buffer.
data());
281 value_type * y_ptr = thrust::raw_pointer_cast(
y.data().data());
282 m_c->global_scatter_reduce( m_buffer.
data(), y_ptr);
285 template<
class ContainerType1,
class ContainerType2>
286 void symv(
const ContainerType1& x, ContainerType2& y)
const
289 if( !m_c->isCommunicating())
296 MPI_Comm_compare(
x.communicator(),
y.communicator(), &result);
297 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
298 MPI_Comm_compare(
x.communicator(), m_c->communicator(), &result);
299 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
301 const value_type * x_ptr = thrust::raw_pointer_cast(
x.data().data());
302 m_c->global_gather( x_ptr, m_buffer.
data());
307 value_type * y_ptr = thrust::raw_pointer_cast(
y.data().data());
308 m_c->global_scatter_reduce( m_buffer.
data(), y_ptr);
311 template<
class Functor,
class ContainerType1,
class ContainerType2>
312 void stencil(
const Functor f,
const ContainerType1& x, ContainerType2& y)
const
315 if( !m_c->isCommunicating())
322 MPI_Comm_compare(
x.communicator(),
y.communicator(), &result);
323 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
324 MPI_Comm_compare(
x.communicator(), m_c->communicator(), &result);
325 assert( result == MPI_CONGRUENT || result == MPI_IDENT);
327 const value_type * x_ptr = thrust::raw_pointer_cast(
x.data().data());
328 m_c->global_gather( x_ptr, m_buffer.
data());
332 throw Error(
Message(
_ping_)<<
"stencil cannot be used with a column distributed mpi matrix!");
346template<
class LI,
class LO,
class C>
353template<
class L,
class C>
class intended for the use in throw statements
Definition: exceptions.h:83
small class holding a stringstream
Definition: exceptions.h:29
#define _ping_
Definition: exceptions.h:12
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:287
void stencil(FunctorType f, MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:423
dist_type
Type of distribution of MPI distributed matrices.
Definition: mpi_matrix.h:198
@ col_dist
Column distributed.
Definition: mpi_matrix.h:200
@ row_dist
Row distributed.
Definition: mpi_matrix.h:199
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
typename TensorTraits< std::decay_t< Vector > >::execution_policy get_execution_policy
Definition: tensor_traits.h:42
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
T & data() const
Get write access to the data on the heap.
Definition: memory.h:187
Distributed memory matrix class.
Definition: mpi_matrix.h:219
void stencil(const Functor f, const ContainerType1 &x, ContainerType2 &y) const
Definition: mpi_matrix.h:312
MPIDistMat(const MPIDistMat< OtherMatrix, OtherCollective > &src)
Copy Constructor.
Definition: mpi_matrix.h:241
get_value_type< LocalMatrix > value_type
Definition: mpi_matrix.h:220
const LocalMatrix & matrix() const
Access to the local matrix.
Definition: mpi_matrix.h:248
MPIDistMat(const LocalMatrix &m, const Collective &c, enum dist_type dist=row_dist)
Constructor.
Definition: mpi_matrix.h:230
void symv(const ContainerType1 &x, ContainerType2 &y) const
Definition: mpi_matrix.h:286
enum dist_type get_dist() const
Definition: mpi_matrix.h:256
void set_dist(enum dist_type dist)
Definition: mpi_matrix.h:257
void symv(value_type alpha, const ContainerType1 &x, value_type beta, ContainerType2 &y) const
Definition: mpi_matrix.h:260
MPIDistMat()
no memory allocation
Definition: mpi_matrix.h:222
const Collective & collective() const
Access to the communication object.
Definition: mpi_matrix.h:254
indicate one of our mpi matrices
Definition: matrix_categories.h:31
Distributed memory matrix class, asynchronous communication.
Definition: mpi_matrix.h:65
const LocalMatrixInner & inner_matrix() const
Read access to the inner matrix.
Definition: mpi_matrix.h:96
RowColDistMat(const RowColDistMat< OtherMatrixInner, OtherMatrixOuter, OtherCollective > &src)
Copy constructor.
Definition: mpi_matrix.h:93
get_value_type< LocalMatrixInner > value_type
Definition: mpi_matrix.h:66
void symv(value_type alpha, const ContainerType1 &x, value_type beta, ContainerType2 &y) const
Matrix Vector product.
Definition: mpi_matrix.h:119
LocalMatrixOuter & outer_matrix()
Write access to the outer matrix.
Definition: mpi_matrix.h:102
const LocalMatrixOuter & outer_matrix() const
Read access to the outer matrix.
Definition: mpi_matrix.h:100
LocalMatrixInner & inner_matrix()
Write access to the inner matrix.
Definition: mpi_matrix.h:98
RowColDistMat()
no memory allocation
Definition: mpi_matrix.h:68
const Collective & collective() const
Read access to the communication object.
Definition: mpi_matrix.h:104
void symv(const ContainerType1 &x, ContainerType2 &y) const
Matrix Vector product.
Definition: mpi_matrix.h:159
RowColDistMat(const LocalMatrixInner &inside, const LocalMatrixOuter &outside, const Collective &c)
Constructor.
Definition: mpi_matrix.h:77
Indicate a contiguous chunk of shared memory.
Definition: vector_categories.h:41
get_value_type< L > value_type
value type
Definition: mpi_matrix.h:356
get_value_type< LI > value_type
value type
Definition: mpi_matrix.h:349
The vector traits.
Definition: tensor_traits.h:31