After consulting with Edgar and MPI-2:4.12.4, decide the following:
- the f2c functions should return the corresponding *_NULL functions and not invoke an MPI exception if an invalid fortran handle is passed - the error check should be outside MPI_PARAM_CHECK -- MPI defines the behavior of when an invalid fortran handle is passed; it is not dependant upon whether we are checking parameters or not This commit was SVN r2140.
Этот коммит содержится в:
родитель
2ee4f0898c
Коммит
1787645a3d
@ -27,11 +27,14 @@ MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
|
||||
|
||||
if ( MPI_PARAM_CHECK ) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
}
|
||||
|
||||
if ( 0 > o_index ||
|
||||
o_index >= ompi_pointer_array_get_size(&ompi_mpi_communicators)) {
|
||||
return MPI_COMM_NULL;
|
||||
}
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if ( 0 > o_index ||
|
||||
o_index >= ompi_pointer_array_get_size(&ompi_mpi_communicators)) {
|
||||
return MPI_COMM_NULL;
|
||||
}
|
||||
|
||||
return ompi_mpi_communicators.addr[o_index];
|
||||
|
@ -22,20 +22,22 @@ static const char FUNC_NAME[] = "MPI_Errhandler_f2c";
|
||||
|
||||
MPI_Errhandler MPI_Errhandler_f2c(MPI_Fint errhandler_f)
|
||||
{
|
||||
size_t eh_index = (size_t) errhandler_f;
|
||||
size_t eh_index = (size_t) errhandler_f;
|
||||
|
||||
/* Error checking */
|
||||
/* Error checking */
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
|
||||
if (0 > eh_index ||
|
||||
eh_index >= ompi_pointer_array_get_size(ompi_errhandler_f_to_c_table)) {
|
||||
return MPI_ERRHANDLER_NULL;
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (eh_index < 0 ||
|
||||
eh_index >=
|
||||
ompi_pointer_array_get_size(ompi_errhandler_f_to_c_table)) {
|
||||
return MPI_ERRHANDLER_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return ompi_errhandler_f_to_c_table->addr[eh_index];
|
||||
return ompi_errhandler_f_to_c_table->addr[eh_index];
|
||||
}
|
||||
|
@ -27,12 +27,15 @@ MPI_File MPI_File_f2c(MPI_Fint file_f)
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (file_index < 0 ||
|
||||
file_index >= ompi_pointer_array_get_size(&ompi_file_f_to_c_table)) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, MPI_ERR_FILE,
|
||||
FUNC_NAME);
|
||||
return MPI_FILE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (file_index < 0 ||
|
||||
file_index >=
|
||||
ompi_pointer_array_get_size(&ompi_file_f_to_c_table)) {
|
||||
return MPI_FILE_NULL;
|
||||
}
|
||||
|
||||
return ompi_file_f_to_c_table.addr[file_index];
|
||||
|
@ -28,19 +28,17 @@ MPI_Group MPI_Group_f2c(MPI_Fint group_f)
|
||||
|
||||
group_index = (size_t) group_f;
|
||||
|
||||
/* error checks */
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (0 > group_index) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
FUNC_NAME);
|
||||
return MPI_GROUP_NULL;
|
||||
}
|
||||
if (group_index >= ompi_group_f_to_c_table->size) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
FUNC_NAME);
|
||||
return MPI_GROUP_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (group_index < 0 ||
|
||||
group_index >=
|
||||
ompi_pointer_array_get_size(ompi_group_f_to_c_table)) {
|
||||
return MPI_GROUP_NULL;
|
||||
}
|
||||
|
||||
group_c = ompi_group_f_to_c_table->addr[group_index];
|
||||
|
@ -36,14 +36,16 @@ MPI_Info MPI_Info_f2c(MPI_Fint info)
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (info_index < 0 ||
|
||||
info_index >= ompi_pointer_array_get_size(&ompi_info_f_to_c_table)) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO,
|
||||
FUNC_NAME);
|
||||
return MPI_INFO_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* return the index */
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (info_index < 0 ||
|
||||
info_index >=
|
||||
ompi_pointer_array_get_size(&ompi_info_f_to_c_table)) {
|
||||
return MPI_INFO_NULL;
|
||||
}
|
||||
|
||||
return ompi_info_f_to_c_table.addr[info_index];
|
||||
}
|
||||
|
@ -23,19 +23,22 @@ static const char FUNC_NAME[] = "MPI_Op_f2c";
|
||||
|
||||
MPI_Op MPI_Op_f2c(MPI_Fint op_f)
|
||||
{
|
||||
size_t o_index = (size_t) op_f;
|
||||
size_t op_index = (size_t) op_f;
|
||||
|
||||
/* Error checking */
|
||||
/* Error checking */
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (0 > o_index ||
|
||||
o_index >= ompi_pointer_array_get_size(ompi_op_f_to_c_table)) {
|
||||
return MPI_OP_NULL;
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (op_index < 0 ||
|
||||
op_index >=
|
||||
ompi_pointer_array_get_size(ompi_op_f_to_c_table)) {
|
||||
return MPI_OP_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return ompi_op_f_to_c_table->addr[o_index];
|
||||
return ompi_op_f_to_c_table->addr[op_index];
|
||||
}
|
||||
|
@ -23,26 +23,22 @@ static const char FUNC_NAME[] = "MPI_Request_f2c";
|
||||
|
||||
MPI_Request MPI_Request_f2c(MPI_Fint request)
|
||||
{
|
||||
/* local variables */
|
||||
ompi_request_t *request_c;
|
||||
size_t request_index;
|
||||
|
||||
request_index = (size_t) request;
|
||||
|
||||
/* Error checks */
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (0 > request_index) {
|
||||
(void)OMPI_ERRHANDLER_INVOKE( MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
if (request_index >= ompi_req_f_to_c_table->size) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
FUNC_NAME);
|
||||
return MPI_REQUEST_NULL;
|
||||
}
|
||||
|
||||
request_c = ompi_req_f_to_c_table->addr[request_index];
|
||||
return (MPI_Request) request_c;
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (request_index < 0 ||
|
||||
request_index >=
|
||||
ompi_pointer_array_get_size(ompi_req_f_to_c_table)) {
|
||||
return MPI_REQUEST_NULL;
|
||||
}
|
||||
|
||||
return ompi_req_f_to_c_table->addr[request_index];
|
||||
}
|
||||
|
@ -23,14 +23,21 @@ static const char FUNC_NAME[] = "MPI_Type_f2c";
|
||||
|
||||
MPI_Datatype MPI_Type_f2c(MPI_Fint datatype)
|
||||
{
|
||||
/* check the arguments */
|
||||
size_t datatype_index = (size_t) datatype;
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (0 > datatype || datatype >= ompi_pointer_array_get_size(ompi_datatype_f_to_c_table)) {
|
||||
return MPI_DATATYPE_NULL;
|
||||
}
|
||||
}
|
||||
/* return the index */
|
||||
|
||||
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
||||
invalid fortran handle */
|
||||
|
||||
if (datatype_index < 0 ||
|
||||
datatype_index >=
|
||||
ompi_pointer_array_get_size(ompi_datatype_f_to_c_table)) {
|
||||
return MPI_DATATYPE_NULL;
|
||||
}
|
||||
|
||||
return ompi_datatype_f_to_c_table->addr[datatype];
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@ MPI_Win MPI_Win_f2c(MPI_Fint win)
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
}
|
||||
|
||||
/* NOTE: Be sure to see the other *f2c functions before implementing
|
||||
this one -- they should all be the same! */
|
||||
|
||||
/* This function is not yet implemented */
|
||||
|
||||
return (MPI_Win) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user