From 77184b5c4cc7d98ca1239ee6166a9102836c5508 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 11 Jul 2014 04:37:01 +0000 Subject: [PATCH] Fix a cornercase with MPI_PROC_NULL persistent requests Handle OMPI_REQUEST_NOOP in MPI_Startall rather than PML cmr=v1.8.2:reviewer=bosilca:ticket=4764 This commit was SVN r32213. The following Trac tickets were found above: Ticket 4764 --> https://svn.open-mpi.org/trac/ompi/ticket/4764 --- ompi/mca/pml/bfo/pml_bfo_start.c | 16 ---------------- ompi/mca/pml/cm/pml_cm_start.c | 20 ++------------------ ompi/mca/pml/ob1/pml_ob1_start.c | 16 ---------------- ompi/mpi/c/start.c | 15 ++++++++++++--- ompi/mpi/c/startall.c | 17 ++++++++++++++++- 5 files changed, 30 insertions(+), 54 deletions(-) diff --git a/ompi/mca/pml/bfo/pml_bfo_start.c b/ompi/mca/pml/bfo/pml_bfo_start.c index ed6b4897a6..f9c166d6a4 100644 --- a/ompi/mca/pml/bfo/pml_bfo_start.c +++ b/ompi/mca/pml/bfo/pml_bfo_start.c @@ -11,8 +11,6 @@ * All rights reserved. * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,20 +37,6 @@ int mca_pml_bfo_start(size_t count, ompi_request_t** requests) if(NULL == pml_request) { continue; } - if (OMPI_REQUEST_NOOP == requests[i]->req_type) { - /** - * We deal with a MPI_PROC_NULL request. If the request is - * already active, return OMPI_ERR_REQUEST err. - * Otherwise, mark it active so we can correctly handle it in - * the wait*. - */ - if( OMPI_REQUEST_INACTIVE == requests[i]->req_state ) { - requests[i]->req_state = OMPI_REQUEST_ACTIVE; - continue; - } else { - return OMPI_ERR_REQUEST; - } - } if (OMPI_REQUEST_PML != requests[i]->req_type) { continue; } diff --git a/ompi/mca/pml/cm/pml_cm_start.c b/ompi/mca/pml/cm/pml_cm_start.c index 85094de420..b86891043d 100644 --- a/ompi/mca/pml/cm/pml_cm_start.c +++ b/ompi/mca/pml/cm/pml_cm_start.c @@ -10,8 +10,6 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,24 +36,10 @@ mca_pml_cm_start(size_t count, ompi_request_t** requests) for (i = 0 ; i < count ; i++) { mca_pml_cm_request_t *pml_request = (mca_pml_cm_request_t*)requests[i]; - if (NULL == pml_request) { + if (OMPI_REQUEST_PML != requests[i]->req_type) { continue; } - if (OMPI_REQUEST_NOOP == requests[i]->req_type) { - /** - * We deal with a MPI_PROC_NULL request. If the request is - * already active, return OMPI_ERR_REQUEST err. - * Otherwise, mark it active so we can correctly handle it in - * the wait*. - */ - if( OMPI_REQUEST_INACTIVE == requests[i]->req_state ) { - requests[i]->req_state = OMPI_REQUEST_ACTIVE; - continue; - } else { - return OMPI_ERR_REQUEST; - } - } - if (OMPI_REQUEST_PML != requests[i]->req_type) { + if (NULL == pml_request) { continue; } /* If the persistent request is currebtly active - obtain the diff --git a/ompi/mca/pml/ob1/pml_ob1_start.c b/ompi/mca/pml/ob1/pml_ob1_start.c index adc6f920fa..2203a6b545 100644 --- a/ompi/mca/pml/ob1/pml_ob1_start.c +++ b/ompi/mca/pml/ob1/pml_ob1_start.c @@ -11,8 +11,6 @@ * All rights reserved. * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,20 +37,6 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests) if(NULL == pml_request) { continue; } - if (OMPI_REQUEST_NOOP == requests[i]->req_type) { - /** - * We deal with a MPI_PROC_NULL request. If the request is - * already active, return OMPI_ERR_REQUEST err. - * Otherwise, mark it active so we can correctly handle it in - * the wait*. - */ - if( OMPI_REQUEST_INACTIVE == requests[i]->req_state ) { - requests[i]->req_state = OMPI_REQUEST_ACTIVE; - continue; - } else { - return OMPI_ERR_REQUEST; - } - } if (OMPI_REQUEST_PML != requests[i]->req_type) { continue; } diff --git a/ompi/mpi/c/start.c b/ompi/mpi/c/start.c index 391505a95d..34040d12ae 100644 --- a/ompi/mpi/c/start.c +++ b/ompi/mpi/c/start.c @@ -10,8 +10,6 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -67,7 +65,6 @@ int MPI_Start(MPI_Request *request) switch((*request)->req_type) { case OMPI_REQUEST_PML: - case OMPI_REQUEST_NOOP: OPAL_CR_ENTER_LIBRARY(); ret = MCA_PML_CALL(start(1, request)); @@ -75,6 +72,18 @@ int MPI_Start(MPI_Request *request) OPAL_CR_EXIT_LIBRARY(); return ret; + case OMPI_REQUEST_NOOP: + /** + * We deal with a MPI_PROC_NULL request. If the request is + * already active, fall back to the error case in the default. + * Otherwise, mark it active so we can correctly handle it in + * the wait*. + */ + if( OMPI_REQUEST_INACTIVE == (*request)->req_state ) { + (*request)->req_state = OMPI_REQUEST_ACTIVE; + return MPI_SUCCESS; + } + default: return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST, FUNC_NAME); } diff --git a/ompi/mpi/c/startall.c b/ompi/mpi/c/startall.c index bf48e6e63b..7193ae0785 100644 --- a/ompi/mpi/c/startall.c +++ b/ompi/mpi/c/startall.c @@ -12,6 +12,8 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2014 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,6 +44,7 @@ static const char FUNC_NAME[] = "MPI_Startall"; int MPI_Startall(int count, MPI_Request requests[]) { + int i; int ret = OMPI_SUCCESS; MEMCHECKER( @@ -52,7 +55,6 @@ int MPI_Startall(int count, MPI_Request requests[]) ); if ( MPI_PARAM_CHECK ) { - int i; int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (NULL == requests) { @@ -74,6 +76,19 @@ int MPI_Startall(int count, MPI_Request requests[]) OPAL_CR_ENTER_LIBRARY(); + for (i = 0; i < count; ++i) { + if (OMPI_REQUEST_NOOP == requests[i]->req_type) { + /** + * We deal with a MPI_PROC_NULL request. If the request is + * already active, fall back to the error case in the default. + * Otherwise, mark it active so we can correctly handle it in + * the wait*. + */ + if( OMPI_REQUEST_INACTIVE == requests[i]->req_state ) { + requests[i]->req_state = OMPI_REQUEST_ACTIVE; + } + } + } ret = MCA_PML_CALL(start(count, requests)); OPAL_CR_EXIT_LIBRARY();