Exemplo n.º 1
0
inline void Gemv(El::Orientation oA,
    T alpha, const El::DistMatrix<T, El::VC, El::STAR>& A,
    const El::DistMatrix<T, El::STAR, El::STAR>& x,
    T beta, El::DistMatrix<T, El::VC, El::STAR>& y) {
    // TODO verify sizes etc.

    if (oA == El::NORMAL) {
        El::Gemv(El::NORMAL,
            alpha, A.LockedMatrix(), x.LockedMatrix(),
            beta, y.Matrix());
    } else {
        SKYLARK_THROW_EXCEPTION(base::unsupported_base_operation());
    }
}
Exemplo n.º 2
0
inline void Gemv(El::Orientation oA,
    T alpha, const El::DistMatrix<T, El::VC, El::STAR>& A,
    const El::DistMatrix<T, El::VC, El::STAR>& x,
    T beta, El::DistMatrix<T, El::STAR, El::STAR>& y) {
    // TODO verify sizes etc.
    // TODO verify matching grids.

    if (oA == El::TRANSPOSE) {
        boost::mpi::communicator comm(y.Grid().Comm().comm,
            boost::mpi::comm_attach);
        El::Matrix<T> ylocal(y.Matrix());
        El::Gemv(El::TRANSPOSE,
            alpha, A.LockedMatrix(), x.LockedMatrix(),
            beta / T(comm.size()), ylocal);
        boost::mpi::all_reduce(comm,
            ylocal.Buffer(), ylocal.MemorySize(), y.Buffer(),
            std::plus<T>());
    } else {
        SKYLARK_THROW_EXCEPTION(base::unsupported_base_operation());
    }
}