29#ifndef vtkPPixelTransfer_h
30#define vtkPPixelTransfer_h
37#include "vtkRenderingParallelLICModule.h"
66 , SrcWholeExt(srcWholeExt)
69 , DestWholeExt(destWholeExt)
84 , SrcWholeExt(srcWholeExt)
87 , DestWholeExt(destWholeExt)
102 , SrcWholeExt(wholeExt)
105 , DestWholeExt(wholeExt)
137 , SrcWholeExt(srcWholeExt)
138 , SrcExt(srcWholeExt)
140 , DestWholeExt(destWholeExt)
141 , DestExt(destWholeExt)
156 , SrcWholeExt(srcWholeExt)
159 , DestWholeExt(destWholeExt)
185 bool Sender(
int rank)
const {
return (this->SrcRank == rank); }
186 bool Receiver(
int rank)
const {
return (this->DestRank == rank); }
187 bool Local(
int rank)
const {
return (this->Sender(rank) && this->Receiver(rank)); }
250 template <
typename SOURCE_TYPE,
typename DEST_TYPE>
251 int Execute(MPI_Comm comm,
int rank,
int nComps, SOURCE_TYPE* srcData, DEST_TYPE* destData,
252 std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
258 int Execute(MPI_Comm comm,
int rank,
int nComps,
int srcType,
void* srcData,
int destType,
259 void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
264 int Blit(
int nComps,
int srcType,
void* srcData,
int destType,
void* destData);
268 template <
typename SOURCE_TYPE>
269 int Execute(MPI_Comm comm,
int rank,
int nComps, SOURCE_TYPE* srcData,
int destType,
270 void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag);
285template <
typename SOURCE_TYPE>
287 int destType,
void* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
294 return this->
Execute(comm, rank, nComps, srcData, (VTK_TT*)destData, reqs, types, tag));
300template <
typename SOURCE_TYPE,
typename DEST_TYPE>
302 DEST_TYPE* destData, std::vector<MPI_Request>& reqs, std::deque<MPI_Datatype>& types,
int tag)
305 if ((comm == MPI_COMM_NULL) || (this->
Local(rank)))
309 this->DestExt, nComps, srcData, nComps, destData);
312 if (rank == this->DestRank)
315 if (destData == NULL)
320 MPI_Datatype subarray;
321 iErr = vtkMPIPixelViewNew<DEST_TYPE>(this->DestWholeExt, this->DestExt, nComps, subarray);
327 if (this->UseBlockingRecv)
330 iErr = MPI_Recv(destData, 1, subarray, this->SrcRank, tag, comm, &stat);
334 reqs.push_back(MPI_REQUEST_NULL);
335 iErr = MPI_Irecv(destData, 1, subarray, this->SrcRank, tag, comm, &reqs.back());
338#define HOLD_RECV_TYPES
340 types.push_back(subarray);
342 MPI_Type_free(&subarray);
351 if (rank == this->SrcRank)
359 MPI_Datatype subarray;
360 iErr = vtkMPIPixelViewNew<SOURCE_TYPE>(this->SrcWholeExt, this->SrcExt, nComps, subarray);
366 if (this->UseBlockingSend)
368 iErr = MPI_Ssend(srcData, 1, subarray, this->DestRank, tag, comm);
373 iErr = MPI_Isend(srcData, 1, subarray, this->DestRank, tag, comm, &req);
374#define SAVE_SEND_REQS
378 MPI_Request_free(&req);
382#define HOLD_SEND_TYPES
383#ifdef HOLD_SEND_TYPES
384 types.push_back(subarray);
386 MPI_Type_free(&subarray);
398VTKRENDERINGPARALLELLIC_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)
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 >)