1
1
* Create a new request type: NOOP (described below)
 * For all MPI_*_INIT functions, OBJ_NEW an ompi_request_t and set its
   type to NOOP
 * Ensure that the NOOP requests are OBJ_RELEASE'd when they are done
 * MPI_START looks at the request type; if NOOP, just return success. If
   not, call the PML start() function
 * MPI_STARTALL always pass the entire array of requests back to the PML
   (see next point)
 * Make the PMLs only process PML requests (i.e., ignore/skip anything
   that isn't of type PML -- such as the NOOP requests)
 * Add a little more param error checking in STARTALL

This commit was SVN r12338.

The following Trac tickets were found above:
  Ticket 529 --> https://svn.open-mpi.org/trac/ompi/ticket/529
Этот коммит содержится в:
Jeff Squyres 2006-10-27 12:32:36 +00:00
родитель 477424c537
Коммит e02114dcf3
19 изменённых файлов: 162 добавлений и 39 удалений

Просмотреть файл

@ -113,6 +113,13 @@ OMPI_DECLSPEC extern ompi_errhandler_t ompi_mpi_errors_return;
OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_errhandler_f_to_c_table;
/**
* Forward declaration so that we don't have to include
* request/request.h here.
*/
struct ompi_request_t;
/**
* This is the macro to check the state of MPI and determine whether
* it was properly initialized and not yet finalized.
@ -256,6 +263,16 @@ OMPI_DECLSPEC extern ompi_pointer_array_t *ompi_errhandler_f_to_c_table;
int type, int err_code, const char *message);
/**
* Invoke an MPI exception on the first request found in the array
* that has a non-MPI_SUCCESS value for MPI_ERROR in its status.
* This function should not be invoked unless there is a request
* that is known to have a failure.
*/
int ompi_errhandler_request_invoke(int count,
struct ompi_request_t **requests,
const char *message);
/**
* Create a ompi_errhandler_t
*

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -21,6 +22,7 @@
#include "ompi/communicator/communicator.h"
#include "ompi/win/win.h"
#include "ompi/file/file.h"
#include "ompi/request/request.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/f77/fint_2_int.h"
@ -76,3 +78,56 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
/* All done */
return err_code;
}
int ompi_errhandler_request_invoke(int count,
struct ompi_request_t **requests,
const char *message)
{
int i, ec;
ompi_mpi_object_t mpi_object;
/* Find the first request that has an error. 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(). */
for (i = 0; i < count; ++i) {
if (MPI_REQUEST_NULL != requests[i] &&
MPI_SUCCESS != requests[i]->req_status.MPI_ERROR) {
break;
}
}
/* This shouldn't happen */
if (i >= count) {
return MPI_SUCCESS;
}
ec = ompi_errcode_get_mpi_code(requests[i]->req_status.MPI_ERROR);
mpi_object = requests[i]->req_mpi_object;
switch (requests[i]->req_type) {
case OMPI_REQUEST_PML:
return ompi_errhandler_invoke(mpi_object.comm->error_handler,
mpi_object.comm,
mpi_object.comm->errhandler_type,
ec, message);
break;
case OMPI_REQUEST_IO:
return ompi_errhandler_invoke(mpi_object.file->error_handler,
mpi_object.file,
mpi_object.file->errhandler_type,
ec, message);
break;
case OMPI_REQUEST_WIN:
return ompi_errhandler_invoke(mpi_object.win->error_handler,
mpi_object.win,
mpi_object.win->errhandler_type,
ec, message);
break;
default:
/* Covers REQUEST_GEN, REQUEST_NULL, REQUEST_MAX */
return ompi_errhandler_invoke(MPI_COMM_WORLD->error_handler,
MPI_COMM_WORLD,
MPI_COMM_WORLD->errhandler_type,
ec, message);
break;
}
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -195,6 +196,7 @@ int mca_io_base_request_alloc(ompi_file_t *file,
/* Initialize the request */
OMPI_REQUEST_INIT(&((*req)->super), false);
(*req)->super.req_mpi_object.file = file;
/*
* Copied from ompi/mca/pml/base/pml_base_recvreq.h:

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -68,6 +69,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_pml_base_recv_request_t);
OBJ_RETAIN(datatype); \
\
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent); \
(request)->req_base.req_ompi.req_mpi_object.comm = comm; \
(request)->req_bytes_packed = 0; \
(request)->req_base.req_addr = addr; \
(request)->req_base.req_count = count; \

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -77,6 +78,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION( mca_pml_base_send_request_t );
OBJ_RETAIN(comm); \
\
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent); \
(request)->req_base.req_ompi.req_mpi_object.comm = comm; \
(request)->req_addr = addr; \
(request)->req_send_mode = mode; \
(request)->req_base.req_addr = addr; \

Просмотреть файл

@ -92,6 +92,7 @@ do { \
count ) \
do { \
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, false); \
(request)->req_base.req_ompi.req_mpi_object.comm = comm; \
(request)->req_base.req_pml_complete = false; \
(request)->req_base.req_free_called = false; \
request->req_comm = comm; \
@ -124,6 +125,7 @@ do { \
persistent) \
do { \
OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent); \
(request)->req_base.req_ompi.req_mpi_object.comm = comm; \
(request)->req_base.req_pml_complete = OPAL_INT_TO_BOOL(persistent); \
(request)->req_base.req_free_called = false; \
request->req_comm = comm; \

Просмотреть файл

@ -115,6 +115,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_pml_cm_hvy_send_request_t);
buf, \
0, \
&req_send->req_base.req_convertor ); \
req_send->req_base.req_ompi.req_mpi_object.comm = comm; \
req_send->req_base.req_ompi.req_status.MPI_SOURCE = \
comm->c_my_rank; \
req_send->req_base.req_ompi.req_status.MPI_TAG = tag; \

Просмотреть файл

@ -44,12 +44,8 @@ int MPI_Cancel(MPI_Request *request)
rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == request) {
rc = MPI_ERR_REQUEST;
return ompi_errhandler_request_invoke(1, request, FUNC_NAME);
}
/* JMS: Tim will fix to invoke on the communicator/window/file
on the request (i.e., not COMM_WORLD), if the request is
available/valid */
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, "MPI_Cancel");
}
if (MPI_REQUEST_NULL == *request) {

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -36,6 +37,7 @@ static const char FUNC_NAME[] = "MPI_Test";
int MPI_Test(MPI_Request *request, int *completed, MPI_Status *status)
{
int rc;
if ( MPI_PARAM_CHECK ) {
rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -48,12 +50,13 @@ int MPI_Test(MPI_Request *request, int *completed, MPI_Status *status)
}
rc = ompi_request_test(request, completed, status);
if(*completed < 0) {
if (*completed < 0) {
*completed = 0;
}
/* JMS: Tim will fix to invoke on the communicator/window/file on
the request (i.e., not COMM_WORLD) */
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == rc) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(1, request, FUNC_NAME);
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -36,16 +37,18 @@ static const char FUNC_NAME[] = "MPI_Testall";
int MPI_Testall(int count, MPI_Request requests[], int *flag,
MPI_Status statuses[])
{
int rc;
if ( MPI_PARAM_CHECK ) {
rc = MPI_SUCCESS;
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (NULL == requests) && (0 != count) ) {
rc = MPI_ERR_REQUEST;
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_test_all(count, requests, flag, statuses);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_test_all(count, requests, flag,
statuses)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME);
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,7 +36,6 @@ static const char FUNC_NAME[] = "MPI_Testany";
int MPI_Testany(int count, MPI_Request requests[], int *index, int *completed, MPI_Status *status)
{
int rc;
if ( MPI_PARAM_CHECK ) {
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -49,7 +49,10 @@ int MPI_Testany(int count, MPI_Request requests[], int *index, int *completed, M
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_test_any(count, requests, index, completed, status);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_test_any(count, requests,
index, completed, status)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME);
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,8 +38,6 @@ int MPI_Testsome(int incount, MPI_Request *requests,
int *outcount, int *indices,
MPI_Status *statuses)
{
int rc;
if ( MPI_PARAM_CHECK ) {
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -52,6 +51,9 @@ int MPI_Testsome(int incount, MPI_Request *requests,
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_test_some(incount, requests, outcount, indices, statuses);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_test_some(incount, requests, outcount,
indices, statuses)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME);
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,9 +36,8 @@ static const char FUNC_NAME[] = "MPI_Wait";
int MPI_Wait(MPI_Request *request, MPI_Status *status)
{
int rc;
if ( MPI_PARAM_CHECK ) {
rc = MPI_SUCCESS;
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (request == NULL) {
rc = MPI_ERR_REQUEST;
@ -56,6 +56,8 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status)
return MPI_SUCCESS;
}
rc = ompi_request_wait(request, status);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_wait(request, status)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(1, request, FUNC_NAME);
}

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,10 +36,8 @@ static const char FUNC_NAME[] = "MPI_Waitall";
int MPI_Waitall(int count, MPI_Request *requests, MPI_Status *statuses)
{
int rc;
if ( MPI_PARAM_CHECK ) {
int i;
rc = MPI_SUCCESS;
int i, rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (NULL == requests) && (0 != count) ) {
rc = MPI_ERR_REQUEST;
@ -50,7 +49,10 @@ int MPI_Waitall(int count, MPI_Request *requests, MPI_Status *statuses)
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_wait_all(count, requests, statuses);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_wait_all(count, requests, statuses)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME);
}

Просмотреть файл

@ -11,6 +11,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,10 +38,8 @@ static const char FUNC_NAME[] = "MPI_Waitany";
int MPI_Waitany(int count, MPI_Request *requests, int *index, MPI_Status *status)
{
int rc;
if ( MPI_PARAM_CHECK ) {
int i;
rc = MPI_SUCCESS;
int i, rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (NULL == requests) && (0 != count) ) {
rc = MPI_ERR_REQUEST;
@ -52,7 +51,10 @@ int MPI_Waitany(int count, MPI_Request *requests, int *index, MPI_Status *status
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_wait_any(count, requests, index, status);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_wait_any(count, requests, index, status)) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME);
}

Просмотреть файл

@ -11,6 +11,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -39,8 +40,6 @@ int MPI_Waitsome(int incount, MPI_Request *requests,
int *outcount, int *indices,
MPI_Status *statuses)
{
int rc;
if ( MPI_PARAM_CHECK ) {
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -53,7 +52,10 @@ int MPI_Waitsome(int incount, MPI_Request *requests,
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
rc = ompi_request_wait_some( incount, requests, outcount, indices, statuses );
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
if (OMPI_SUCCESS == ompi_request_wait_some( incount, requests,
outcount, indices, statuses )) {
return MPI_SUCCESS;
}
return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME);
}

Просмотреть файл

@ -47,6 +47,7 @@ static void ompi_grequest_construct(ompi_grequest_t* greq)
greq->greq_base.req_free = ompi_grequest_free;
greq->greq_base.req_cancel = ompi_grequest_cancel;
greq->greq_base.req_type = OMPI_REQUEST_GEN;
greq->greq_base.req_mpi_object.comm = &ompi_mpi_comm_world;
}
static void ompi_grequest_destruct(ompi_grequest_t* greq)

Просмотреть файл

@ -38,6 +38,7 @@ static void ompi_request_construct(ompi_request_t* req)
req->req_free = NULL;
req->req_cancel = NULL;
req->req_f_to_c_index = MPI_UNDEFINED;
req->req_mpi_object.comm = (struct ompi_communicator_t*) NULL;
}
static void ompi_request_destruct(ompi_request_t* req)

Просмотреть файл

@ -27,7 +27,6 @@
#include "mpi.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_pointer_array.h"
#include "ompi/errhandler/errhandler.h"
#include "opal/threads/condition.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -47,6 +46,7 @@ typedef enum {
OMPI_REQUEST_GEN, /**< MPI-2 generalized request */
OMPI_REQUEST_WIN, /**< MPI-2 one-sided request */
OMPI_REQUEST_NULL, /**< NULL request */
OMPI_REQUEST_NOOP, /**< A request that does nothing (e.g., to PROC_NULL) */
OMPI_REQUEST_MAX /**< Maximum request type */
} ompi_request_type_t;
@ -79,6 +79,30 @@ typedef int (*ompi_request_free_fn_t)(struct ompi_request_t** rptr);
typedef int (*ompi_request_cancel_fn_t)(struct ompi_request_t* request, int flag);
/**
* Forward declaration
*/
struct ompi_communicator_t;
/**
* Forward declaration
*/
struct ompi_win_t;
/**
* Forward declaration
*/
struct ompi_file_t;
/**
* Union for holding several different MPI pointer types on the request
*/
typedef union ompi_mpi_object_t {
struct ompi_communicator_t *comm;
struct ompi_file_t *file;
struct ompi_win_t *win;
} ompi_mpi_object_t;
/**
* Main top-level request struct definition
*/
@ -92,6 +116,7 @@ struct ompi_request_t {
int req_f_to_c_index; /**< Index in Fortran <-> C translation array */
ompi_request_free_fn_t req_free; /**< Called by free */
ompi_request_cancel_fn_t req_cancel; /**< Optional function to cancel the request */
ompi_mpi_object_t req_mpi_object; /**< Pointer to MPI object that created this request */
};
/**