IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ippl::mpi::Communicator Class Reference

#include <Communicator.h>

Inheritance diagram for ippl::mpi::Communicator:
Collaboration diagram for ippl::mpi::Communicator:

Public Types

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
using archive_type = detail::Archive<MemorySpace>
template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
using buffer_type = std::shared_ptr<archive_type<MemorySpace>>
using size_type = detail::size_type

Public Member Functions

 Communicator ()
 Communicator (MPI_Comm comm)
Communicatoroperator= (MPI_Comm comm)
 ~Communicator ()=default
Communicator split (int color, int key) const
 operator const MPI_Comm & () const noexcept
int size () const noexcept
int rank () const noexcept
void barrier ()
void abort (int errorcode=-1)
template<typename T>
void send (const T &buffer, int count, int dest, int tag)
template<typename T>
void send (const T *buffer, int count, int dest, int tag)
template<typename T>
void recv (T &output, int count, int source, int tag, Status &status)
template<typename T>
void recv (T *output, int count, int source, int tag, Status &status)
void probe (int source, int tag, Status &status)
template<typename T>
void isend (const T &buffer, int count, int dest, int tag, Request &request)
template<typename T>
void isend (const T *buffer, int count, int dest, int tag, Request &request)
template<typename T>
void irecv (T &buffer, int count, int source, int tag, Request &request)
template<typename T>
void irecv (T *buffer, int count, int source, int tag, Request &request)
bool iprobe (int source, int tag, Status &status)
template<typename T>
void gather (const T *input, T *output, int count, int root=0)
template<typename T>
void scatter (const T *input, T *output, int count, int root=0)
template<typename T, class Op>
void reduce (const T *input, T *output, int count, Op op, int root=0)
template<typename T, class Op>
void reduce (const T &input, T &output, int count, Op op, int root=0)
template<typename T, class Op>
void allreduce (const T *input, T *output, int count, Op op)
template<typename T, class Op>
void allreduce (const T &input, T &output, int count, Op op)
template<typename T, class Op>
void allreduce (T *inout, int count, Op op)
template<typename T, class Op>
void allreduce (T &inout, int count, Op op)
double getDefaultOverallocation () const
void setDefaultOverallocation (double factor)
template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space, typename T = char>
buffer_type< MemorySpace > getBuffer (size_type size, double overallocation=1.0)
void deleteAllBuffers ()
void freeAllBuffers ()
template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
void freeBuffer (buffer_type< MemorySpace > buffer)
const MPI_Comm & getCommunicator () const noexcept
template<class Buffer, typename Archive>
void recv (int src, int tag, Buffer &buffer, Archive &ar, size_type msize, size_type nrecvs)
template<class Buffer, typename Archive>
void isend (int dest, int tag, Buffer &buffer, Archive &ar, MPI_Request &request, size_type nsends)
template<typename Archive>
void irecv (int src, int tag, Archive &ar, MPI_Request &request, size_type msize)
void printLogs (const std::string &filename)
int next_tag (int t, int s=DEF_CYCLE_SIZE)
int preceding_tag (int t, int s=DEF_CYCLE_SIZE)
int following_tag (int t, int s=DEF_CYCLE_SIZE)
int current_tag (int t, int s=DEF_CYCLE_SIZE)
int reset_tag (int t, int s=DEF_CYCLE_SIZE)

Protected Attributes

std::shared_ptr< MPI_Comm > comm_m
int size_m
int rank_m

Private Types

template<typename MemorySpace>
using buffer_container_type = LoggingBufferHandler<MemorySpace>
using buffer_handler_type

Private Member Functions

std::vector< LogEntrygatherLocalLogs ()
void sendLogsToRank0 (const std::vector< LogEntry > &localLogs)
std::vector< LogEntrygatherLogsFromAllRanks (const std::vector< LogEntry > &localLogs)
void writeLogsToFile (const std::vector< LogEntry > &allLogs, const std::string &filename)
TagInfocreate_base_tag (int t, int s=DEF_CYCLE_SIZE)

Private Attributes

buffer_handler_type buffer_handlers_m
double defaultOveralloc_m = 1.0
std::map< int, TagInfo, TagCompareTagList

Detailed Description

Definition at line 31 of file Communicator.h.

Member Typedef Documentation

◆ archive_type

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
using ippl::mpi::Communicator::archive_type = detail::Archive<MemorySpace>

Definition at line 131 of file Communicator.h.

◆ buffer_container_type

