本文整理汇总了C++中el::DistMatrix::IsLocalRow方法的典型用法代码示例。如果您正苦于以下问题:C++ DistMatrix::IsLocalRow方法的具体用法?C++ DistMatrix::IsLocalRow怎么用?C++ DistMatrix::IsLocalRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类el::DistMatrix
的用法示例。
在下文中一共展示了DistMatrix::IsLocalRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outer_panel_mixed_gemm_impl_tn
inline void outer_panel_mixed_gemm_impl_tn(
const double alpha,
const SpParMat<index_type, value_type, SpDCCols<index_type, value_type> > &A,
const El::DistMatrix<value_type, col_d, El::STAR> &S,
const double beta,
El::DistMatrix<value_type, El::STAR, El::STAR> &C) {
El::DistMatrix<value_type, El::STAR, El::STAR>
tmp_C(C.Height(), C.Width());
El::Zero(tmp_C);
utility::combblas_slab_view_t<index_type, value_type> cbview(A, false);
//FIXME: factor
size_t slab_size = 2 * S.Grid().Height();
for(size_t cur_row_idx = 0; cur_row_idx < cbview.ncols();
cur_row_idx += slab_size) {
size_t cur_slab_size =
std::min(slab_size, cbview.ncols() - cur_row_idx);
// get the next slab_size columns of B
El::DistMatrix<value_type, El::STAR, El::STAR>
A_row(cur_slab_size, S.Height());
// transpose is column
//cbview.extract_elemental_column_slab_view(A_row, cur_slab_size);
cbview.extract_full_slab_view(cur_slab_size);
// matrix mult (FIXME only iter nz)
for(size_t l_row_idx = 0; l_row_idx < A_row.LocalHeight();
++l_row_idx) {
size_t g_row_idx = l_row_idx * A_row.ColStride()
+ A_row.ColShift() + cur_row_idx;
for(size_t l_col_idx = 0; l_col_idx < A_row.LocalWidth();
l_col_idx++) {
//XXX: should be the same as l_col_idx
size_t g_col_idx = l_col_idx * A_row.RowStride()
+ A_row.RowShift();
// continue if we don't own values in S in this row
if(!S.IsLocalRow(g_col_idx))
continue;
//get transposed value
value_type val = alpha * cbview(g_col_idx, g_row_idx);
for(size_t s_col_idx = 0; s_col_idx < S.LocalWidth();
s_col_idx++) {
tmp_C.UpdateLocal(g_row_idx, s_col_idx,
val * S.GetLocal(S.LocalRow(g_col_idx), s_col_idx));
}
}
}
}
//FIXME: scaling
if(A.getcommgrid()->GetRank() == 0) {
for(size_t col_idx = 0; col_idx < C.Width(); col_idx++)
for(size_t row_idx = 0; row_idx < C.Height(); row_idx++)
tmp_C.UpdateLocal(row_idx, col_idx,
beta * C.GetLocal(row_idx, col_idx));
}
//FIXME: Use utility getter
boost::mpi::communicator world(
A.getcommgrid()->GetWorld(), boost::mpi::comm_duplicate);
boost::mpi::all_reduce (world,
tmp_C.LockedBuffer(),
C.Height() * C.Width(),
C.Buffer(),
std::plus<value_type>());
}