50 #include "EpetraExt_BlockUtility.h"
52 #include "impl/Kokkos_Timer.hpp"
65 template<
typename IntType >
72 return k + N * ( j + N * i );
75 template <
typename ordinal >
78 std::vector< std::vector<ordinal> > & graph )
80 graph.resize( N * N * N , std::vector<ordinal>() );
84 for (
int i = 0 ; i < (int) N ; ++i ) {
85 for (
int j = 0 ;
j < (int) N ; ++
j ) {
86 for (
int k = 0 ; k < (int) N ; ++k ) {
90 graph[row].reserve(27);
92 for (
int ii = -1 ; ii < 2 ; ++ii ) {
93 for (
int jj = -1 ; jj < 2 ; ++jj ) {
94 for (
int kk = -1 ; kk < 2 ; ++kk ) {
95 if ( 0 <= i + ii && i + ii < (
int) N &&
96 0 <=
j + jj &&
j + jj < (
int) N &&
97 0 <= k + kk && k + kk < (
int) N ) {
100 graph[row].push_back(col);
103 total += graph[row].size();
110 run_test(
const int p,
const int d,
const int nGrid,
const int nIter,
124 for (
int i=0; i<d; i++)
127 int stoch_length = basis->size();
145 rcp(EpetraExt::BlockUtility::GenerateBlockMap(
146 *map, *stoch_row_map, *sg_comm));
150 map, map, sg_map, sg_map,
157 basis, sg_A_overlap_map, map, map, sg_map, sg_comm));
158 for (
int i=0; i<stoch_length; i++) {
162 A_sg_blocks->setCoeffPtr(i, A);
168 basis, stoch_row_map, map, sg_map, sg_comm));
171 basis, stoch_row_map, map, sg_map, sg_comm));
176 Kokkos::Impl::Timer clock;
177 for (
int iter=0; iter<nIter; ++iter)
180 const double t = clock.seconds() / ((
double) nIter );
182 const double gflops = 1.0e-9 * flops / t;
184 if (globalComm->
MyPID() == 0)
185 std::cout << nGrid <<
" , "
199 MPI_Init(&argc,&argv);
212 if (globalComm->
MyPID() == 0)
213 std::cout << std::endl
215 <<
"\"#Variable\" , "
216 <<
"\"PolyDegree\" , "
218 <<
"\"MXV GFLOPS\" , "
222 const int nGrid = 32;
225 const int fem_length = nGrid * nGrid * nGrid;
227 std::vector< std::vector<int> > fem_graph;
232 for (
int i=0; i<num_my_GIDs; ++i) {
233 int row = my_GIDs[i];
234 int num_indices = fem_graph[row].size();
235 int *indices = &(fem_graph[row][0]);
242 for (
int d=1; d<=12; ++d)
243 run_test(p, d, nGrid, nIter, globalComm, map, graph);
248 for (
int d=1; d<=6; ++d)
249 run_test(p, d, nGrid, nIter, globalComm, map, graph);
An Epetra operator representing the block stochastic Galerkin operator.
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
Multivariate orthogonal polynomial basis generated from a total order tensor product of univariate po...
Teuchos::RCP< const EpetraExt::MultiComm > getMultiComm() const
Get global comm.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
ordinal generate_fem_graph(ordinal N, std::vector< std::vector< ordinal > > &graph)
int MyGlobalElements(int *MyGlobalElementList) const
void init(const value_type &val)
Initialize coefficients.
Teuchos::RCP< EpetraExt::BlockVector > getBlockVector()
Get block vector.
IntType map_fem_graph_coord(const IntType &N, const IntType &i, const IntType &j, const IntType &k)
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
virtual int MyPID() const =0
Teuchos::RCP< const Epetra_Comm > getStochasticComm() const
Get stochastic comm.
int FillComplete(bool OptimizeDataStorage=true)
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > getEpetraCijk() const
Get Epetra Cijk.
Stokhos::LegendreBasis< int, double > basis_type
int PutScalar(double ScalarConstant)
int NumMyElements() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const Epetra_BlockMap > getStochasticRowMap() const
Get stochastic row map.
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
virtual int Apply(const Epetra_MultiVector &Input, Epetra_MultiVector &Result) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector Input in Result as described ...
std::vector< double > run_test(const size_t num_cpu, const size_t num_core_per_cpu, const size_t num_threads_per_core, const size_t p, const size_t d, const size_t nGrid, const size_t nIter, const bool symmetric, SG_Alg sg_alg, const std::vector< double > &perf1=std::vector< double >())
Legendre polynomial basis.
Stokhos::Sparse3Tensor< int, double > Cijk_type
int main(int argc, char **argv)
Abstract base class for 1-D orthogonal polynomials.
double countApplyFlops() const
Return number of FLOPS for each call to Apply()
A comparison functor implementing a strict weak ordering based lexographic ordering.
Teuchos::RCP< const Epetra_Comm > getSpatialComm() const
Get spatial comm.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.