MPIControlEventServiceErrorConfig

Definition

typedef struct MPIControlEventServiceErrorConfig {
              MPIControlEventServiceErrorHandler  errorHandler;
              size_t                              errorThreshold;
}MPIControlEventServiceErrorConfig;

Description

MPIControlEventServiceErrorConfig is a structure containing a pointer to a control event service error handler callback function and an error threshold configuration.

If the errorHandler is configured, when an MPI error return value occurs in the control event service thread, the errorHandler function is invoked. If errorHandler == NULL, it is ignored.  If the errorHandler returns TRUE, the control event service thread exits.

When the number of MPI errors occurring in the control event service thread exceeds the errorThreshold, the control event service thread exits. If the errorThreshold is 0 or higher, the control service error thread checks if the error count exceeds the threshold. If the errorThreshold is less than 0, the control service error thread does not check the error count.

You can configure the event service error handler when the control event service is started with mpiControlEventServiceStart.

errorHandler A pointer to a control event service error handler function.

Note: Setting errorHandler to NULL is NOT recommended since it will disable the ability to catch and log errors that occur inside the event service thread.
errorThreshold The cumulative quantity of error return values occurring in the control event service thread to trigger the control event service thread to exit. Values: zero or greater, check threshold.  Less than zero, disable error threshold check.

Sample Code

/* Event service error handler – logs error data to 'logFile' */

MPI_BOOL MPI_DECL2

    MPIControlEventServiceErrorHandler(MPIControlEventServiceErrorParams *params)

{

    fprintf(logFile,

            "Event service thread error occurred:\n"

            "  Error Count = %d  Error = 0x%x (%s)\n",

            params->errorCount,

            params->message,

            mpiMessage(params->message, NULL));

    return FALSE;

}

 

/* Create service thread */

void startEventService(MPIControl control)

{

    MPIControlEventServiceErrorConfig serviceErrorConfig;

    

    serviceErrorConfig.errorHandler = NULL;

    serviceErrorConfig.errorThreshold = 1;

 

    returnValue =

        mpiControlEventServiceStart(*control,

                      MPIThreadPriorityHIGHEST,

                      MPIWaitFOREVER, /* FOREVER => enable interrupts */

                      &serviceErrorConfig);

}

See Also

Event Service | mpiControlEventServiceErrorCountReset | mpiControlEventServiceStart | MPIControlEventServiceErrorHandler | MPIControlEventServiceErrorParams | MPIControlEventServiceStatus