template<typename MemorySpace>
using ippl::mpi::Communicator::buffer_container_type = LoggingBufferHandler<MemorySpace>
private

Definition at line 138 of file Communicator.h.

◆ buffer_handler_type

Initial value:

Definition at line 140 of file Communicator.h.

◆ buffer_type

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
using ippl::mpi::Communicator::buffer_type = std::shared_ptr<archive_type<MemorySpace>>

Definition at line 134 of file Communicator.h.

◆ size_type

Constructor & Destructor Documentation

◆ Communicator() [1/2]

ippl::mpi::Communicator::Communicator ( )

Definition at line 7 of file Communicator.cpp.

References comm_m, rank_m, and size_m.

Referenced by operator=(), and split().

Here is the caller graph for this function:

◆ Communicator() [2/2]

ippl::mpi::Communicator::Communicator ( MPI_Comm comm)

Definition at line 13 of file Communicator.cpp.

References comm_m, rank_m, and size_m.

◆ ~Communicator()

ippl::mpi::Communicator::~Communicator ( )
default

Member Function Documentation

◆ abort()

void ippl::mpi::Communicator::abort ( int errorcode = -1)
inline

Definition at line 51 of file Communicator.h.

References comm_m.

Referenced by irecv(), isend(), and recv().

Here is the caller graph for this function:

◆ allreduce() [1/4]

template<typename T, class Op>
void ippl::mpi::Communicator::allreduce ( const T & input,
T & output,
int count,
Op op )

Definition at line 45 of file Collectives.hpp.

References allreduce().

Here is the call graph for this function:

◆ allreduce() [2/4]

template<typename T, class Op>
void ippl::mpi::Communicator::allreduce ( const T * input,
T * output,
int count,
Op op )

Definition at line 36 of file Collectives.hpp.

References comm_m, ippl::mpi::get_mpi_datatype(), and ippl::mpi::get_mpi_op().

Referenced by allreduce(), and allreduce().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allreduce() [3/4]

template<typename T, class Op>
void ippl::mpi::Communicator::allreduce ( T & inout,
int count,
Op op )

Definition at line 59 of file Collectives.hpp.

References allreduce().

Here is the call graph for this function:

◆ allreduce() [4/4]

template<typename T, class Op>
void ippl::mpi::Communicator::allreduce ( T * inout,
int count,
Op op )

Definition at line 50 of file Collectives.hpp.

References comm_m, ippl::mpi::get_mpi_datatype(), and ippl::mpi::get_mpi_op().

Here is the call graph for this function:

◆ barrier()

void ippl::mpi::Communicator::barrier ( )
inline

Definition at line 49 of file Communicator.h.

References comm_m.

◆ create_base_tag()

TagInfo & TagMaker::create_base_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineprivateinherited

Definition at line 107 of file TagMaker.h.

References TagMaker::TagInfo::base, TagMaker::TagInfo::cycleSize, DEF_CYCLE_SIZE, and TagList.

Referenced by current_tag(), following_tag(), next_tag(), preceding_tag(), and reset_tag().

Here is the caller graph for this function:

◆ current_tag()

int TagMaker::current_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineinherited

Definition at line 64 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ deleteAllBuffers()

void ippl::mpi::Communicator::deleteAllBuffers ( )

Definition at line 34 of file Buffers.cpp.

References buffer_handlers_m.

◆ following_tag()

int TagMaker::following_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineinherited

Definition at line 56 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, TagMaker::TagInfo::cycleSize, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ freeAllBuffers()

void ippl::mpi::Communicator::freeAllBuffers ( )

Definition at line 40 of file Buffers.cpp.

References buffer_handlers_m.

◆ freeBuffer()

template<typename MemorySpace>
void ippl::mpi::Communicator::freeBuffer ( Communicator::buffer_type< MemorySpace > buffer)

Definition at line 36 of file Buffers.hpp.

References buffer_handlers_m.

◆ gather()

template<typename T>
void ippl::mpi::Communicator::gather ( const T * input,
T * output,
int count,
int root = 0 )

Definition at line 8 of file Collectives.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ gatherLocalLogs()

std::vector< LogEntry > ippl::mpi::Communicator::gatherLocalLogs ( )
private

Definition at line 28 of file CommunicatorLogging.cpp.

References buffer_handlers_m.

Referenced by printLogs().

Here is the caller graph for this function:

◆ gatherLogsFromAllRanks()

