175 typename MatrixType::ordinal_type mp_vector_size) {
176 typedef typename MatrixType::ordinal_type ordinal_type;
177 typedef typename MatrixType::StaticCrsGraphType matrix_graph_type;
178 typedef typename MatrixType::values_type matrix_values_type;
180 std::vector< std::vector<ordinal_type> > graph(nrow);
181 for (ordinal_type i=0; i<nrow; ++i)
182 graph[i] = std::vector<ordinal_type>(1, i);
183 ordinal_type graph_length = nrow;
185 matrix_graph_type matrix_graph =
186 Kokkos::create_staticcrsgraph<matrix_graph_type>(
"graph", graph);
187 matrix_values_type matrix_values =
188 matrix_values_type(
"values", graph_length, mp_vector_size);
190 MatrixType matrix(
"matrix", nrow, matrix_values, matrix_graph);
441 const typename VectorType::ordinal_type stoch_length,
442 KokkosSparse::DeviceConfig dev_config,
443 Multiply multiply_op,
444 Teuchos::FancyOStream& out)
446 typedef typename VectorType::ordinal_type ordinal_type;
447 typedef typename VectorType::value_type scalar_type;
450 typedef Kokkos::Device<execution_space, typename execution_space::memory_space> device_type;
451 typedef Kokkos::LayoutRight Layout;
452 typedef Kokkos::View< VectorType*, Layout, execution_space > block_vector_type;
453 typedef KokkosSparse::CrsMatrix< VectorType, ordinal_type, device_type > block_matrix_type;
454 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
455 typedef typename block_matrix_type::values_type matrix_values_type;
458 TEUCHOS_TEST_FOR_EXCEPTION(
459 storage_type::is_static && storage_type::static_size != stoch_length,
461 "Static storage size must equal ensemble size");
464 ordinal_type fem_length = nGrid * nGrid * nGrid;
465 std::vector< std::vector<ordinal_type> > fem_graph;
478 block_vector_type x =
479 block_vector_type(
"x", fem_length, stoch_length);
480 block_vector_type y =
481 block_vector_type(
"y", fem_length, stoch_length);
487 typename block_vector_type::HostMirror::array_type hax = hx ;
488 typename block_vector_type::HostMirror::array_type hay = hy ;
490 for (ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
491 for (ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
492 hax(iRowFEM,iRowStoch) =
493 generate_vector_coefficient<scalar_type>(
494 fem_length, stoch_length, iRowFEM, iRowStoch );
495 hay(iRowFEM,iRowStoch) = 0.0;
505 matrix_graph_type matrix_graph =
506 Kokkos::create_staticcrsgraph<matrix_graph_type>(
507 std::string(
"test crs graph"), fem_graph);
512 matrix_values_type matrix_values =
513 matrix_values_type(
"matrix", fem_graph_length, stoch_length);
514 block_matrix_type matrix(
515 "block_matrix", fem_length, matrix_values, matrix_graph);
516 matrix.dev_config = dev_config;
518 typename matrix_values_type::HostMirror hM =
521 typename matrix_values_type::HostMirror::array_type haM = hM ;
523 for (ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
524 const ordinal_type row_size = fem_graph[iRowFEM].size();
525 for (ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
526 ++iRowEntryFEM, ++iEntryFEM) {
527 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
529 for (ordinal_type k=0; k<stoch_length; ++k) {
531 generate_matrix_coefficient<scalar_type>(
532 fem_length, stoch_length, iRowFEM, iColFEM, k);
542 multiply_op( matrix, x, y );
547 typedef typename block_vector_type::array_type array_type;
548#ifdef KOKKOS_ENABLE_DEPRECATED_CODE
549 array_type ay_expected =
550 array_type(
"ay_expected", fem_length, stoch_length);
552 array_type ay_expected =
555 typename array_type::HostMirror hay_expected =
557 for (ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
558 const ordinal_type row_size = fem_graph[iRowFEM].size();
559 for (ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
560 ++iRowEntryFEM, ++iEntryFEM) {
561 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
562 for (ordinal_type k=0; k<stoch_length; ++k) {
563 hay_expected(iRowFEM, k) +=
564 generate_matrix_coefficient<scalar_type>(
565 fem_length, stoch_length, iRowFEM, iColFEM, k) *
566 generate_vector_coefficient<scalar_type>(
567 fem_length, stoch_length, iColFEM, k );
576 typename block_vector_type::array_type ay = y;