33 #ifndef __H__PCL__PCL_PROCESS_COMMUNICATOR__
34 #define __H__PCL__PCL_PROCESS_COMMUNICATOR__
130 void gather(
const void* sendBuf,
int sendCount,
DataType sendType,
131 void* recBuf,
int recCount,
DataType recType,
int root)
const;
147 void* recBuf,
int recCount,
DataType recType,
int root)
const;
167 void* recBuf,
int* recCounts,
int* displs,
185 template<
class TValue>
186 void gatherv(std::vector<TValue>& recBufOut,
187 std::vector<TValue>& sendBuf,
int root,
188 std::vector<int>* pSizesOut = NULL,
189 std::vector<int>* pOffsetsOut = NULL)
const;
200 void* recBuf,
int recCount,
DataType recType)
const;
212 void* recBuf,
int* recCounts,
int* displs,
230 void* recBuf,
int recCount,
DataType recType);
246 template<
class TValue>
247 void allgatherv(std::vector<TValue>& recBufOut,
248 std::vector<TValue>& sendBuf,
249 std::vector<int>* pSizesOut = NULL,
250 std::vector<int>* pOffsetsOut = NULL)
const;
255 void reduce(
const void* sendBuf,
void* recBuf,
int count,
274 void reduce(
const T *pSendBuff, T *pReceiveBuff,
size_t count,
280 void reduce(
const std::vector<T> &send, std::vector<T> &receive,
288 void allreduce(
const void* sendBuf,
void* recBuf,
int count,
308 void allreduce(
const T *pSendBuff, T *pReceiveBuff,
size_t count,
314 void allreduce(
const std::vector<T> &send, std::vector<T> &receive,
332 inline void broadcast(T *p,
size_t size=1,
int root=0)
const;
339 inline void broadcast(T &t,
int root=0)
const;
349 void broadcast(
size_t &s,
int root=0)
const;
363 void send_data(
void* pBuffer,
int bufferSize,
int destProc,
int tag)
const;
378 void send_data(
void* pBuffer,
int* pBufferSegSizes,
379 int* pRecProcMap,
int numRecProcs,
int tag)
const;
383 void receive_data(
void* pBuffOut,
int bufferSize,
int srcProc,
int tag)
const;
405 int* pSenderProcMap,
int numSenderProcs,
406 void* pBuffer,
int* pBufferSegSizes,
407 int* pRecvProcMap,
int numRecvProcs,
434 int* recvFromRanks,
int numRecvFroms,
435 void* sendBuf,
int* sendSegSizes,
436 int* sendToRanks,
int numSendTos,
bool valid() const
returns true if the pointer is valid, false if not.
Definition: smart_pointer.h:206
Definition: pcl_datatype.h:63
Definition: pcl_datatype.h:64
Definition: pcl_process_communicator.h:70
SPCommWrapper m_comm
smart-pointer to an instance of a CommWrapper.
Definition: pcl_process_communicator.h:480
void receive_data(void *pBuffOut, int bufferSize, int srcProc, int tag) const
receives data from srcPrc with the specified tag.
Definition: pcl_process_communicator.cpp:511
bool is_proc_id(size_t index) const
returns true if we are the i-th process in the communicator
Definition: pcl_process_communicator.h:92
MPI_Comm get_mpi_communicator() const
returns the mpi-communicator, in case someone needs it
Definition: pcl_process_communicator.h:102
static ProcessCommunicator create_communicator(std::vector< int > &newGlobalProcs)
Definition: pcl_process_communicator.cpp:234
int get_proc_id(size_t index) const
returns the i-th process in the communicator
Definition: pcl_process_communicator.cpp:86
bool empty() const
returns true if the communicator is empty, false if not.
Definition: pcl_process_communicator.h:77
void barrier() const
this method will not return until all processes in the communicator have called it.
Definition: pcl_process_communicator.cpp:678
void send_data(void *pBuffer, int bufferSize, int destProc, int tag) const
sends data with the given tag to the specified process.
Definition: pcl_process_communicator.cpp:471
bool is_local() const
return true if the communicator is local, simulating current proc is the only proc
Definition: pcl_process_communicator.h:83
void alltoall(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType)
performs MPI_Alltoall on the processes of the communicator.
Definition: pcl_process_communicator.cpp:458
void reduce(const void *sendBuf, void *recBuf, int count, DataType type, ReduceOperation op, int rootProc) const
performs MPI_Reduce on the processes of the communicator.
Definition: pcl_process_communicator.cpp:296
void gather(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType, int root) const
performs MPI_Gather on the processes of the communicator.
Definition: pcl_process_communicator.cpp:339
bool is_world() const
return true if the communicator is PCD_WORLD
Definition: pcl_process_communicator.h:80
void gatherv(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int *recCounts, int *displs, DataType recType, int root) const
performs MPI_Gatherv on the processes of the communicator.
Definition: pcl_process_communicator.cpp:406
void allreduce(const void *sendBuf, void *recBuf, int count, DataType type, ReduceOperation op) const
performs MPI_Allreduce on the processes of the communicator.
Definition: pcl_process_communicator.cpp:318
size_t size() const
returns the size of the communicator
Definition: pcl_process_communicator.cpp:71
void scatter(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType, int root) const
performs MPI_Scatter on the processes of the communicator
Definition: pcl_process_communicator.cpp:392
void broadcast(void *v, size_t size, DataType type, int root=0) const
Definition: pcl_process_communicator.cpp:685
void allgatherv(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int *recCounts, int *displs, DataType recType) const
performs MPI_Allgatherv on the processes of the communicator.
Definition: pcl_process_communicator.cpp:443
ProcessCommunicator create_sub_communicator(bool participate) const
creates a new communicator containing a subset of the current communicator
Definition: pcl_process_communicator.cpp:122
void distribute_data(void *pBufferOut, int *pBufferOutSegSizes, int *pSenderProcMap, int numSenderProcs, void *pBuffer, int *pBufferSegSizes, int *pRecvProcMap, int numRecvProcs, int tag=1) const
sends and receives data to / from multiple processes.
Definition: pcl_process_communicator.cpp:526
int get_local_proc_id(int globalProcID=pcl::ProcRank()) const
returns the proc-id relative to this communicator
Definition: pcl_process_communicator.cpp:95
SmartPtr< CommWrapper > SPCommWrapper
Smart-pointer that encapsulates a CommWrapper.
Definition: pcl_process_communicator.h:476
void allgather(const void *sendBuf, int sendCount, DataType sendType, void *recBuf, int recCount, DataType recType) const
performs MPI_Allgather on the processes of the communicator.
Definition: pcl_process_communicator.cpp:421
ProcessCommunicator(ProcessCommunicatorDefaults pcd=PCD_WORLD)
creates a communicator.
Definition: pcl_process_communicator.cpp:52
A Buffer for binary data.
Definition: binary_buffer.h:56
MPI_Datatype DataType
Definition: pcl_datatype.h:61
int ProcRank()
returns the rank of the process
Definition: pcl_base.cpp:83
MPI_Op ReduceOperation
Definition: pcl_methods.h:74
std::ostream & operator<<(std::ostream &out, const ProcessCommunicator &processCommunicator)
Definition: pcl_process_communicator.cpp:744
ProcessCommunicatorDefaults
values that can be passed to a ProcessCommunicators constructor.
Definition: pcl_process_communicator.h:53
@ PCD_EMPTY
Definition: pcl_process_communicator.h:54
@ PCD_LOCAL
Definition: pcl_process_communicator.h:56
@ PCD_WORLD
Definition: pcl_process_communicator.h:55
Definition: parallel_grid_layout.h:46
MPI_Comm PCL_COMM_WORLD
Definition: pcl_comm_world.cpp:34
holds an mpi-communicator.
Definition: pcl_process_communicator.h:461
bool m_bReleaseCommunicator
Definition: pcl_process_communicator.h:469
MPI_Comm m_mpiComm
Definition: pcl_process_communicator.h:468
std::vector< int > m_procs
only contains data if m_mpiComm != PCL_COMM_WORLD
Definition: pcl_process_communicator.h:472
CommWrapper()
initializes the commWrapper with PCL_COMM_WORLD
Definition: pcl_process_communicator.cpp:725
~CommWrapper()
Definition: pcl_process_communicator.cpp:737