std::vector< LogEntry > ippl::mpi::Communicator::gatherLogsFromAllRanks ( const std::vector< LogEntry > & localLogs)
private

Definition at line 48 of file CommunicatorLogging.cpp.

References ippl::mpi::deserializeLogs(), rank(), recv(), and size_m.

Referenced by printLogs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBuffer()

template<typename MemorySpace, typename T>
Communicator::buffer_type< MemorySpace > ippl::mpi::Communicator::getBuffer ( size_type size,
double overallocation = 1.0 )

Definition at line 27 of file Buffers.hpp.

References buffer_handlers_m, defaultOveralloc_m, and size().

Here is the call graph for this function:

◆ getCommunicator()

const MPI_Comm & ippl::mpi::Communicator::getCommunicator ( ) const
inlinenoexcept

Definition at line 158 of file Communicator.h.

References comm_m.

◆ getDefaultOverallocation()

double ippl::mpi::Communicator::getDefaultOverallocation ( ) const
inline

Definition at line 145 of file Communicator.h.

References defaultOveralloc_m.

◆ iprobe()

bool ippl::mpi::Communicator::iprobe ( int source,
int tag,
Status & status )

Definition at line 36 of file Communicator.cpp.

References comm_m.

◆ irecv() [1/3]

template<typename Archive>
void ippl::mpi::Communicator::irecv ( int src,
int tag,
Archive & ar,
MPI_Request & request,
size_type msize )
inline

Definition at line 188 of file Communicator.h.

References abort(), and comm_m.

Here is the call graph for this function:

◆ irecv() [2/3]

template<typename T>
void ippl::mpi::Communicator::irecv ( T & buffer,
int count,
int source,
int tag,
Request & request )

Definition at line 49 of file PointToPoint.hpp.

References irecv().

Referenced by irecv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ irecv() [3/3]

template<typename T>
void ippl::mpi::Communicator::irecv ( T * buffer,
int count,
int source,
int tag,
Request & request )

Definition at line 54 of file PointToPoint.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ isend() [1/3]

template<typename T>
void ippl::mpi::Communicator::isend ( const T & buffer,
int count,
int dest,
int tag,
Request & request )

Definition at line 37 of file PointToPoint.hpp.

References isend().

Referenced by isend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isend() [2/3]

template<typename T>
void ippl::mpi::Communicator::isend ( const T * buffer,
int count,
int dest,
int tag,
Request & request )

Definition at line 42 of file PointToPoint.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ isend() [3/3]

template<class Buffer, typename Archive>
void ippl::mpi::Communicator::isend ( int dest,
int tag,
Buffer & buffer,
Archive & ar,
MPI_Request & request,
size_type nsends )
inline

Definition at line 177 of file Communicator.h.

References abort(), and comm_m.

Here is the call graph for this function:

◆ next_tag()

int TagMaker::next_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineinherited

Definition at line 34 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, TagMaker::TagInfo::cycleSize, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ operator const MPI_Comm &()

ippl::mpi::Communicator::operator const MPI_Comm & ( ) const
inlinenoexcept

Definition at line 43 of file Communicator.h.

References comm_m.

◆ operator=()

Communicator & ippl::mpi::Communicator::operator= ( MPI_Comm comm)

Definition at line 19 of file Communicator.cpp.

References comm_m, Communicator(), rank_m, and size_m.

Here is the call graph for this function:

◆ preceding_tag()

int TagMaker::preceding_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineinherited

Definition at line 44 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, TagMaker::TagInfo::cycleSize, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ printLogs()

void ippl::mpi::Communicator::printLogs ( const std::string & filename)

Definition at line 13 of file CommunicatorLogging.cpp.

References gatherLocalLogs(), gatherLogsFromAllRanks(), rank(), sendLogsToRank0(), and writeLogsToFile().

Here is the call graph for this function:

◆ probe()

void ippl::mpi::Communicator::probe ( int source,
int tag,
Status & status )

Definition at line 32 of file Communicator.cpp.

References comm_m.

◆ rank()

int ippl::mpi::Communicator::rank ( ) const
inlinenoexcept

Definition at line 47 of file Communicator.h.

References rank_m.

Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::applyPeriodicSerialDim(), gatherLogsFromAllRanks(), and printLogs().

Here is the caller graph for this function:

◆ recv() [1/3]

template<class Buffer, typename Archive>
void ippl::mpi::Communicator::recv ( int src,
int tag,
Buffer & buffer,
Archive & ar,
size_type msize,
size_type nrecvs )
inline

