Add the datatype checks to the pack/unpack functions.
The datatype must satisfy the same constraints as for the corresponding communication function (send for pack and recv for unpack).
Этот коммит содержится в:
родитель
1ff2a38b46
Коммит
221e6e2eab
@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
@ -45,7 +45,7 @@ static const char FUNC_NAME[] = "MPI_Pack";
|
||||
int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
|
||||
void *outbuf, int outsize, int *position, MPI_Comm comm)
|
||||
{
|
||||
int rc;
|
||||
int rc = MPI_SUCCESS;
|
||||
opal_convertor_t local_convertor;
|
||||
struct iovec invec;
|
||||
unsigned int iov_count;
|
||||
@ -67,9 +67,11 @@ int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME);
|
||||
} else if (outsize < 0) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
|
||||
}
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(rc, datatype, incount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||
OMPI_CHECK_USER_BUFFER(rc, inbuf, datatype, incount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
@ -46,7 +46,7 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount,
|
||||
MPI_Datatype datatype, void *outbuf,
|
||||
MPI_Aint outsize, MPI_Aint *position)
|
||||
{
|
||||
int rc;
|
||||
int rc = MPI_SUCCESS;
|
||||
opal_convertor_t local_convertor;
|
||||
struct iovec invec;
|
||||
unsigned int iov_count;
|
||||
@ -65,9 +65,11 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME);
|
||||
} else if (outsize < 0) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
|
||||
}
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(rc, datatype, incount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
OMPI_CHECK_USER_BUFFER(rc, inbuf, datatype, incount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
@ -43,7 +43,7 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
|
||||
void *outbuf, int outcount, MPI_Datatype datatype,
|
||||
MPI_Comm comm)
|
||||
{
|
||||
int rc = 1;
|
||||
int rc = MPI_SUCCESS;
|
||||
opal_convertor_t local_convertor;
|
||||
struct iovec outvec;
|
||||
unsigned int iov_count;
|
||||
@ -70,9 +70,10 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME);
|
||||
}
|
||||
|
||||
if (MPI_DATATYPE_NULL == datatype || NULL == datatype) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
|
||||
}
|
||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, datatype, outcount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||
OMPI_CHECK_USER_BUFFER(rc, outbuf, datatype, outcount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
@ -103,12 +104,11 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
|
||||
|
||||
/* All done. Note that the convertor returns 1 upon success, not
|
||||
OMPI_SUCCESS. */
|
||||
|
||||
rc = (1 == rc) ? OMPI_SUCCESS : OMPI_ERROR;
|
||||
}
|
||||
|
||||
OPAL_CR_EXIT_LIBRARY();
|
||||
|
||||
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
|
||||
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
@ -45,7 +45,7 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz
|
||||
MPI_Aint *position, void *outbuf, int outcount,
|
||||
MPI_Datatype datatype)
|
||||
{
|
||||
int rc;
|
||||
int rc = MPI_SUCCESS;
|
||||
opal_convertor_t local_convertor;
|
||||
struct iovec outvec;
|
||||
unsigned int iov_count;
|
||||
@ -62,9 +62,11 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else if (outcount < 0) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
|
||||
}
|
||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, datatype, outcount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
OMPI_CHECK_USER_BUFFER(rc, outbuf, datatype, outcount);
|
||||
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
@ -73,7 +75,9 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz
|
||||
|
||||
/* the resulting convertor will be set to the position ZERO */
|
||||
opal_convertor_copy_and_prepare_for_recv( ompi_mpi_external32_convertor,
|
||||
&(datatype->super), outcount, outbuf, 0, &local_convertor );
|
||||
&(datatype->super), outcount, outbuf,
|
||||
0,
|
||||
&local_convertor );
|
||||
|
||||
/* Check for truncation */
|
||||
opal_convertor_get_packed_size( &local_convertor, &size );
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user