Nektar++
Functions
Python/Communication/Comm.cpp File Reference
#include <vector>
#include <LibUtilities/Communication/Comm.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/Python/NekPyConfig.hpp>

Go to the source code of this file.

Functions

template<typename T >
AllReduce (CommSharedPtr &comm, T toReduce, ReduceOperator oper)
 
void export_Comm ()
 Export for Comm communicator. More...
 

Function Documentation

◆ AllReduce()

template<typename T >
T AllReduce ( CommSharedPtr comm,
toReduce,
ReduceOperator  oper 
)

Definition at line 44 of file Python/Communication/Comm.cpp.

45 {
46  comm->AllReduce(toReduce, oper);
47  return toReduce;
48 }

Referenced by export_Comm().

◆ export_Comm()

void export_Comm ( )

Export for Comm communicator.

Definition at line 53 of file Python/Communication/Comm.cpp.

54 {
55  // Export ReduceOperator enum
57 
58  py::class_<Comm, std::shared_ptr<Comm>,
59  boost::noncopyable>("Comm", py::no_init)
60  .def("GetSize", &Comm::GetSize)
61  .def("GetRank", &Comm::GetRank)
62  .def("GetType", &Comm::GetType,
63  py::return_value_policy<py::copy_const_reference>())
64  .def("AllReduce", &AllReduce<double>)
65  .def("AllReduce", &AllReduce<int>)
66  .def("AllReduce", &AllReduce<long>)
67  .def("AllReduce", &AllReduce<Array<OneD, NekDouble>>)
68  ;
69 }
#define NEKPY_WRAP_ENUM(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:66
T AllReduce(CommSharedPtr &comm, T toReduce, ReduceOperator oper)
const char *const ReduceOperatorMap[]
Definition: Comm.h:74
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:67

References AllReduce(), Nektar::LibUtilities::Comm::GetRank(), Nektar::LibUtilities::Comm::GetSize(), Nektar::LibUtilities::Comm::GetType(), NEKPY_WRAP_ENUM, and Nektar::LibUtilities::ReduceOperatorMap.

Referenced by BOOST_PYTHON_MODULE().