Definition at line 161 of file Communicator.h.

References abort(), and comm_m.

Here is the call graph for this function:

◆ recv() [2/3]

template<typename T>
void ippl::mpi::Communicator::recv ( T & output,
int count,
int source,
int tag,
Status & status )

Definition at line 21 of file PointToPoint.hpp.

References recv().

Referenced by gatherLogsFromAllRanks(), and recv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recv() [3/3]

template<typename T>
void ippl::mpi::Communicator::recv ( T * output,
int count,
int source,
int tag,
Status & status )

Definition at line 26 of file PointToPoint.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ reduce() [1/2]

template<typename T, class Op>
void ippl::mpi::Communicator::reduce ( const T & input,
T & output,
int count,
Op op,
int root = 0 )

Definition at line 31 of file Collectives.hpp.

References reduce().

Here is the call graph for this function:

◆ reduce() [2/2]

template<typename T, class Op>
void ippl::mpi::Communicator::reduce ( const T * input,
T * output,
int count,
Op op,
int root = 0 )

Definition at line 22 of file Collectives.hpp.

References comm_m, ippl::mpi::get_mpi_datatype(), and ippl::mpi::get_mpi_op().

Referenced by reduce().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_tag()

int TagMaker::reset_tag ( int t,
int s = DEF_CYCLE_SIZE )
inlineinherited

Definition at line 71 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ scatter()

template<typename T>
void ippl::mpi::Communicator::scatter ( const T * input,
T * output,
int count,
int root = 0 )

Definition at line 15 of file Collectives.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ send() [1/2]

template<typename T>
void ippl::mpi::Communicator::send ( const T & buffer,
int count,
int dest,
int tag )

Definition at line 9 of file PointToPoint.hpp.

References send().

Referenced by send(), and sendLogsToRank0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send() [2/2]

template<typename T>
void ippl::mpi::Communicator::send ( const T * buffer,
int count,
int dest,
int tag )

Definition at line 14 of file PointToPoint.hpp.

References comm_m, and ippl::mpi::get_mpi_datatype().

Here is the call graph for this function:

◆ sendLogsToRank0()

void ippl::mpi::Communicator::sendLogsToRank0 ( const std::vector< LogEntry > & localLogs)
private

Definition at line 39 of file CommunicatorLogging.cpp.

References send(), and ippl::mpi::serializeLogs().

Referenced by printLogs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDefaultOverallocation()

void ippl::mpi::Communicator::setDefaultOverallocation ( double factor)

Definition at line 30 of file Buffers.cpp.

References defaultOveralloc_m.

◆ size()

int ippl::mpi::Communicator::size ( ) const
inlinenoexcept

Definition at line 45 of file Communicator.h.

References size_m.

Referenced by ippl::OrthogonalRecursiveBisection< Field, Tp >::binaryRepartition(), and getBuffer().

Here is the caller graph for this function:

◆ split()

Communicator ippl::mpi::Communicator::split ( int color,
int key ) const

References Communicator().

Here is the call graph for this function:

◆ writeLogsToFile()

void ippl::mpi::Communicator::writeLogsToFile ( const std::vector< LogEntry > & allLogs,
const std::string & filename )
private

Definition at line 93 of file CommunicatorLogging.cpp.

References endl(), first(), Inform::flush(), Inform::OVERWRITE, and Inform::setOutputLevel().

Referenced by printLogs().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ buffer_handlers_m

buffer_handler_type ippl::mpi::Communicator::buffer_handlers_m
private

◆ comm_m

std::shared_ptr<MPI_Comm> ippl::mpi::Communicator::comm_m
protected

◆ defaultOveralloc_m

double ippl::mpi::Communicator::defaultOveralloc_m = 1.0
private

Definition at line 206 of file Communicator.h.

Referenced by getBuffer(), getDefaultOverallocation(), and setDefaultOverallocation().

◆ rank_m

int ippl::mpi::Communicator::rank_m
protected

Definition at line 213 of file Communicator.h.

Referenced by Communicator(), Communicator(), operator=(), and rank().

◆ size_m

int ippl::mpi::Communicator::size_m
protected

Definition at line 212 of file Communicator.h.

Referenced by Communicator(), Communicator(), gatherLogsFromAllRanks(), operator=(), and size().

◆ TagList

std::map<int, TagInfo, TagCompare> TagMaker::TagList
privateinherited

Definition at line 102 of file TagMaker.h.

Referenced by create_base_tag().


The documentation for this class was generated from the following files: