Teuchos::ErrorPolling Class Reference

ErrorPolling provides utilities for establishing agreement between processors on whether an std::exception has been detected on any one processor. More...

#include <Teuchos_ErrorPolling.hpp>

List of all members.

Static Public Member Functions

static void reportFailure (const MPIComm &comm)
static bool pollForFailures (const MPIComm &comm)
static void enable ()
static void disable ()

Detailed Description

ErrorPolling provides utilities for establishing agreement between processors on whether an std::exception has been detected on any one processor.

The two functions must be used in a coordinated way. The simplest use case is to embed a call to reportFailure() whenever an std::exception is detected at the top-level try/catch block, and then to do a call to pollForFailures() whenever it is desired to check for off-processor errors before proceeding. The macro

    TEUCHOS_TEST_FOR_FAILURE(comm);

calls pollForFailures() and throws an std::exception if the return value is true.

Polling is a collective operation (an MPI_Reduce) and so incurs some performance overhead. It can be disabled with a call to

 Teuchos::ErrorPolling::disable();

IMPORTANT: all processors must agree on whether collective error checking is enabled or disabled. If there are inconsistent states, the reduction operations in pollForFailures() will hang because some processors cannot be contacted.

Definition at line 70 of file Teuchos_ErrorPolling.hpp.


Member Function Documentation

void Teuchos::ErrorPolling::reportFailure ( const MPIComm comm  )  [static]

Call this function upon catching an std::exception in order to inform other processors of the error. This function will do an AllReduce in conjunction with calls to either this function or its partner, pollForFailures(), on the other processors. This procedure has the effect of communicating to the other processors that an std::exception has been detected on this one.

Definition at line 31 of file Teuchos_ErrorPolling.cpp.

bool Teuchos::ErrorPolling::pollForFailures ( const MPIComm comm  )  [static]

Call this function after std::exception-free completion of a try/catch block. This function will do an AllReduce in conjunction with calls to either this function or its partner, reportFailure(), on the other processors. If a failure has been reported by another processor, the call to pollForFailures() will return true and an std::exception can be thrown.

Definition at line 42 of file Teuchos_ErrorPolling.cpp.

static void Teuchos::ErrorPolling::enable (  )  [inline, static]

Activate error polling

Definition at line 90 of file Teuchos_ErrorPolling.hpp.

static void Teuchos::ErrorPolling::disable (  )  [inline, static]

Disable error polling

Definition at line 93 of file Teuchos_ErrorPolling.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:46 2011 for Teuchos - Trilinos Tools Package by  doxygen 1.6.3