diff --git a/src/mpi/c/attr_fn.c b/src/mpi/c/attr_fn.c index 0c2311d328..ef24d93c47 100644 --- a/src/mpi/c/attr_fn.c +++ b/src/mpi/c/attr_fn.c @@ -10,71 +10,100 @@ #include "communicator/communicator.h" #include "win/win.h" -int MPI_TYPE_NULL_DELETE_FN( MPI_Datatype datatype, int type_keyval, - void* attribute_val_out, - void* flag ) +/* + * Note that these are the back-end functions for MPI_DUP_FN (and + * friends). They have an OMPI_C_* prefix because of weird reasons + * listed in a lengthy comment in mpi.h. + * + * Specifically: + * + * MPI_NULL_DELETE_FN -> OMPI_C_MPI_NULL_DELETE_FN + * MPI_NULL_COPY_FN -> OMPI_C_MPI_NULL_COPY_FN + * MPI_DUP_FN -> OMPI_C_MPI_DUP_FN + * + * MPI_TYPE_NULL_DELETE_FN -> OMPI_C_MPI_TYPE_NULL_DELETE_FN + * MPI_TYPE_NULL_COPY_FN -> OMPI_C_MPI_TYPE_NULL_COPY_FN + * MPI_TYPE_DUP_FN -> OMPI_C_MPI_TYPE_DUP_FN + * + * MPI_COMM_NULL_DELETE_FN -> OMPI_C_MPI_COMM_NULL_DELETE_FN + * MPI_COMM_NULL_COPY_FN -> OMPI_C_MPI_COMM_NULL_COPY_FN + * MPI_COMM_DUP_FN -> OMPI_C_MPI_COMM_DUP_FN + * + * MPI_WIN_NULL_DELETE_FN -> OMPI_C_MPI_WIN_NULL_DELETE_FN + * MPI_WIN_NULL_COPY_FN -> OMPI_C_MPI_WIN_NULL_COPY_FN + * MPI_WIN_DUP_FN -> OMPI_C_MPI_WIN_DUP_FN + */ + +int OMPI_C_MPI_TYPE_NULL_DELETE_FN( MPI_Datatype datatype, int type_keyval, + void* attribute_val_out, + void* flag ) { /* Why not all MPI functions are like this ?? */ return MPI_SUCCESS; } -int MPI_TYPE_NULL_COPY_FN( MPI_Datatype datatype, int type_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) +int OMPI_C_MPI_TYPE_NULL_COPY_FN( MPI_Datatype datatype, int type_keyval, + void* extra_state, + void* attribute_val_in, + void* attribute_val_out, + int* flag ) { *flag = 0; return MPI_SUCCESS; } -int MPI_TYPE_DUP_FN( MPI_Datatype datatype, int type_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) +int OMPI_C_MPI_TYPE_DUP_FN( MPI_Datatype datatype, int type_keyval, + void* extra_state, + void* attribute_val_in, void* attribute_val_out, + int* flag ) { *flag = 1; *(void**)attribute_val_out = attribute_val_in; return MPI_SUCCESS; } -int MPI_WIN_NULL_DELETE_FN( MPI_Win window, int win_keyval, - void* attribute_val_out, - void* flag ) +int OMPI_C_MPI_WIN_NULL_DELETE_FN( MPI_Win window, int win_keyval, + void* attribute_val_out, + void* flag ) { return MPI_SUCCESS; } -int MPI_WIN_NULL_COPY_FN( MPI_Win window, int win_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) +int OMPI_C_MPI_WIN_NULL_COPY_FN( MPI_Win window, int win_keyval, + void* extra_state, + void* attribute_val_in, + void* attribute_val_out, int* flag ) { *flag= 0; return MPI_SUCCESS; } -int MPI_WIN_DUP_FN( MPI_Win window, int win_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) -{ - *flag = 1; - *(void**)attribute_val_out = attribute_val_in; - return MPI_SUCCESS; -} - -int MPI_COMM_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, - void* attribute_val_out, - void* flag ) -{ - return MPI_SUCCESS; -} - -int MPI_COMM_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, void* extra_state, +int OMPI_C_MPI_WIN_DUP_FN( MPI_Win window, int win_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, int* flag ) +{ + *flag = 1; + *(void**)attribute_val_out = attribute_val_in; + return MPI_SUCCESS; +} + +int OMPI_C_MPI_COMM_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, + void* attribute_val_out, + void* flag ) +{ + return MPI_SUCCESS; +} + +int OMPI_C_MPI_COMM_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, + void* extra_state, + void* attribute_val_in, + void* attribute_val_out, int* flag ) { *flag= 0; return MPI_SUCCESS; } -int MPI_COMM_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, +int OMPI_C_MPI_COMM_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, int* flag ) { @@ -83,24 +112,24 @@ int MPI_COMM_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, return MPI_SUCCESS; } -int MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, - void* attribute_val_out, - void* flag ) +int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, + void* attribute_val_out, + void* flag ) { return MPI_SUCCESS; } -int MPI_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) +int OMPI_C_MPI_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, void* extra_state, + void* attribute_val_in, void* attribute_val_out, + int* flag ) { *flag= 0; return MPI_SUCCESS; } -int MPI_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, - void* attribute_val_in, void* attribute_val_out, - int* flag ) +int OMPI_C_MPI_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, + void* attribute_val_in, void* attribute_val_out, + int* flag ) { *flag = 1; *(void**)attribute_val_out = attribute_val_in; diff --git a/src/mpi/f77/attr_fn_f.c b/src/mpi/f77/attr_fn_f.c index f3e3cdc0f8..555e3a3905 100644 --- a/src/mpi/f77/attr_fn_f.c +++ b/src/mpi/f77/attr_fn_f.c @@ -148,6 +148,29 @@ OMPI_GENERATE_F77_BINDINGS( MPI_WIN_DUP_FN, (window, win_keyval, extra_state, attribute_val_in, attribute_val_out, flag, ierr) ) #endif +/* + * Note that in this file, we invoke OMPI_C_ rather than + * , where is MPI_DUP_FN (and all the rest). + * Specifically: + * + * MPI_NULL_DELETE_FN -> OMPI_C_MPI_NULL_DELETE_FN + * MPI_NULL_COPY_FN -> OMPI_C_MPI_NULL_COPY_FN + * MPI_DUP_FN -> OMPI_C_MPI_DUP_FN + * + * MPI_TYPE_NULL_DELETE_FN -> OMPI_C_MPI_TYPE_NULL_DELETE_FN + * MPI_TYPE_NULL_COPY_FN -> OMPI_C_MPI_TYPE_NULL_COPY_FN + * MPI_TYPE_DUP_FN -> OMPI_C_MPI_TYPE_DUP_FN + * + * MPI_COMM_NULL_DELETE_FN -> OMPI_C_MPI_COMM_NULL_DELETE_FN + * MPI_COMM_NULL_COPY_FN -> OMPI_C_MPI_COMM_NULL_COPY_FN + * MPI_COMM_DUP_FN -> OMPI_C_MPI_COMM_DUP_FN + * + * MPI_WIN_NULL_DELETE_FN -> OMPI_C_MPI_WIN_NULL_DELETE_FN + * MPI_WIN_NULL_COPY_FN -> OMPI_C_MPI_WIN_NULL_COPY_FN + * MPI_WIN_DUP_FN -> OMPI_C_MPI_WIN_DUP_FN + * + * The reason why is discussed in a lengthy comment in mpi.h. + */ void mpi_type_null_delete_fn_f( MPI_Fint* type, int* type_keyval, void* attribute_val_out, int* flag, int* ierr ) {