3#ifndef vtkMPIUtilities_h
4#define vtkMPIUtilities_h
15VTK_ABI_NAMESPACE_BEGIN
25template <
typename... T>
28 assert(comm !=
nullptr);
31 vtk::print(format, std::forward<T>(args)...);
36template <
typename... T>
40 std::string format = formatArg ? formatArg :
"";
45 assert(comm !=
nullptr);
57template <
typename... T>
60 assert(comm !=
nullptr);
65 int* nullmsg =
nullptr;
70 vtk::print(
"[{:d}]: ", rank);
73 vtk::print(format, std::forward<T>(args)...);
82 else if (rank == numRanks - 1)
85 comm->
Receive(nullmsg, 0, rank - 1, 0);
88 vtk::print(
"[{:d}]: ", rank);
90 vtk::print(format, std::forward<T>(args)...);
96 comm->
Receive(nullmsg, 0, rank - 1, 0);
99 vtk::print(
"[{:d}]: ", rank);
101 vtk::print(format, std::forward<T>(args)...);
110template <
typename... T>
114 std::string format = formatArg ? formatArg :
"";
119 assert(comm !=
nullptr);
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 Printf(vtkMPIController *comm, const char *formatArg, T &&... args)
Rank 0 prints the user-supplied formatted message to stdout.
void Print(vtkMPIController *comm, const char *format, T &&... args)
Rank 0 prints the user-supplied formatted message to stdout.
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.
VTKCOMMONCORE_EXPORT std::string printf_to_std_format(const std::string &printf_format)
Convert a printf style format to a std::format style format.
VTKCOMMONCORE_EXPORT bool is_printf_format(const std::string &format)
Check if the given string is a printf style format.
#define VTK_DEPRECATED_IN_9_6_0(reason)