diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c index e2d2ab3d77..5453ea19f9 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c @@ -4,6 +4,7 @@ * Copyright (c) 2010 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -5178,7 +5179,7 @@ static int coord_request_wait( ompi_request_t * req, status->MPI_TAG = req->req_status.MPI_TAG; status->MPI_SOURCE = req->req_status.MPI_SOURCE; status->_cancelled = req->req_status._cancelled; - status->_ucount = req->req_status._ucount; + OMPI_STATUS_SET_COUNT(&status->_ucount, &req->req_status._ucount); } return OMPI_SUCCESS; diff --git a/ompi/mca/mtl/mx/mtl_mx_probe.c b/ompi/mca/mtl/mx/mtl_mx_probe.c index 5353233528..93105d5ea4 100644 --- a/ompi/mca/mtl/mx/mtl_mx_probe.c +++ b/ompi/mca/mtl/mx/mtl_mx_probe.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * * Additional copyrights may follow * @@ -61,7 +62,7 @@ ompi_mtl_mx_iprobe(struct mca_mtl_base_module_t* mtl, if(MPI_STATUS_IGNORE != status) { MX_GET_SRC(mx_status.match_info, status->MPI_SOURCE); MX_GET_TAG(mx_status.match_info, status->MPI_TAG); - status->_ucount = mx_status.msg_length; + OMPI_STATUS_SET_COUNT(&status->_ucount, &mx_status.msg_length); } *flag = 1; } else { diff --git a/ompi/mca/pml/bfo/pml_bfo_iprobe.c b/ompi/mca/pml/bfo/pml_bfo_iprobe.c index 70a931927e..58738952a1 100644 --- a/ompi/mca/pml/bfo/pml_bfo_iprobe.c +++ b/ompi/mca/pml/bfo/pml_bfo_iprobe.c @@ -39,7 +39,7 @@ int mca_pml_bfo_iprobe(int src, if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) { if( NULL != status ) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } *matched = 1; } else { @@ -68,7 +68,7 @@ int mca_pml_bfo_probe(int src, ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi); if (NULL != status) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); return OMPI_SUCCESS; diff --git a/ompi/mca/pml/bfo/pml_bfo_irecv.c b/ompi/mca/pml/bfo/pml_bfo_irecv.c index 62bdf78794..cd461078c3 100644 --- a/ompi/mca/pml/bfo/pml_bfo_irecv.c +++ b/ompi/mca/pml/bfo/pml_bfo_irecv.c @@ -105,7 +105,7 @@ int mca_pml_bfo_recv(void *addr, ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq->req_recv.req_base.req_ompi.req_status); } rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; ompi_request_free( (ompi_request_t**)&recvreq ); diff --git a/ompi/mca/pml/cm/pml_cm_recv.c b/ompi/mca/pml/cm/pml_cm_recv.c index 9f5813f430..9907755d60 100644 --- a/ompi/mca/pml/cm/pml_cm_recv.c +++ b/ompi/mca/pml/cm/pml_cm_recv.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -114,7 +115,7 @@ mca_pml_cm_recv(void *addr, ompi_request_wait_completion(&recvreq->req_base.req_ompi); if (NULL != status) { /* return status */ - *status = recvreq->req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq->req_base.req_ompi.req_status); } ret = recvreq->req_base.req_ompi.req_status.MPI_ERROR; ompi_request_free( (ompi_request_t**)&recvreq ); diff --git a/ompi/mca/pml/csum/pml_csum_iprobe.c b/ompi/mca/pml/csum/pml_csum_iprobe.c index 0ad995a103..f8d004200f 100644 --- a/ompi/mca/pml/csum/pml_csum_iprobe.c +++ b/ompi/mca/pml/csum/pml_csum_iprobe.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +39,7 @@ int mca_pml_csum_iprobe(int src, if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) { if( NULL != status ) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } *matched = 1; } else { @@ -68,7 +68,7 @@ int mca_pml_csum_probe(int src, ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi); if (NULL != status) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); return OMPI_SUCCESS; diff --git a/ompi/mca/pml/csum/pml_csum_irecv.c b/ompi/mca/pml/csum/pml_csum_irecv.c index 417da9053f..89b5e0a61f 100644 --- a/ompi/mca/pml/csum/pml_csum_irecv.c +++ b/ompi/mca/pml/csum/pml_csum_irecv.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -104,7 +105,7 @@ int mca_pml_csum_recv(void *addr, ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq->req_recv.req_base.req_ompi.req_status); } rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; ompi_request_free( (ompi_request_t**)&recvreq ); diff --git a/ompi/mca/pml/dr/pml_dr_iprobe.c b/ompi/mca/pml/dr/pml_dr_iprobe.c index 019b592962..26017a1342 100644 --- a/ompi/mca/pml/dr/pml_dr_iprobe.c +++ b/ompi/mca/pml/dr/pml_dr_iprobe.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +39,7 @@ int mca_pml_dr_iprobe(int src, if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) { if( NULL != status ) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } *matched = 1; } else { @@ -68,7 +68,7 @@ int mca_pml_dr_probe(int src, ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi); if (NULL != status) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); return OMPI_SUCCESS; diff --git a/ompi/mca/pml/dr/pml_dr_irecv.c b/ompi/mca/pml/dr/pml_dr_irecv.c index 8dd8c57f4c..78f734aa3c 100644 --- a/ompi/mca/pml/dr/pml_dr_irecv.c +++ b/ompi/mca/pml/dr/pml_dr_irecv.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -90,7 +91,7 @@ int mca_pml_dr_recv(void *addr, ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq->req_recv.req_base.req_ompi.req_status); } rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; ompi_request_free( (ompi_request_t**)&recvreq ); diff --git a/ompi/mca/pml/ob1/pml_ob1_iprobe.c b/ompi/mca/pml/ob1/pml_ob1_iprobe.c index b2f1d69613..3bf0e27632 100644 --- a/ompi/mca/pml/ob1/pml_ob1_iprobe.c +++ b/ompi/mca/pml/ob1/pml_ob1_iprobe.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +39,7 @@ int mca_pml_ob1_iprobe(int src, if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) { if( NULL != status ) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } *matched = 1; } else { @@ -68,7 +68,7 @@ int mca_pml_ob1_probe(int src, ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi); if (NULL != status) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq.req_recv.req_base.req_ompi.req_status); } MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); return OMPI_SUCCESS; diff --git a/ompi/mca/pml/ob1/pml_ob1_irecv.c b/ompi/mca/pml/ob1/pml_ob1_irecv.c index 4dc164b875..0da307f755 100644 --- a/ompi/mca/pml/ob1/pml_ob1_irecv.c +++ b/ompi/mca/pml/ob1/pml_ob1_irecv.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -104,7 +105,7 @@ int mca_pml_ob1_recv(void *addr, ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; + OMPI_STATUS_SET(status, &recvreq->req_recv.req_base.req_ompi.req_status); } rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; ompi_request_free( (ompi_request_t**)&recvreq ); diff --git a/ompi/mpi/c/sendrecv_replace.c b/ompi/mpi/c/sendrecv_replace.c index f0500676fc..a828892dba 100644 --- a/ompi/mpi/c/sendrecv_replace.c +++ b/ompi/mpi/c/sendrecv_replace.c @@ -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) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -126,7 +127,7 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, /* return status to user */ if(status != MPI_STATUS_IGNORE) { - *status = recv_status; + OMPI_STATUS_SET(status, &recv_status); } /* release resources */ diff --git a/ompi/request/req_test.c b/ompi/request/req_test.c index 8601b16b74..408cd1102c 100644 --- a/ompi/request/req_test.c +++ b/ompi/request/req_test.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +40,7 @@ int ompi_request_default_test( ompi_request_t ** rptr, if( request->req_state == OMPI_REQUEST_INACTIVE ) { *completed = true; if (MPI_STATUS_IGNORE != status) { - *status = ompi_status_empty; + OMPI_STATUS_SET(status, &ompi_status_empty); } return OMPI_SUCCESS; } @@ -54,14 +55,14 @@ int ompi_request_default_test( ompi_request_t ** rptr, ompi_grequest_invoke_query(request, &request->req_status); if (MPI_STATUS_IGNORE != status) { int old_error = status->MPI_ERROR; - *status = request->req_status; + OMPI_STATUS_SET(status, &request->req_status); status->MPI_ERROR = old_error; } } else if (MPI_STATUS_IGNORE != status) { /* Do *NOT* set a new value for status->MPI_ERROR here! See MPI-1.1 doc, sec 3.2.5, p.22 */ int old_error = status->MPI_ERROR; - *status = request->req_status; + OMPI_STATUS_SET(status, &request->req_status); status->MPI_ERROR = old_error; } if( request->req_persistent ) { @@ -129,14 +130,14 @@ int ompi_request_default_test_any( /* Do *NOT* set a new value for status->MPI_ERROR here! See MPI-1.1 doc, sec 3.2.5, p.22 */ int old_error = status->MPI_ERROR; - *status = request->req_status; + OMPI_STATUS_SET(status, &request->req_status); status->MPI_ERROR = old_error; } } else if (MPI_STATUS_IGNORE != status) { /* Do *NOT* set a new value for status->MPI_ERROR here! See MPI-1.1 doc, sec 3.2.5, p.22 */ int old_error = status->MPI_ERROR; - *status = request->req_status; + OMPI_STATUS_SET(status, &request->req_status); status->MPI_ERROR = old_error; } @@ -165,7 +166,7 @@ int ompi_request_default_test_any( } else { *completed = true; if (MPI_STATUS_IGNORE != status) { - *status = ompi_status_empty; + OMPI_STATUS_SET(status, &ompi_status_empty); } } return OMPI_SUCCESS; @@ -217,13 +218,13 @@ int ompi_request_default_test_all( * Works also in the case of persistent request w/ MPI_PROC_NULL. */ if( request->req_state == OMPI_REQUEST_INACTIVE ) { - statuses[i] = request->req_status; + OMPI_STATUS_SET(&statuses[i], &request->req_status); continue; } if (OMPI_REQUEST_GEN == request->req_type) { ompi_grequest_invoke_query(request, &request->req_status); } - statuses[i] = request->req_status; + OMPI_STATUS_SET(&statuses[i], &request->req_status); if( request->req_persistent ) { request->req_state = OMPI_REQUEST_INACTIVE; continue; @@ -324,7 +325,7 @@ int ompi_request_default_test_some( if (OMPI_REQUEST_GEN == request->req_type) { ompi_grequest_invoke_query(request, &request->req_status); } - statuses[i] = request->req_status; + OMPI_STATUS_SET(&statuses[i], &request->req_status); } if (MPI_SUCCESS != request->req_status.MPI_ERROR) { diff --git a/ompi/request/req_wait.c b/ompi/request/req_wait.c index e48b74ef02..44134a80d8 100644 --- a/ompi/request/req_wait.c +++ b/ompi/request/req_wait.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,7 +52,7 @@ int ompi_request_default_wait( 3.2.5, p.22 */ status->MPI_TAG = req->req_status.MPI_TAG; status->MPI_SOURCE = req->req_status.MPI_SOURCE; - status->_ucount = req->req_status._ucount; + OMPI_STATUS_SET_COUNT(&status->_ucount, &req->req_status._ucount); status->_cancelled = req->req_status._cancelled; } if( req->req_persistent ) { @@ -164,7 +165,7 @@ finished: if(num_requests_null_inactive == count) { *index = MPI_UNDEFINED; if (MPI_STATUS_IGNORE != status) { - *status = ompi_status_empty; + OMPI_STATUS_SET(status, &ompi_status_empty); } } else { assert( true == request->req_complete ); @@ -177,7 +178,7 @@ finished: /* Do *NOT* set status->MPI_ERROR here! See MPI-1.1 doc, sec 3.2.5, p.22 */ int old_error = status->MPI_ERROR; - *status = request->req_status; + OMPI_STATUS_SET(status, &request->req_status); status->MPI_ERROR = old_error; } rc = request->req_status.MPI_ERROR; @@ -298,7 +299,7 @@ int ompi_request_default_wait_all( size_t count, ompi_grequest_invoke_query(request, &request->req_status); } - statuses[i] = request->req_status; + OMPI_STATUS_SET(&statuses[i], &request->req_status); if( request->req_persistent ) { request->req_state = OMPI_REQUEST_INACTIVE; @@ -478,7 +479,7 @@ finished: ompi_grequest_invoke_query(request, &request->req_status); } if (MPI_STATUSES_IGNORE != statuses) { - statuses[i] = request->req_status; + OMPI_STATUS_SET(&statuses[i], &request->req_status); } if (MPI_SUCCESS != request->req_status.MPI_ERROR) { diff --git a/ompi/request/request.h b/ompi/request/request.h index cea3e38058..50fa97e69f 100644 --- a/ompi/request/request.h +++ b/ompi/request/request.h @@ -11,7 +11,7 @@ * 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) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -406,6 +406,34 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa return OMPI_SUCCESS; } +/* In a 64-bit library with strict alignment requirements (like 64-bit + * SPARC), the _ucount field of a C status is a long and requires 8 + * byte alignment. Unfortunately a Fortran status is an array of 6 + * integers which only requires 4 byte alignment. When storing the + * length into a status we don't know whether it is a C or Fortran + * status. Therefore, we just copy the entire status as an integer + * array to avoid any issues. We supply one macro for doing the entire + * status and another for just the _ucount field. As this is only an + * issue for 64-bit SPARC, we conditionalize the macros accordingly. + */ +#if defined(__sparc) && SIZEOF_SIZE_T == 8 +#define OMPI_STATUS_SET(outstat, instat) \ + do { \ + int _i; \ + for(_i=0; _i<(int)(sizeof(ompi_status_public_t)/sizeof(int)); _i++) { \ + ((int *)(outstat))[_i] = ((int *)(instat))[_i]; \ + } \ + } while(0) +#define OMPI_STATUS_SET_COUNT(outcount, incount) \ + do { \ + ((int *)(outcount))[0] = ((int *)(incount))[0]; \ + ((int *)(outcount))[1] = ((int *)(incount))[1]; \ + } while(0) +#else +#define OMPI_STATUS_SET(outstat, instat) (*(outstat) = *(instat)) +#define OMPI_STATUS_SET_COUNT(outcount, incount) (*(outcount) = *(incount)) +#endif + END_C_DECLS #endif