3 #ifndef vtkMPIUtilities_h
4 #define vtkMPIUtilities_h
15 VTK_ABI_NAMESPACE_BEGIN
25 template <
typename... T>
28 assert(comm !=
nullptr);
31 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
36 template <
typename... T>
41 assert(comm !=
nullptr);
53 template <
typename... T>
56 assert(comm !=
nullptr);
61 int* nullmsg =
nullptr;
66 vtk::print(
"[{:d}]: ", rank);
69 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
78 else if (rank == numRanks - 1)
81 comm->
Receive(nullmsg, 0, rank - 1, 0);
84 vtk::print(
"[{:d}]: ", rank);
86 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
92 comm->
Receive(nullmsg, 0, rank - 1, 0);
95 vtk::print(
"[{:d}]: ", rank);
97 vtk::print(vtk::runtime(format), std::forward<T>(args)...);
106 template <
typename... T>
111 assert(comm !=
nullptr);
115 VTK_ABI_NAMESPACE_END
118 #endif // vtkMPIUtilities_h
VTKCOMMONCORE_EXPORT std::string to_std_format(const std::string &format)
Convert printf and std::format style format strings.
void SynchronizedPrintf(vtkMPIController *comm, const char *formatArg, T &&...args)
Each rank, r_0 to r_{N-1}, prints the formatted message to stdout in rank order.
void Printf(vtkMPIController *comm, const char *formatArg, T &&...args)
Rank 0 prints the user-supplied formatted message to stdout.
#define VTK_DEPRECATED_IN_9_6_0(reason)
int NoBlockSend(const int *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
This method sends data to another process (non-blocking).
void Print(vtkMPIController *comm, const char *format, T &&...args)
Rank 0 prints the user-supplied formatted message to stdout.
Process communication using MPI.
void Barrier()
This method can be used to synchronize processes.
int GetNumberOfProcesses()
Set the number of processes you will be using.
int Receive(int *data, vtkIdType maxlength, int remoteProcessId, int tag)
This method receives data from a corresponding send.
int GetLocalProcessId()
Tells you which process [0, NumProcess) you are in.
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.