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

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>, boost::noncopyable>("Comm",
59 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}
#define NEKPY_WRAP_ENUM(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:71
T AllReduce(CommSharedPtr &comm, T toReduce, ReduceOperator oper)
const char *const ReduceOperatorMap[]
Definition: Comm.h:72
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:65

References AllReduce(), NEKPY_WRAP_ENUM, and Nektar::LibUtilities::ReduceOperatorMap.

Referenced by BOOST_PYTHON_MODULE().