1
1

- Fix final check in TYPE_CREATE_F90_INTEGER

- Add more checks on the params to ensure that the user conformed to
  MPI-2 (i.e., can have MPI_UNDEFINED for p *or* r in the real/complex
  functions, but not both)
- Always return MPI_ERR_ARG, not MPI_ERR_OTHER -- seems to make a
  little more sense here, since any errors that are returned are
  solely because of the arguments that were passed into the function

This commit was SVN r9037.
Этот коммит содержится в:
Jeff Squyres 2006-02-14 18:01:44 +00:00
родитель 8062277bae
Коммит c674c165fd
3 изменённых файлов: 22 добавлений и 16 удалений

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

@ -37,15 +37,15 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( 0 > p ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if( 0 > r ) {
if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r) ||
(p < 0 && MPI_UNDEFINED != p) ||
(r < 0 && MPI_UNDEFINED != r)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}
}
/* if the user does not care about p or r set them to 0 so the test associate with them will
* always succeed.
/* if the user does not care about p or r set them to 0 so the
* test associate with them will always succeed.
*/
if( MPI_UNDEFINED == p ) p = 0;
if( MPI_UNDEFINED == r ) r = 0;
@ -55,8 +55,9 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_dblcplex;
else *newtype = &ompi_mpi_cplex;
if( *newtype != &ompi_mpi_datatype_null )
if( *newtype != &ompi_mpi_datatype_null ) {
return MPI_SUCCESS;
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}

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

@ -36,6 +36,9 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (r < 0) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}
}
if (r > 38) *newtype = &ompi_mpi_datatype_null;
@ -57,8 +60,9 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype)
else if (r > 2) *newtype = &ompi_mpi_short;
else *newtype = &ompi_mpi_byte;
if( *newtype == &ompi_mpi_datatype_null )
if( *newtype != &ompi_mpi_datatype_null ) {
return MPI_SUCCESS;
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}

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

@ -38,15 +38,15 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( 0 > p ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if( 0 > r ) {
if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r) ||
(p < 0 && MPI_UNDEFINED != p) ||
(r < 0 && MPI_UNDEFINED != r)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}
}
/* if the user does not care about p or r set them to 0 so the test associate with them will
* always succeed.
/* if the user does not care about p or r set them to 0 so the
* test associate with them will always succeed.
*/
if( MPI_UNDEFINED == p ) p = 0;
if( MPI_UNDEFINED == r ) r = 0;
@ -56,8 +56,9 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_double;
else *newtype = &ompi_mpi_float;
if( *newtype != &ompi_mpi_datatype_null )
if( *newtype != &ompi_mpi_datatype_null ) {
return MPI_SUCCESS;
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}