Skip to content

Commit

Permalink
Merge pull request #8008 from jsquyres/pr/cleanup-of-mpi-errors-and-e…
Browse files Browse the repository at this point in the history
…xceptions

Cleanup of MPI errors and exceptions
  • Loading branch information
jsquyres authored Aug 17, 2020
2 parents f3832c1 + 20c772e commit bf4e1b4
Show file tree
Hide file tree
Showing 41 changed files with 411 additions and 440 deletions.
2 changes: 1 addition & 1 deletion ompi/communicator/comm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ static void ompi_comm_destruct(ompi_communicator_t* comm)
from one communicator to another and we end up destroying the
new communication while propagating the error up the stack. We
want to make it all the way up the stack to invoke the MPI
exception, not cause a seg fault in pml_del_comm because it was
error, not cause a seg fault in pml_del_comm because it was
never pml_add_com'ed. */

if ( MPI_COMM_NULL != comm && OMPI_COMM_IS_PML_ADDED(comm) ) {
Expand Down
2 changes: 0 additions & 2 deletions ompi/debuggers/ompi_mpihandles_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@ int mpidbg_init_per_process(mqs_process *process,
&mpidbg_errhandler_name_map[i++]);
fill_map(image, "MPI_ERRHANDLER_NULL", "ompi_mpi_errhandler_null",
&mpidbg_errhandler_name_map[i++]);
/* MPI::ERRORS_THROW_EXCEPTIONS exists as a symbol in OMPI; no
need to alias it here */

/* Sentinel value */
mpidbg_errhandler_name_map[i].map_name = NULL;
Expand Down
24 changes: 0 additions & 24 deletions ompi/errhandler/errhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ ompi_predefined_errhandler_t *ompi_mpi_errors_abort_addr =
ompi_predefined_errhandler_t ompi_mpi_errors_return = {{{0}}};
ompi_predefined_errhandler_t *ompi_mpi_errors_return_addr =
&ompi_mpi_errors_return;
ompi_predefined_errhandler_t ompi_mpi_errors_throw_exceptions = {{{0}}};
ompi_predefined_errhandler_t *ompi_mpi_errors_throw_exceptions_addr =
&ompi_mpi_errors_throw_exceptions;

static opal_mutex_t errhandler_init_lock = OPAL_MUTEX_STATIC_INIT;
ompi_errhandler_t* ompi_initial_error_handler_eh = NULL;
Expand Down Expand Up @@ -192,26 +189,6 @@ int ompi_errhandler_init(void)
"MPI_ERRORS_ABORT",
sizeof(ompi_mpi_errors_abort.eh.eh_name));

/* If we're going to use C++, functions will be fixed up during
MPI::Init. Note that it is proper to use ERRHANDLER_LANG_C here;
the dispatch function is in C (although in libmpi_cxx); the
conversion from C handles to C++ handles happens in that dispatch
function -- not the errhandler_invoke.c stuff here in libmpi. */
OBJ_CONSTRUCT( &ompi_mpi_errors_throw_exceptions.eh, ompi_errhandler_t );
ompi_mpi_errors_throw_exceptions.eh.eh_mpi_object_type =
OMPI_ERRHANDLER_TYPE_PREDEFINED;
ompi_mpi_errors_throw_exceptions.eh.eh_lang = OMPI_ERRHANDLER_LANG_C;
ompi_mpi_errors_throw_exceptions.eh.eh_comm_fn =
ompi_mpi_errors_are_fatal_comm_handler;
ompi_mpi_errors_throw_exceptions.eh.eh_file_fn =
ompi_mpi_errors_are_fatal_file_handler;
ompi_mpi_errors_throw_exceptions.eh.eh_win_fn =
ompi_mpi_errors_are_fatal_win_handler ;
ompi_mpi_errors_throw_exceptions.eh.eh_fort_fn = NULL;
opal_string_copy(ompi_mpi_errors_throw_exceptions.eh.eh_name,
"MPI_ERRORS_THROW_EXCEPTIONS",
sizeof(ompi_mpi_errors_throw_exceptions.eh.eh_name));

