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);