1
1

Created two new macros that are used when filling in either the

status structure or the _ucount field in the status structure.
On 64-bit sparc, the macros resolve into integer array assignments.
For all others, they are just simple assignments.  This fixes 
possible BUS errors seen when running on the SPARC processor.
This bug was introduced when the _count field changed from an int
into a size_t.  See the changes to request.h for additional details.

This commit fixes trac:2514.

This commit was SVN r23554.

The following Trac tickets were found above:
  Ticket 2514 --> https://svn.open-mpi.org/trac/ompi/ticket/2514
Этот коммит содержится в:
Rolf vandeVaart 2010-08-04 19:36:40 +00:00
родитель 33719634da
Коммит 0324fdb407
15 изменённых файлов: 71 добавлений и 34 удалений

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

@ -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;

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

@ -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 {

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

@ -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;

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

@ -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 );

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

@ -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 );

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

@ -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;

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

@ -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 );

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

@ -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;

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

@ -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 );

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

@ -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;

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

@ -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 );

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

@ -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 */

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

@ -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) {

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

@ -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) {

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

@ -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