/* Lets initialize the initial error handler if not already done */
char *env = getenv("OMPI_MCA_mpi_initial_errhandler");
if( NULL != env ) {
Expand All @@ -228,7 +205,6 @@ int ompi_errhandler_finalize(void)
{
OBJ_DESTRUCT(&ompi_mpi_errhandler_null.eh);
OBJ_DESTRUCT(&ompi_mpi_errors_return.eh);
OBJ_DESTRUCT(&ompi_mpi_errors_throw_exceptions.eh);
OBJ_DESTRUCT(&ompi_mpi_errors_are_fatal.eh);

/* JMS Add stuff here checking for unreleased errorhandlers,
Expand Down
10 changes: 2 additions & 8 deletions ompi/errhandler/errhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ OMPI_DECLSPEC extern ompi_predefined_errhandler_t *ompi_mpi_errors_return_addr;
OMPI_DECLSPEC extern ompi_predefined_errhandler_t ompi_mpi_errors_abort;
OMPI_DECLSPEC extern ompi_predefined_errhandler_t *ompi_mpi_errors_abort_addr;

/**
* Global variable for MPI::ERRORS_THROW_EXCEPTIONS. Will abort if
* MPI_INIT wasn't called as MPI::INIT (_addr flavor is for F03 bindings)
*/
OMPI_DECLSPEC extern ompi_predefined_errhandler_t ompi_mpi_errors_throw_exceptions;

/**
* Table for Fortran <-> C errhandler handle conversion
*/
Expand Down Expand Up @@ -387,7 +381,7 @@ struct ompi_request_t;
*
* @returns err_code The same value as the parameter
*
* This function invokes the MPI exception function on the error
* This function invokes the MPI error function on the error
* handler. If the errhandler was created from fortran, the error
* handler will be invoked with fortran linkage. Otherwise, it is
* invoked with C linkage.
Expand All @@ -400,7 +394,7 @@ struct ompi_request_t;


/**
* Invoke an MPI exception on the first request found in the array
* Invoke an MPI error on the first request found in the array
* that has a non-MPI_SUCCESS value for MPI_ERROR in its status. It
* is safe to invoke this function if none of the requests have an
* outstanding error; MPI_SUCCESS will be returned.
Expand Down
8 changes: 4 additions & 4 deletions ompi/errhandler/errhandler_invoke.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int ompi_errhandler_request_invoke(int count,
ompi_mpi_object_t mpi_object;

/* Find the *first* request that has an error -- that's the one
that we'll invoke the exception on. In an error condition, the
that we'll invoke the error on. In an error condition, the
request will not have been reset back to MPI_REQUEST_NULL, so
there's no need to cache values from before we call
ompi_request_test(). */
Expand All @@ -162,18 +162,18 @@ int ompi_errhandler_request_invoke(int count,

/* Since errors on requests cause them to not be freed (until we
can examine them here), go through and free all requests with
errors. We only invoke the exception on the *first* request
errors. We only invoke the error on the *first* request
that had an error. */
for (; i < count; ++i) {
if (MPI_REQUEST_NULL != requests[i] &&
MPI_SUCCESS != requests[i]->req_status.MPI_ERROR) {
/* Ignore the error -- what are we going to do? We're
already going to invoke an exception */
already going to invoke an error */
ompi_request_free(&(requests[i]));
}
}

/* Invoke the exception */
/* Invoke the error */
switch (type) {
case OMPI_REQUEST_PML:
case OMPI_REQUEST_COLL:
Expand Down
2 changes: 1 addition & 1 deletion ompi/mca/io/base/io_base_find_available.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int init_query_2_0_0(const mca_base_component_t *ls,
* and destroy the opened list.
*
* It is *not* an error if there are no io components available.
* Appropriate run-time MPI exceptions will be invoked during
* Appropriate run-time MPI errors will be invoked during
* MPI_FILE_OPEN and MPI_FILE_DELETE.
*/
int mca_io_base_find_available(bool enable_progress_threads,
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/errhandler_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int MPI_Errhandler_free(MPI_Errhandler *errhandler)

if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
/* Raise an MPI exception if we got NULL or if we got an intrinsic
/* Raise an MPI error if we got NULL or if we got an intrinsic
*and* the reference count is 1 (meaning that this FREE would
actually free the underlying intrinsic object). This is ugly
but necessary -- see below. */
Expand Down
20 changes: 10 additions & 10 deletions ompi/mpi/java/java/CartComm.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected CartComm(long[] commRequest)
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
@Override public CartComm dup() throws MPIException
{
Expand All @@ -106,7 +106,7 @@ protected CartComm(long[] commRequest)
* <p>The new communicator can't be used before the operation completes.
* The request object must be obtained calling {@link #getRequest}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred. Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred. Signals that an MPI exception of some sort has occurred.
*/
@Override public CartComm iDup() throws MPIException
{
Expand All @@ -119,7 +119,7 @@ protected CartComm(long[] commRequest)
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
@Override public CartComm dupWithInfo(Info info) throws MPIException
{
Expand All @@ -134,7 +134,7 @@ protected CartComm(long[] commRequest)
* <p>The number of dimensions can be obtained from the size of (eg)
* {@code dims} field of the returned object.
* @return object containing dimensions, periods and local coordinates
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public CartParms getTopo() throws MPIException
{
Expand All @@ -149,7 +149,7 @@ public CartParms getTopo() throws MPIException
* <p>Java binding of the MPI operation {@code MPI_CART_RANK}.
* @param coords Cartesian coordinates of a process
* @return rank of the specified process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public int getRank(int[] coords) throws MPIException
{
Expand All @@ -164,7 +164,7 @@ public int getRank(int[] coords) throws MPIException
* <p>Java binding of the MPI operation {@code MPI_CART_COORDS}.
* @param rank rank of a process
* @return Cartesian coordinates of the specified process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public int[] getCoords(int rank) throws MPIException
{
Expand All @@ -180,7 +180,7 @@ public int[] getCoords(int rank) throws MPIException
* @param direction coordinate dimension of shift
* @param disp displacement
* @return object containing ranks of source and destination processes
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public ShiftParms shift(int direction, int disp) throws MPIException
{
Expand All @@ -197,7 +197,7 @@ private native ShiftParms shift(long comm, int direction, int disp)
* @param remainDims by dimension, {@code true} if dimension is to be kept,
* {@code false} otherwise
* @return communicator containing subgrid including this process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public CartComm sub(boolean[] remainDims) throws MPIException
{
Expand All @@ -215,7 +215,7 @@ public CartComm sub(boolean[] remainDims) throws MPIException
* @param periods {@code true} if grid is periodic,
* {@code false} if not, in each dimension
* @return reordered rank of calling process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public int map(int[] dims, boolean[] periods) throws MPIException
{
Expand All @@ -231,7 +231,7 @@ private native int map(long comm, int[] dims, boolean[] periods)
* <p>Java binding of the MPI operation {@code MPI_DIMS_CREATE}.
* @param nnodes number of nodes in a grid
* @param dims array specifying the number of nodes in each dimension
* @throws MPIException Signals that an MPI exception of some sort has occurred.
* @throws MPIException Signals that an MPI error of some sort has occurred.
*/
public static void createDims(int nnodes, int[] dims) throws MPIException
{
Expand Down
Loading

0 comments on commit bf4e1b4

Please sign in to comment.