QMCPACK
UniformCommunicateError Class Reference

This a subclass for runtime errors that will occur on all ranks. More...

+ Inheritance diagram for UniformCommunicateError:
+ Collaboration diagram for UniformCommunicateError:

Public Member Functions

 UniformCommunicateError (const std::string &what_arg)
 
 UniformCommunicateError (const char *what_arg)
 

Detailed Description

This a subclass for runtime errors that will occur on all ranks.

This is intended to be thrown and caught within a single Communicate context.

Intended use is with a catch block like this:

catch (const UniformMPIerror& ue)
{
  my_local_comm->barrier_and_abort(ue.what());
}

Which insures that the error message actually makes it out on the head rank before the MPI processes are aborted.

If even one member of the comm i.e. my_local_comm does not experience the issue you will HANG the job until the walltime expires. When in doubt it is better to lose the error message until the crash is examined in a debugger.

Because of this you should catch the exception as soon as you have access to a Communicate instance. However unlike the unit test hostile comm->barrier_and_abort you can and should check that an exception is emitted so don't catch it in the same method/function.

Definition at line 39 of file UniformCommunicateError.h.

Constructor & Destructor Documentation

◆ UniformCommunicateError() [1/2]

UniformCommunicateError ( const std::string &  what_arg)
inline

Definition at line 42 of file UniformCommunicateError.h.

42 : std::runtime_error(what_arg) {}

◆ UniformCommunicateError() [2/2]

UniformCommunicateError ( const char *  what_arg)
inline

Definition at line 43 of file UniformCommunicateError.h.

43 : std::runtime_error(what_arg) {}

The documentation for this class was generated from the following file: