2004-10-12 19:50:01 +04:00
|
|
|
/*
|
2010-03-13 02:57:50 +03:00
|
|
|
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2010-07-22 00:07:00 +04:00
|
|
|
* Copyright (c) 2004-2010 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2008-09-02 19:36:10 +04:00
|
|
|
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2008-06-07 06:44:10 +04:00
|
|
|
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
2010-08-04 23:36:40 +04:00
|
|
|
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
2012-03-21 21:46:15 +04:00
|
|
|
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-10-12 19:50:01 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/request/request.h"
|
2007-12-06 12:23:44 +03:00
|
|
|
#include "ompi/request/request_default.h"
|
2006-11-02 06:34:53 +03:00
|
|
|
#include "ompi/request/grequest.h"
|
2004-10-12 19:50:01 +04:00
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "opal/runtime/opal_cr.h"
|
|
|
|
#include "ompi/mca/crcp/crcp.h"
|
2008-02-12 11:46:27 +03:00
|
|
|
#include "ompi/mca/pml/base/pml_base_request.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2012-08-16 23:00:44 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
|
|
|
static int ompi_progress_thread_count=0;
|
|
|
|
#endif
|
2007-12-06 12:23:44 +03:00
|
|
|
|
|
|
|
int ompi_request_default_wait(
|
2006-03-02 03:39:07 +03:00
|
|
|
ompi_request_t ** req_ptr,
|
|
|
|
ompi_status_public_t * status)
|
|
|
|
{
|
|
|
|
ompi_request_t *req = *req_ptr;
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2007-10-18 16:33:21 +04:00
|
|
|
ompi_request_wait_completion(req);
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
OMPI_CRCP_REQUEST_COMPLETE(req);
|
|
|
|
#endif
|
2008-04-07 21:46:50 +04:00
|
|
|
|
2006-11-02 06:34:53 +03:00
|
|
|
/* return status. If it's a generalized request, we *have* to
|
|
|
|
invoke the query_fn, even if the user procided STATUS_IGNORE.
|
|
|
|
MPI-2:8.2. */
|
|
|
|
if (OMPI_REQUEST_GEN == req->req_type) {
|
|
|
|
ompi_grequest_invoke_query(req, &req->req_status);
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
if( MPI_STATUS_IGNORE != status ) {
|
2008-06-07 06:44:10 +04:00
|
|
|
/* Do *NOT* set status->MPI_ERROR here! See MPI-1.1 doc, sec
|
|
|
|
3.2.5, p.22 */
|
2006-09-18 22:00:16 +04:00
|
|
|
status->MPI_TAG = req->req_status.MPI_TAG;
|
|
|
|
status->MPI_SOURCE = req->req_status.MPI_SOURCE;
|
2010-08-04 23:36:40 +04:00
|
|
|
OMPI_STATUS_SET_COUNT(&status->_ucount, &req->req_status._ucount);
|
2006-09-18 22:00:16 +04:00
|
|
|
status->_cancelled = req->req_status._cancelled;
|
2006-03-02 03:39:07 +03:00
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
if( req->req_persistent ) {
|
2006-10-17 08:27:00 +04:00
|
|
|
if( req->req_state == OMPI_REQUEST_INACTIVE ) {
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
req->req_state = OMPI_REQUEST_INACTIVE;
|
2006-07-19 01:28:45 +04:00
|
|
|
return req->req_status.MPI_ERROR;
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
|
|
|
|
2006-12-09 17:20:08 +03:00
|
|
|
/* If there was an error, don't free the request -- just return
|
|
|
|
the single error. */
|
|
|
|
if (MPI_SUCCESS != req->req_status.MPI_ERROR) {
|
|
|
|
return req->req_status.MPI_ERROR;
|
2006-07-19 01:28:45 +04:00
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2006-12-09 17:20:08 +03:00
|
|
|
/* If there's an error while freeing the request, assume that the
|
|
|
|
request is still there. Otherwise, Bad Things will happen
|
|
|
|
later! */
|
|
|
|
return ompi_request_free(req_ptr);
|
2006-03-02 03:39:07 +03:00
|
|
|
}
|
|
|
|
|
2004-10-12 19:50:01 +04:00
|
|
|
|
2007-12-06 12:23:44 +03:00
|
|
|
int ompi_request_default_wait_any(
|
2004-10-12 19:50:01 +04:00
|
|
|
size_t count,
|
|
|
|
ompi_request_t ** requests,
|
2005-12-13 11:58:00 +03:00
|
|
|
int *index,
|
2004-10-12 19:50:01 +04:00
|
|
|
ompi_status_public_t * status)
|
|
|
|
{
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2004-10-12 19:50:01 +04:00
|
|
|
int c;
|
|
|
|
#endif
|
2004-12-06 05:15:34 +03:00
|
|
|
size_t i=0, num_requests_null_inactive=0;
|
2004-10-21 01:41:48 +04:00
|
|
|
int rc = OMPI_SUCCESS;
|
2004-10-20 18:56:52 +04:00
|
|
|
int completed = -1;
|
2004-12-06 05:15:34 +03:00
|
|
|
ompi_request_t **rptr=NULL;
|
|
|
|
ompi_request_t *request=NULL;
|
2004-10-12 19:50:01 +04:00
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2004-10-12 19:50:01 +04:00
|
|
|
/* poll for completion */
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,1);
|
2006-03-02 03:39:07 +03:00
|
|
|
for (c = 0; completed < 0 && c < opal_progress_spin_count; c++) {
|
2004-10-12 19:50:01 +04:00
|
|
|
rptr = requests;
|
2004-10-27 02:09:26 +04:00
|
|
|
num_requests_null_inactive = 0;
|
2004-10-21 01:41:48 +04:00
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
2004-10-12 19:50:01 +04:00
|
|
|
request = *rptr;
|
2005-12-13 11:58:00 +03:00
|
|
|
/*
|
|
|
|
* Check for null or completed persistent request.
|
|
|
|
* For MPI_REQUEST_NULL, the req_state is always OMPI_REQUEST_INACTIVE
|
|
|
|
*/
|
2006-01-20 00:46:53 +03:00
|
|
|
if( request->req_state == OMPI_REQUEST_INACTIVE ) {
|
2006-01-20 20:17:13 +03:00
|
|
|
num_requests_null_inactive++;
|
2004-10-12 22:01:39 +04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (true == request->req_complete) {
|
2004-10-12 19:50:01 +04:00
|
|
|
completed = i;
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
|
2004-10-12 22:01:39 +04:00
|
|
|
goto finished;
|
2005-12-13 11:58:00 +03:00
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
2006-03-02 03:39:07 +03:00
|
|
|
if( num_requests_null_inactive == count ) {
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
|
2006-01-20 20:17:13 +03:00
|
|
|
goto finished;
|
2006-03-02 03:39:07 +03:00
|
|
|
}
|
|
|
|
opal_progress();
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
|
2004-10-12 19:50:01 +04:00
|
|
|
#endif
|
|
|
|
|
2004-10-12 22:01:39 +04:00
|
|
|
/* give up and sleep until completion */
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2005-03-26 21:49:16 +03:00
|
|
|
ompi_request_waiting++;
|
2006-01-14 01:02:40 +03:00
|
|
|
do {
|
2004-10-12 22:01:39 +04:00
|
|
|
rptr = requests;
|
2004-10-27 02:09:26 +04:00
|
|
|
num_requests_null_inactive = 0;
|
2004-10-21 01:41:48 +04:00
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
2004-10-12 22:01:39 +04:00
|
|
|
request = *rptr;
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
/* Sanity test */
|
|
|
|
if( NULL == request) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-12-13 11:58:00 +03:00
|
|
|
/*
|
|
|
|
* Check for null or completed persistent request.
|
2006-01-20 20:17:13 +03:00
|
|
|
* For MPI_REQUEST_NULL, the req_state is always OMPI_REQUEST_INACTIVE.
|
2005-12-13 11:58:00 +03:00
|
|
|
*/
|
2006-01-20 00:46:53 +03:00
|
|
|
if( request->req_state == OMPI_REQUEST_INACTIVE ) {
|
2004-10-27 02:09:26 +04:00
|
|
|
num_requests_null_inactive++;
|
2004-10-12 22:01:39 +04:00
|
|
|
continue;
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
if (request->req_complete == true) {
|
|
|
|
completed = i;
|
|
|
|
break;
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
}
|
2004-10-27 02:09:26 +04:00
|
|
|
if(num_requests_null_inactive == count)
|
2004-10-12 22:01:39 +04:00
|
|
|
break;
|
2006-01-14 01:02:40 +03:00
|
|
|
if (completed < 0) {
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_condition_wait(&ompi_request_cond, &ompi_request_lock);
|
2004-10-12 22:01:39 +04:00
|
|
|
}
|
2006-01-14 01:02:40 +03:00
|
|
|
} while (completed < 0);
|
2004-10-12 22:01:39 +04:00
|
|
|
ompi_request_waiting--;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2004-10-12 19:50:01 +04:00
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2004-10-12 22:01:39 +04:00
|
|
|
finished:
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
|
2005-02-16 20:42:07 +03:00
|
|
|
|
2004-10-27 02:09:26 +04:00
|
|
|
if(num_requests_null_inactive == count) {
|
2004-10-12 22:01:39 +04:00
|
|
|
*index = MPI_UNDEFINED;
|
2004-10-27 02:09:26 +04:00
|
|
|
if (MPI_STATUS_IGNORE != status) {
|
2010-08-04 23:36:40 +04:00
|
|
|
OMPI_STATUS_SET(status, &ompi_status_empty);
|
2004-10-27 02:09:26 +04:00
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
} else {
|
2006-03-16 01:53:41 +03:00
|
|
|
assert( true == request->req_complete );
|
2006-11-02 06:34:53 +03:00
|
|
|
/* Per note above, we have to call gen request query_fn even
|
|
|
|
if STATUS_IGNORE was provided */
|
|
|
|
if (OMPI_REQUEST_GEN == request->req_type) {
|
|
|
|
rc = ompi_grequest_invoke_query(request, &request->req_status);
|
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
if (MPI_STATUS_IGNORE != status) {
|
2008-06-07 06:44:10 +04:00
|
|
|
/* Do *NOT* set status->MPI_ERROR here! See MPI-1.1 doc,
|
|
|
|
sec 3.2.5, p.22 */
|
2006-07-25 19:29:37 +04:00
|
|
|
int old_error = status->MPI_ERROR;
|
2010-08-04 23:36:40 +04:00
|
|
|
OMPI_STATUS_SET(status, &request->req_status);
|
2006-07-25 19:29:37 +04:00
|
|
|
status->MPI_ERROR = old_error;
|
2004-10-12 22:01:39 +04:00
|
|
|
}
|
2006-12-09 17:20:08 +03:00
|
|
|
rc = request->req_status.MPI_ERROR;
|
2006-03-16 01:53:41 +03:00
|
|
|
if( request->req_persistent ) {
|
|
|
|
request->req_state = OMPI_REQUEST_INACTIVE;
|
2006-12-09 17:20:08 +03:00
|
|
|
} else if (MPI_SUCCESS == rc) {
|
|
|
|
/* Only free the request if there is no error on it */
|
|
|
|
/* If there's an error while freeing the request,
|
|
|
|
assume that the request is still there. Otherwise,
|
|
|
|
Bad Things will happen later! */
|
|
|
|
rc = ompi_request_free(rptr);
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
*index = completed;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
if( opal_cr_is_enabled) {
|
|
|
|
rptr = requests;
|
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
|
|
|
request = *rptr;
|
|
|
|
if( true == request->req_complete) {
|
|
|
|
OMPI_CRCP_REQUEST_COMPLETE(request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-10-12 19:50:01 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-06 12:23:44 +03:00
|
|
|
int ompi_request_default_wait_all( size_t count,
|
2011-02-25 23:51:16 +03:00
|
|
|
ompi_request_t ** requests,
|
|
|
|
ompi_status_public_t * statuses )
|
2004-10-12 19:50:01 +04:00
|
|
|
{
|
2012-03-21 21:46:15 +04:00
|
|
|
size_t completed = 0, i, failed = 0;
|
2004-10-12 19:50:01 +04:00
|
|
|
ompi_request_t **rptr;
|
|
|
|
ompi_request_t *request;
|
2006-03-16 01:53:41 +03:00
|
|
|
int mpi_error = OMPI_SUCCESS;
|
2004-10-12 19:50:01 +04:00
|
|
|
|
|
|
|
rptr = requests;
|
|
|
|
for (i = 0; i < count; i++) {
|
2004-10-14 23:17:16 +04:00
|
|
|
request = *rptr++;
|
2012-03-21 21:46:15 +04:00
|
|
|
|
2004-10-12 22:01:39 +04:00
|
|
|
if (request->req_complete == true) {
|
2012-03-22 18:09:19 +04:00
|
|
|
if( OPAL_UNLIKELY( MPI_SUCCESS != request->req_status.MPI_ERROR ) ) {
|
2012-03-21 21:46:15 +04:00
|
|
|
failed++;
|
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
completed++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 21:46:15 +04:00
|
|
|
if( failed > 0 ) {
|
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
|
2004-10-12 19:50:01 +04:00
|
|
|
/* if all requests have not completed -- defer acquiring lock
|
2005-12-13 11:58:00 +03:00
|
|
|
* unless required
|
2004-10-12 19:50:01 +04:00
|
|
|
*/
|
|
|
|
if (completed != count) {
|
|
|
|
/*
|
|
|
|
* acquire lock and test for completion - if all requests are
|
|
|
|
* not completed pend on condition variable until a request
|
|
|
|
* completes
|
|
|
|
*/
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2004-10-12 19:50:01 +04:00
|
|
|
ompi_request_waiting++;
|
2011-03-19 00:36:35 +03:00
|
|
|
#if OPAL_ENABLE_MULTI_THREADS
|
2006-01-20 00:46:53 +03:00
|
|
|
/*
|
|
|
|
* confirm the status of the pending requests. We have to do it before
|
|
|
|
* taking the condition or otherwise we can miss some requests completion (the
|
|
|
|
* one that happpens between our initial test and the aquisition of the lock).
|
|
|
|
*/
|
|
|
|
rptr = requests;
|
|
|
|
for( completed = i = 0; i < count; i++ ) {
|
|
|
|
request = *rptr++;
|
|
|
|
if (request->req_complete == true) {
|
2012-03-21 21:46:15 +04:00
|
|
|
if( MPI_SUCCESS != request->req_status.MPI_ERROR ) {
|
|
|
|
failed++;
|
|
|
|
}
|
2006-01-20 00:46:53 +03:00
|
|
|
completed++;
|
|
|
|
}
|
|
|
|
}
|
2012-03-21 21:46:15 +04:00
|
|
|
if( failed > 0 ) {
|
|
|
|
ompi_request_waiting--;
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
goto finish;
|
|
|
|
}
|
2011-03-19 00:36:35 +03:00
|
|
|
#endif /* OPAL_ENABLE_MULTI_THREADS */
|
2006-01-20 20:17:13 +03:00
|
|
|
while( completed != count ) {
|
2005-11-10 03:45:27 +03:00
|
|
|
/* check number of pending requests */
|
|
|
|
size_t start = ompi_request_completed;
|
|
|
|
size_t pending = count - completed;
|
2012-03-21 21:46:15 +04:00
|
|
|
size_t start_failed = ompi_request_failed;
|
2005-11-10 03:45:27 +03:00
|
|
|
/*
|
2006-03-16 01:53:41 +03:00
|
|
|
* wait until at least pending requests complete
|
2006-01-20 20:17:13 +03:00
|
|
|
*/
|
2005-11-10 03:45:27 +03:00
|
|
|
while (pending > ompi_request_completed - start) {
|
|
|
|
opal_condition_wait(&ompi_request_cond, &ompi_request_lock);
|
2012-03-21 21:46:15 +04:00
|
|
|
/*
|
|
|
|
* Check for failed requests. If one request fails, then
|
|
|
|
* this operation completes in error marking the remaining
|
|
|
|
* requests as PENDING.
|
|
|
|
*/
|
2012-03-22 18:09:19 +04:00
|
|
|
if( OPAL_UNLIKELY( 0 < (ompi_request_failed - start_failed) ) ) {
|
2012-03-21 21:46:15 +04:00
|
|
|
failed += (ompi_request_failed - start_failed);
|
|
|
|
ompi_request_waiting--;
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
goto finish;
|
|
|
|
}
|
2005-11-10 03:45:27 +03:00
|
|
|
}
|
|
|
|
/*
|
2006-01-20 00:46:53 +03:00
|
|
|
* confirm that all pending operations have completed.
|
|
|
|
*/
|
2004-10-12 19:50:01 +04:00
|
|
|
rptr = requests;
|
2012-03-21 21:46:15 +04:00
|
|
|
for( failed = completed = i = 0; i < count; i++ ) {
|
2004-10-14 23:17:16 +04:00
|
|
|
request = *rptr++;
|
2004-10-14 02:56:42 +04:00
|
|
|
if (request->req_complete == true) {
|
2012-03-21 21:46:15 +04:00
|
|
|
if( MPI_SUCCESS != request->req_status.MPI_ERROR ) {
|
|
|
|
failed++;
|
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
completed++;
|
|
|
|
}
|
|
|
|
}
|
2006-01-20 20:17:13 +03:00
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
ompi_request_waiting--;
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
if( opal_cr_is_enabled) {
|
|
|
|
rptr = requests;
|
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
|
|
|
request = *rptr;
|
|
|
|
if( true == request->req_complete) {
|
|
|
|
OMPI_CRCP_REQUEST_COMPLETE(request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 21:46:15 +04:00
|
|
|
finish:
|
2006-03-16 01:53:41 +03:00
|
|
|
rptr = requests;
|
2004-10-27 02:09:26 +04:00
|
|
|
if (MPI_STATUSES_IGNORE != statuses) {
|
2004-10-12 19:50:01 +04:00
|
|
|
/* fill out status and free request if required */
|
2006-03-16 01:53:41 +03:00
|
|
|
for( i = 0; i < count; i++, rptr++ ) {
|
2004-10-12 19:50:01 +04:00
|
|
|
request = *rptr;
|
2012-03-21 21:46:15 +04:00
|
|
|
|
|
|
|
/*
|
2012-03-22 18:09:19 +04:00
|
|
|
* Assert only if no requests were failed.
|
|
|
|
* Since some may still be pending.
|
2012-03-21 21:46:15 +04:00
|
|
|
*/
|
2012-03-22 18:09:19 +04:00
|
|
|
if( 0 >= failed ) {
|
2012-03-21 21:46:15 +04:00
|
|
|
assert( true == request->req_complete );
|
|
|
|
}
|
|
|
|
|
2006-11-02 06:34:53 +03:00
|
|
|
if (OMPI_REQUEST_GEN == request->req_type) {
|
|
|
|
ompi_grequest_invoke_query(request, &request->req_status);
|
|
|
|
}
|
2008-09-02 19:36:10 +04:00
|
|
|
|
2010-08-04 23:36:40 +04:00
|
|
|
OMPI_STATUS_SET(&statuses[i], &request->req_status);
|
2012-03-22 18:09:19 +04:00
|
|
|
/*
|
|
|
|
* Per MPI 2.2 p 60:
|
|
|
|
* Allows requests to be marked as MPI_ERR_PENDING if they are
|
|
|
|
* "neither failed nor completed." Which can only happen if
|
|
|
|
* there was an error in one of the other requests.
|
|
|
|
*/
|
|
|
|
if( OPAL_UNLIKELY(0 < failed) ) {
|
|
|
|
if( !request->req_complete ) {
|
|
|
|
statuses[i].MPI_ERROR = MPI_ERR_PENDING;
|
|
|
|
mpi_error = MPI_ERR_IN_STATUS;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2008-09-02 19:36:10 +04:00
|
|
|
|
2006-03-16 01:53:41 +03:00
|
|
|
if( request->req_persistent ) {
|
|
|
|
request->req_state = OMPI_REQUEST_INACTIVE;
|
|
|
|
} else {
|
2006-12-09 17:20:08 +03:00
|
|
|
/* Only free the request if there is no error on it */
|
|
|
|
if (MPI_SUCCESS == request->req_status.MPI_ERROR) {
|
|
|
|
/* If there's an error while freeing the request,
|
|
|
|
assume that the request is still there.
|
|
|
|
Otherwise, Bad Things will happen later! */
|
|
|
|
int tmp = ompi_request_free(rptr);
|
2012-03-21 21:46:15 +04:00
|
|
|
if (OMPI_SUCCESS == mpi_error && OMPI_SUCCESS != tmp) {
|
2006-12-09 17:20:08 +03:00
|
|
|
mpi_error = tmp;
|
|
|
|
}
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
|
|
|
if( statuses[i].MPI_ERROR != OMPI_SUCCESS) {
|
2006-07-25 19:29:37 +04:00
|
|
|
mpi_error = MPI_ERR_IN_STATUS;
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* free request if required */
|
2006-03-16 01:53:41 +03:00
|
|
|
for( i = 0; i < count; i++, rptr++ ) {
|
2004-10-12 22:01:39 +04:00
|
|
|
int rc;
|
2004-10-12 19:50:01 +04:00
|
|
|
request = *rptr;
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2012-03-21 21:46:15 +04:00
|
|
|
/*
|
2012-03-22 18:09:19 +04:00
|
|
|
* Assert only if no requests were failed.
|
|
|
|
* Since some may still be pending.
|
2012-03-21 21:46:15 +04:00
|
|
|
*/
|
2012-03-22 18:09:19 +04:00
|
|
|
if( 0 >= failed ) {
|
|
|
|
assert( true == request->req_complete );
|
|
|
|
} else {
|
|
|
|
/* If the request is still pending due to a failed request
|
|
|
|
* then skip it in this loop.
|
|
|
|
*/
|
2012-03-21 21:46:15 +04:00
|
|
|
if( !request->req_complete ) {
|
2012-03-22 18:09:19 +04:00
|
|
|
continue;
|
2012-03-21 21:46:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-02 06:34:53 +03:00
|
|
|
/* Per note above, we have to call gen request query_fn
|
|
|
|
even if STATUSES_IGNORE was provided */
|
|
|
|
if (OMPI_REQUEST_GEN == request->req_type) {
|
|
|
|
rc = ompi_grequest_invoke_query(request, &request->req_status);
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
if( request->req_state == OMPI_REQUEST_INACTIVE ) {
|
|
|
|
rc = ompi_status_empty.MPI_ERROR;
|
|
|
|
} else {
|
2011-02-25 23:51:16 +03:00
|
|
|
rc = request->req_status.MPI_ERROR;
|
2006-01-20 20:17:13 +03:00
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
if( request->req_persistent ) {
|
|
|
|
request->req_state = OMPI_REQUEST_INACTIVE;
|
2006-12-09 17:20:08 +03:00
|
|
|
} else if (MPI_SUCCESS == rc) {
|
|
|
|
/* Only free the request if there is no error on it */
|
2011-02-25 23:51:16 +03:00
|
|
|
int tmp = ompi_request_free(rptr);
|
2012-03-21 21:46:15 +04:00
|
|
|
if (OMPI_SUCCESS == mpi_error && OMPI_SUCCESS != tmp) {
|
2006-12-09 17:20:08 +03:00
|
|
|
mpi_error = tmp;
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
2012-03-21 21:46:15 +04:00
|
|
|
/*
|
|
|
|
* Per MPI 2.2 p34:
|
|
|
|
* "It is possible for an MPI function to return MPI_ERR_IN_STATUS
|
|
|
|
* even when MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE has been
|
|
|
|
* passed to that function."
|
|
|
|
* So we should do so here as well.
|
|
|
|
*/
|
|
|
|
if( OMPI_SUCCESS == mpi_error && rc != OMPI_SUCCESS) {
|
|
|
|
mpi_error = MPI_ERR_IN_STATUS;
|
2006-03-16 01:53:41 +03:00
|
|
|
}
|
2011-02-25 23:51:16 +03:00
|
|
|
}
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
return mpi_error;
|
2004-10-12 19:50:01 +04:00
|
|
|
}
|
2004-10-12 22:01:39 +04:00
|
|
|
|
2006-07-25 19:29:37 +04:00
|
|
|
|
2007-12-06 12:23:44 +03:00
|
|
|
int ompi_request_default_wait_some(
|
2006-07-25 19:29:37 +04:00
|
|
|
size_t count,
|
|
|
|
ompi_request_t ** requests,
|
|
|
|
int * outcount,
|
|
|
|
int * indices,
|
|
|
|
ompi_status_public_t * statuses)
|
|
|
|
{
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2006-07-25 19:29:37 +04:00
|
|
|
int c;
|
|
|
|
#endif
|
|
|
|
size_t i, num_requests_null_inactive=0, num_requests_done=0;
|
2006-12-09 17:20:08 +03:00
|
|
|
int rc = MPI_SUCCESS;
|
2006-07-25 19:29:37 +04:00
|
|
|
ompi_request_t **rptr=NULL;
|
|
|
|
ompi_request_t *request=NULL;
|
|
|
|
|
|
|
|
*outcount = 0;
|
|
|
|
for (i = 0; i < count; i++){
|
|
|
|
indices[i] = 0;
|
|
|
|
}
|
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2006-07-25 19:29:37 +04:00
|
|
|
/* poll for completion */
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,1);
|
2006-07-25 19:29:37 +04:00
|
|
|
for (c = 0; c < opal_progress_spin_count; c++) {
|
|
|
|
rptr = requests;
|
|
|
|
num_requests_null_inactive = 0;
|
|
|
|
num_requests_done = 0;
|
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
|
|
|
request = *rptr;
|
|
|
|
/*
|
|
|
|
* Check for null or completed persistent request.
|
|
|
|
* For MPI_REQUEST_NULL, the req_state is always OMPI_REQUEST_INACTIVE
|
|
|
|
*/
|
|
|
|
if (request->req_state == OMPI_REQUEST_INACTIVE ) {
|
|
|
|
num_requests_null_inactive++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (true == request->req_complete) {
|
|
|
|
indices[i] = 1;
|
|
|
|
num_requests_done++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (num_requests_null_inactive == count ||
|
|
|
|
num_requests_done > 0) {
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
|
2006-07-25 19:29:37 +04:00
|
|
|
goto finished;
|
|
|
|
}
|
|
|
|
opal_progress();
|
|
|
|
}
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
|
2006-07-25 19:29:37 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We only get here when outcount still is 0.
|
|
|
|
* give up and sleep until completion
|
|
|
|
*/
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
ompi_request_waiting++;
|
|
|
|
do {
|
|
|
|
rptr = requests;
|
|
|
|
num_requests_null_inactive = 0;
|
|
|
|
num_requests_done = 0;
|
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
|
|
|
request = *rptr;
|
|
|
|
/*
|
|
|
|
* Check for null or completed persistent request.
|
|
|
|
* For MPI_REQUEST_NULL, the req_state is always OMPI_REQUEST_INACTIVE.
|
|
|
|
*/
|
|
|
|
if( request->req_state == OMPI_REQUEST_INACTIVE ) {
|
|
|
|
num_requests_null_inactive++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (request->req_complete == true) {
|
|
|
|
indices[i] = 1;
|
|
|
|
num_requests_done++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (num_requests_null_inactive == count ||
|
|
|
|
num_requests_done > 0)
|
|
|
|
break;
|
|
|
|
opal_condition_wait(&ompi_request_cond, &ompi_request_lock);
|
|
|
|
} while (1);
|
|
|
|
ompi_request_waiting--;
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
2006-07-25 19:29:37 +04:00
|
|
|
finished:
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
|
2006-07-25 19:29:37 +04:00
|
|
|
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
if( opal_cr_is_enabled) {
|
|
|
|
rptr = requests;
|
|
|
|
for (i = 0; i < count; i++, rptr++) {
|
|
|
|
request = *rptr;
|
|
|
|
if( true == request->req_complete) {
|
|
|
|
OMPI_CRCP_REQUEST_COMPLETE(request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-07-25 19:29:37 +04:00
|
|
|
if(num_requests_null_inactive == count) {
|
|
|
|
*outcount = MPI_UNDEFINED;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Compress the index array.
|
|
|
|
*/
|
|
|
|
for (i = 0, num_requests_done = 0; i < count; i++) {
|
|
|
|
if (0 != indices[i]) {
|
|
|
|
indices[num_requests_done++] = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*outcount = num_requests_done;
|
|
|
|
|
|
|
|
for (i = 0; i < num_requests_done; i++) {
|
|
|
|
request = requests[indices[i]];
|
|
|
|
assert( true == request->req_complete );
|
|
|
|
/* return status */
|
2006-11-02 06:34:53 +03:00
|
|
|
/* Per note above, we have to call gen request query_fn even
|
|
|
|
if STATUS_IGNORE was provided */
|
|
|
|
if (OMPI_REQUEST_GEN == request->req_type) {
|
|
|
|
ompi_grequest_invoke_query(request, &request->req_status);
|
|
|
|
}
|
2006-07-25 19:29:37 +04:00
|
|
|
if (MPI_STATUSES_IGNORE != statuses) {
|
2010-08-04 23:36:40 +04:00
|
|
|
OMPI_STATUS_SET(&statuses[i], &request->req_status);
|
2006-07-25 19:29:37 +04:00
|
|
|
}
|
|
|
|
|
2006-12-09 17:20:08 +03:00
|
|
|
if (MPI_SUCCESS != request->req_status.MPI_ERROR) {
|
|
|
|
rc = MPI_ERR_IN_STATUS;
|
|
|
|
}
|
2006-07-25 19:29:37 +04:00
|
|
|
|
|
|
|
if( request->req_persistent ) {
|
|
|
|
request->req_state = OMPI_REQUEST_INACTIVE;
|
|
|
|
} else {
|
2006-12-09 17:20:08 +03:00
|
|
|
/* Only free the request if there was no error */
|
|
|
|
if (MPI_SUCCESS == request->req_status.MPI_ERROR) {
|
|
|
|
int tmp;
|
|
|
|
tmp = ompi_request_free(&(requests[indices[i]]));
|
|
|
|
if (OMPI_SUCCESS != tmp) {
|
|
|
|
return tmp;
|
|
|
|
}
|
2006-07-25 19:29:37 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|