10#ifndef TPETRA_DETAILS_ALLREDUCEVIEW_HPP 
   11#define TPETRA_DETAILS_ALLREDUCEVIEW_HPP 
   15#include "Kokkos_Core.hpp" 
   16#include "Teuchos_CommHelpers.hpp" 
   17#include "Tpetra_Details_temporaryViewUtils.hpp" 
   27template <
typename InputViewType, 
typename OutputViewType>
 
   29allReduceRawContiguous(
const OutputViewType& output,
 
   30                       const InputViewType& input,
 
   31                       const Teuchos::Comm<int>& comm) {
 
   32  using Teuchos::outArg;
 
   33  using Teuchos::REDUCE_SUM;
 
   34  using Teuchos::reduceAll;
 
   35  using ValueType = 
typename InputViewType::non_const_value_type;
 
   36  size_t count    = input.span();
 
   37  TEUCHOS_ASSERT(count <= 
size_t(INT_MAX));
 
   38  if (
isInterComm(comm) && input.data() == output.data()) {
 
   41    typename InputViewType::array_layout layout(input.extent(0), input.extent(1), input.extent(2), input.extent(3), input.extent(4), input.extent(5), input.extent(6), input.extent(7));
 
   42    Kokkos::View<typename InputViewType::non_const_data_type, typename InputViewType::array_layout, typename InputViewType::device_type>
 
   43        tempInput(Kokkos::ViewAllocateWithoutInitializing(
"tempInput"), layout);
 
   46    Kokkos::deep_copy(tempInput, input);
 
   47    reduceAll<int, ValueType>(comm, REDUCE_SUM, 
static_cast<int>(count),
 
   48                              tempInput.data(), output.data());
 
   50    reduceAll<int, ValueType>(comm, REDUCE_SUM, 
static_cast<int>(count),
 
   51                              input.data(), output.data());
 
   57template <
class InputViewType, 
class OutputViewType>
 
   61              const Teuchos::Comm<int>& comm) {
 
   64  if (comm.getSize() == 1) {
 
   77  using Layout = 
typename TempView::UnifiedContiguousLayout<InputViewType, OutputViewType>::type;
 
 
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.
 
Declaration of Tpetra::Details::isInterComm.
 
Struct that holds views of the contents of a CrsMatrix.
 
static bool assumeMpiIsGPUAware()
Whether to assume that MPI is CUDA aware.
 
Implementation details of Tpetra.
 
static void allReduceView(const OutputViewType &output, const InputViewType &input, const Teuchos::Comm< int > &comm)
All-reduce from input Kokkos::View to output Kokkos::View.
 
bool isInterComm(const Teuchos::Comm< int > &)
Return true if and only if the input communicator wraps an MPI intercommunicator.
 
Namespace Tpetra contains the class and methods constituting the Tpetra library.