3#ifndef vtkMPIUtilities_h
4#define vtkMPIUtilities_h
14VTK_ABI_NAMESPACE_BEGIN
24template <
typename... T>
27 assert(comm !=
nullptr);
30 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
44template <
typename... T>
47 assert(comm !=
nullptr);
52 int* nullmsg =
nullptr;
57 vtk::print(
"[{:d}]: ", rank);
60 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
69 else if (rank == numRanks - 1)
72 comm->
Receive(nullmsg, 0, rank - 1, 0);
75 vtk::print(
"[{:d}]: ", rank);
77 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
83 comm->
Receive(nullmsg, 0, rank - 1, 0);
86 vtk::print(
"[{:d}]: ", rank);
88 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
Process communication using MPI.
int NoBlockSend(const int *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
This method sends data to another process (non-blocking).
int GetNumberOfProcesses()
Set the number of processes you will be using.
void Barrier()
This method can be used to synchronize processes.
int GetLocalProcessId()
Tells you which process [0, NumProcess) you are in.
int Receive(int *data, vtkIdType maxlength, int remoteProcessId, int tag)
This method receives data from a corresponding send.
void SynchronizedPrint(vtkMPIController *comm, const char *format, T &&... args)
Each rank, r_0 to r_{N-1}, prints the formatted message to stdout in rank order.
void Print(vtkMPIController *comm, const char *format, T &&... args)
Rank 0 prints the user-supplied formatted message to stdout.