17#ifndef vtkPPixelTransfer_h
18#define vtkPPixelTransfer_h
25#include "vtkRenderingParallelLICModule.h"
35VTK_ABI_NAMESPACE_BEGIN
55 , SrcWholeExt(srcWholeExt)
58 , DestWholeExt(destWholeExt)
73 , SrcWholeExt(srcWholeExt)
76 , DestWholeExt(destWholeExt)
91 , SrcWholeExt(wholeExt)
94 , DestWholeExt(wholeExt)
126 , SrcWholeExt(srcWholeExt)
127 , SrcExt(srcWholeExt)
129 , DestWholeExt(destWholeExt)
130 , DestExt(destWholeExt)
145 , SrcWholeExt(srcWholeExt)
148 , DestWholeExt(destWholeExt)
174 bool Sender(
int rank)
const {
return (this->SrcRank == rank); }
175 bool Receiver(
int rank)
const {
return (this->DestRank == rank); }
176 bool Local(
int rank)
const {
return (this->Sender(rank) && this->Receiver(rank)); }
239 template <
typename SOURCE_TYPE,
typename DEST_TYPE>
240 int Execute(MPI_Comm comm,
int rank,
int nComps, SOURCE_TYPE* srcData, DEST_TYPE* destData,
241 std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
247 int Execute(MPI_Comm comm,
int rank,
int nComps,
int srcType,
void* srcData,
int destType,
248 void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
253 int Blit(
int nComps,
int srcType,
void* srcData,
int destType,
void* destData);
257 template <
typename SOURCE_TYPE>
258 int Execute(MPI_Comm comm,
int rank,
int nComps, SOURCE_TYPE* srcData,
int destType,
259 void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
273template <
typename SOURCE_TYPE>
275 int destType,
void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
282 return this->
Execute(comm, rank, nComps, srcData, (VTK_TT*)destData, reqs, types, tag));
288template <
typename SOURCE_TYPE,
typename DEST_TYPE>
290 DEST_TYPE* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag)
293 if ((comm == MPI_COMM_NULL) || (this->
Local(rank)))
297 this->DestExt, nComps, srcData, nComps, destData);
300 if (rank == this->DestRank)
303 if (destData ==
nullptr)
308 MPI_Datatype subarray;
309 iErr = vtkMPIPixelViewNew<DEST_TYPE>(this->DestWholeExt, this->DestExt, nComps, subarray);
315 if (this->UseBlockingRecv)
318 iErr = MPI_Recv(destData, 1, subarray, this->SrcRank, tag, comm, &stat);
322 reqs.push_back(MPI_REQUEST_NULL);
323 iErr = MPI_Irecv(destData, 1, subarray, this->SrcRank, tag, comm, &reqs.back());
326#define HOLD_RECV_TYPES
328 types.push_back(subarray);
330 MPI_Type_free(&subarray);
339 if (rank == this->SrcRank)
342 if (srcData ==
nullptr)
347 MPI_Datatype subarray;
348 iErr = vtkMPIPixelViewNew<SOURCE_TYPE>(this->SrcWholeExt, this->SrcExt, nComps, subarray);
354 if (this->UseBlockingSend)
356 iErr = MPI_Ssend(srcData, 1, subarray, this->DestRank, tag, comm);
361 iErr = MPI_Isend(srcData, 1, subarray, this->DestRank, tag, comm, &req);
362#define SAVE_SEND_REQS
366 MPI_Request_free(&req);
370#define HOLD_SEND_TYPES
371#ifdef HOLD_SEND_TYPES
372 types.push_back(subarray);
374 MPI_Type_free(&subarray);
386VTKRENDERINGPARALLELLIC_EXPORT
class to handle inter-process communication of pixel data from non-contiguous regions of a shared ind...
void SetSourceWholeExtent(vtkPixelExtent &srcExt)
Set/Get the source extent.
vtkPPixelTransfer(int srcRank, int destRank, const vtkPixelExtent &wholeExt, const vtkPixelExtent &targetExt, int id=0)
Initialize a transaction from sub extent of source to sub extent of dest, both the whole and the subs...
void SetUseBlockingRecv(int val)
int GetTransactionId() const
vtkPixelExtent & GetSourceWholeExtent()
int GetUseBlockingRecv() const
bool Receiver(int rank) const
void SetDestinationRank(int rank)
~vtkPPixelTransfer()=default
vtkPixelExtent & GetDestinationExtent()
int GetSourceRank() const
vtkPPixelTransfer(int srcRank, const vtkPixelExtent &srcWholeExt, int destRank, const vtkPixelExtent &destWholeExt, int id=0)
Initialize a transaction from whole extent of source to whole extent of dest, where source and destin...
void SetDestinationWholeExtent(vtkPixelExtent &destExt)
Set/get the destination extent.
int Execute(MPI_Comm comm, int rank, int nComps, SOURCE_TYPE *srcData, DEST_TYPE *destData, std::vector< MPI_Request > &reqs, std::deque< MPI_Datatype > &types, int tag)
Transfer data from source to destination.
const vtkPixelExtent & GetSourceWholeExtent() const
vtkPPixelTransfer(int srcRank, int destRank, const vtkPixelExtent &ext, int id=0)
Initialize a transaction from sub extent of source to sub extent of dest, both the whole and the subs...
bool Local(int rank) const
void SetTransactionId(int id)
Set/get the transaction id.
int GetUseBlockingSend() const
vtkPPixelTransfer(const vtkPixelExtent &srcWholeExt, const vtkPixelExtent &srcExt, const vtkPixelExtent &destWholeExt, const vtkPixelExtent &destExt)
Initialize a transaction from sub extent of source to sub extent of dest, where the subsets are diffe...
const vtkPixelExtent & GetDestinationWholeExtent() const
bool Sender(int rank) const
Tests to determine a given rank's role in this transaction.
vtkPixelExtent & GetSourceExtent()
int Execute(MPI_Comm comm, int rank, int nComps, int srcType, void *srcData, int destType, void *destData, std::vector< MPI_Request > &reqs, std::deque< MPI_Datatype > &types, int tag)
Transfer data from source to destination.
void SetDestinationExtent(vtkPixelExtent &destExt)
Set/get the destination extent.
const vtkPixelExtent & GetSourceExtent() const
vtkPPixelTransfer(int srcRank, const vtkPixelExtent &srcWholeExt, const vtkPixelExtent &srcExt, int destRank, const vtkPixelExtent &destWholeExt, const vtkPixelExtent &destExt, int id=0)
Initialize a transaction from sub extent of source to sub extent of dest, where the subsets are diffe...
vtkPixelExtent & GetDestinationWholeExtent()
const vtkPixelExtent & GetDestinationExtent() const
vtkPPixelTransfer(int srcRank, const vtkPixelExtent &srcWholeExt, const vtkPixelExtent &targetExt, int destRank, const vtkPixelExtent &destWholeExt, int id)
Initialize a transaction from sub extent of source to sub extent of dest, where the subsets are the s...
void SetUseBlockingSend(int val)
Enable/diasable non-blocking communication.
int GetDestinationRank() const
void SetSourceRank(int rank)
Set/Get the MPI rank of source and destination processes.
int Blit(int nComps, int srcType, void *srcData, int destType, void *destData)
Block transfer for local memory to memory transfers, without using mpi.
void SetSourceExtent(vtkPixelExtent &srcExt)
Set/Get the source extent.
Representation of a cartesian pixel plane and common operations on it.
static int Blit(const vtkPixelExtent &ext, int nComps, int srcType, void *srcData, int destType, void *destData)
for memory to memory transfers.
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(std::ostream &os, const vtkPPixelTransfer >)