| 557 | |
| 558 | template <typename TensorDataType> |
| 559 | void lbann_comm::allreduce(El::AbstractMatrix<TensorDataType>& m, |
| 560 | const El::mpi::Comm& c, |
| 561 | El::mpi::Op op) const |
| 562 | { |
| 563 | if (El::mpi::Size(c) == 1 || m.Height() < 1 || m.Width() < 1) { |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | const int local_size = m.Height() * m.Width(); |
| 568 | m_bytes_sent += sizeof(DataType) * local_size; |
| 569 | m_bytes_received += sizeof(DataType) * local_size * (El::mpi::Size(c) - 1); |
| 570 | |
| 571 | switch (m.GetDevice()) { |
| 572 | case El::Device::CPU: |
| 573 | return allreduce_impl( |
| 574 | static_cast<El::Matrix<TensorDataType, El::Device::CPU>&>(m), |
| 575 | c, |
| 576 | op); |
| 577 | #ifdef LBANN_HAS_GPU |
| 578 | case El::Device::GPU: |
| 579 | return allreduce_impl( |
| 580 | static_cast<El::Matrix<TensorDataType, El::Device::GPU>&>(m), |
| 581 | c, |
| 582 | op); |
| 583 | #endif // LBANN_HAS_GPU |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | template <typename TensorDataType> |
| 588 | void lbann_comm::allreduce(El::AbstractDistMatrix<TensorDataType>& m, |
no test coverage detected