inline void mixed_gemm_local_part_nn ( const double alpha, const SpParMat<index_type, value_type, SpDCCols<index_type, value_type> > &A, const El::DistMatrix<value_type, El::STAR, El::STAR> &S, const double beta, std::vector<value_type> &local_matrix) { typedef SpDCCols< index_type, value_type > col_t; typedef SpParMat< index_type, value_type, col_t > matrix_type; matrix_type &_A = const_cast<matrix_type&>(A); col_t &data = _A.seq(); //FIXME local_matrix.resize(S.Width() * data.getnrow(), 0); size_t cb_col_offset = utility::cb_my_col_offset(A); for(typename col_t::SpColIter col = data.begcol(); col != data.endcol(); col++) { for(typename col_t::SpColIter::NzIter nz = data.begnz(col); nz != data.endnz(col); nz++) { // we want local index here to fill local dense matrix index_type rowid = nz.rowid(); // column needs to be global index_type colid = col.colid() + cb_col_offset; // compute application of S to yield a partial row in the result. for(size_t bcol = 0; bcol < S.Width(); ++bcol) { local_matrix[rowid * S.Width() + bcol] += alpha * S.Get(colid, bcol) * nz.value(); } } } }
void compare_result(size_t rank, DistMatrixType &expected_A, El::DistMatrix<double, El::STAR, El::STAR> &result) { col_t &data = expected_A.seq(); const size_t my_row_offset = skylark::utility::cb_my_row_offset(expected_A); const size_t my_col_offset = skylark::utility::cb_my_col_offset(expected_A); for(typename col_t::SpColIter col = data.begcol(); col != data.endcol(); col++) { for(typename col_t::SpColIter::NzIter nz = data.begnz(col); nz != data.endnz(col); nz++) { const size_t rowid = nz.rowid() + my_row_offset; const size_t colid = col.colid() + my_col_offset; const double value = nz.value(); if(value != result.GetLocal(rowid, colid)) { std::ostringstream os; os << rank << ": " << rowid << ", " << colid << ": " << value << " != " << result.GetLocal(rowid, colid) << std::endl; std::cout << os.str() << std::flush; BOOST_FAIL("Result application not as expected"); } } } }