diff --git a/src/mpi/c/attr_delete.c b/src/mpi/c/attr_delete.c index 368a03a662..ae81c1a64d 100644 --- a/src/mpi/c/attr_delete.c +++ b/src/mpi/c/attr_delete.c @@ -7,12 +7,23 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Attr_delete = PMPI_Attr_delete #endif -int MPI_Attr_delete(MPI_Comm comm, int keyval){ - return MPI_SUCCESS; +int MPI_Attr_delete(MPI_Comm comm, int keyval) +{ + int ret; + + if (MPI_COMM_NULL == comm) + return MPI_ERR_COMM; + + ret = lam_attr_delete(COMM_ATTR, comm, keyval, 0); + + /* Error hanndling code here */ + + return ret; } diff --git a/src/mpi/c/attr_get.c b/src/mpi/c/attr_get.c index 7683d5c309..0eb545a737 100644 --- a/src/mpi/c/attr_get.c +++ b/src/mpi/c/attr_get.c @@ -7,12 +7,20 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Attr_get = PMPI_Attr_get #endif -int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) { - return MPI_SUCCESS; +int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) +{ + int ret; + if ((NULL == attribute_val) || (NULL == flag)) + return MPI_ERR_ARG; + + ret = lam_attr_get(COMM_ATTR, comm, keyval, attribute_val, flag); + + return ret; } diff --git a/src/mpi/c/attr_put.c b/src/mpi/c/attr_put.c index e55130b387..45c47ca6e5 100644 --- a/src/mpi/c/attr_put.c +++ b/src/mpi/c/attr_put.c @@ -7,12 +7,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Attr_put = PMPI_Attr_put #endif -int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) { - return MPI_SUCCESS; +int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) +{ + int ret; + if (MPI_COMM_NULL == comm) + return MPI_ERR_COMM; + + ret = lam_attr_set(COMM_ATTR, comm, keyval, attribute_val, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/comm_create_keyval.c b/src/mpi/c/comm_create_keyval.c index 7d1b4ec08b..6bc59e488f 100644 --- a/src/mpi/c/comm_create_keyval.c +++ b/src/mpi/c/comm_create_keyval.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Create_keyval = PMPI_Create_keyval @@ -13,6 +14,19 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn, MPI_Comm_delete_attr_function *comm_delete_attr_fn, - int *comm_keyval, void *extra_state) { - return MPI_SUCCESS; + int *comm_keyval, void *extra_state) +{ + int ret; + + if ((NULL == comm_copy_attr_fn) || (NULL == comm_delete_attr_fn) || + (NULL == comm_keyval)) + return MPI_ERR_ARG; + + ret = lam_attr_create_keyval(COMM_ATTR, (void *)comm_copy_attr_fn, + (void *)comm_delete_attr_fn, + comm_keyval, extra_state, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/comm_delete_attr.c b/src/mpi/c/comm_delete_attr.c index 30ef18cde2..b371388441 100644 --- a/src/mpi/c/comm_delete_attr.c +++ b/src/mpi/c/comm_delete_attr.c @@ -6,11 +6,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Comm_delete_attr = PMPI_Comm_delete_attr #endif -int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval) { - return MPI_SUCCESS; +int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval) +{ + int ret; + + if (MPI_COMM_NULL == comm) + return MPI_ERR_COMM; + + ret = lam_attr_delete(COMM_ATTR, comm, comm_keyval, 0); + + /* Error hanndling code here */ + + return ret; } diff --git a/src/mpi/c/comm_free_keyval.c b/src/mpi/c/comm_free_keyval.c index e40277b17f..7c20e54732 100644 --- a/src/mpi/c/comm_free_keyval.c +++ b/src/mpi/c/comm_free_keyval.c @@ -6,11 +6,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Comm_free_keyval = PMPI_Comm_free_keyval #endif -int MPI_Comm_free_keyval(int *comm_keyval) { - return MPI_SUCCESS; +int MPI_Comm_free_keyval(int *comm_keyval) +{ + int ret; + + /* Check for valid key pointer */ + + if (NULL == comm_keyval) + return MPI_ERR_ARG; + + ret = lam_attr_free_keyval(COMM_ATTR, comm_keyval, 0); + + return ret; } diff --git a/src/mpi/c/comm_get_attr.c b/src/mpi/c/comm_get_attr.c index 36a65f9af3..c44c541f40 100644 --- a/src/mpi/c/comm_get_attr.c +++ b/src/mpi/c/comm_get_attr.c @@ -6,12 +6,21 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Comm_get_attr = PMPI_Comm_get_attr #endif int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, - void *attribute_val, int *flag) { - return MPI_SUCCESS; + void *attribute_val, int *flag) +{ + int ret; + if ((NULL == attribute_val) || (NULL == flag)) + return MPI_ERR_ARG; + + ret = lam_attr_get(COMM_ATTR, comm, comm_keyval, + attribute_val, flag); + + return ret; } diff --git a/src/mpi/c/comm_set_attribute.c b/src/mpi/c/comm_set_attribute.c index 9b103e1d61..c208f7d50a 100644 --- a/src/mpi/c/comm_set_attribute.c +++ b/src/mpi/c/comm_set_attribute.c @@ -6,11 +6,21 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Comm_set_attribute = PMPI_Comm_set_attribute #endif -int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val) { - return MPI_SUCCESS; +int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val) +{ + int ret; + if (MPI_COMM_NULL == comm) + return MPI_ERR_COMM; + + ret = lam_attr_set(COMM_ATTR, comm, comm_keyval, attribute_val, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/keyval_create.c b/src/mpi/c/keyval_create.c index 43d087d01c..e8301a038f 100644 --- a/src/mpi/c/keyval_create.c +++ b/src/mpi/c/keyval_create.c @@ -6,13 +6,28 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Keyval_create = PMPI_Keyval_create #endif -int MPI_Keyval_create(MPI_Copy_function *copy_fn, - MPI_Delete_function *delete_fn, - int *keyval, void *extra_state) { - return MPI_SUCCESS; +int MPI_Keyval_create(MPI_Copy_function *copy_attr_fn, + MPI_Delete_function *delete_attr_fn, + int *keyval, void *extra_state) +{ + int ret; + + if ((NULL == copy_attr_fn) || (NULL == delete_attr_fn) || + (NULL == keyval)) + return MPI_ERR_ARG; + + ret = lam_attr_create_keyval(COMM_ATTR, (void *)copy_attr_fn, + (void *)delete_attr_fn, + keyval, extra_state, 0); + + /* Error handling code here */ + + return ret; + } diff --git a/src/mpi/c/keyval_free.c b/src/mpi/c/keyval_free.c index 47405e1975..d5b2b425c5 100644 --- a/src/mpi/c/keyval_free.c +++ b/src/mpi/c/keyval_free.c @@ -6,11 +6,23 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Keyval_free = PMPI_Keyval_free #endif -int MPI_Keyval_free(int *keyval) { - return MPI_SUCCESS; +int MPI_Keyval_free(int *keyval) +{ + int ret; + + /* Check for valid key pointer */ + + if (NULL == keyval) + return MPI_ERR_ARG; + + ret = lam_attr_free_keyval(COMM_ATTR, keyval, 0); + + return ret; + } diff --git a/src/mpi/c/type_create_keyval.c b/src/mpi/c/type_create_keyval.c index 481aac8144..3980834928 100644 --- a/src/mpi/c/type_create_keyval.c +++ b/src/mpi/c/type_create_keyval.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Type_create_keyval = PMPI_Type_create_keyval @@ -17,7 +18,19 @@ MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn, int *type_keyval, void *extra_state) { - return MPI_SUCCESS; + int ret; + + if ((NULL == type_copy_attr_fn) || (NULL == type_delete_attr_fn) || + (NULL == type_keyval)) + return MPI_ERR_ARG; + + ret = lam_attr_create_keyval(TYPE_ATTR, (void *)type_copy_attr_fn, + (void *)type_delete_attr_fn, + type_keyval, extra_state, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/type_delete_attr.c b/src/mpi/c/type_delete_attr.c index bf0fd78e69..089bbc6d8e 100644 --- a/src/mpi/c/type_delete_attr.c +++ b/src/mpi/c/type_delete_attr.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Type_delete_attr = PMPI_Type_delete_attr @@ -14,5 +15,14 @@ int MPI_Type_delete_attr (MPI_Datatype type, int type_keyval) { - return MPI_SUCCESS; + int ret; + + if (MPI_DATATYPE_NULL == type) + return MPI_ERR_TYPE; + + ret = lam_attr_delete(TYPE_ATTR, type, type_keyval, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/type_free_keyval.c b/src/mpi/c/type_free_keyval.c index 194d80a86d..054a6a40ff 100644 --- a/src/mpi/c/type_free_keyval.c +++ b/src/mpi/c/type_free_keyval.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Type_free_keyval = PMPI_Type_free_keyval @@ -14,5 +15,14 @@ int MPI_Type_free_keyval(int *type_keyval) { - return MPI_SUCCESS; + int ret; + + /* Check for valid key pointer */ + + if (NULL == type_keyval) + return MPI_ERR_ARG; + + ret = lam_attr_free_keyval(TYPE_ATTR, type_keyval, 0); + + return ret; } diff --git a/src/mpi/c/type_get_attr.c b/src/mpi/c/type_get_attr.c index c2e3bf92d4..b398505f25 100644 --- a/src/mpi/c/type_get_attr.c +++ b/src/mpi/c/type_get_attr.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Type_get_attr = PMPI_Type_get_attr @@ -17,5 +18,13 @@ MPI_Type_get_attr (MPI_Datatype type, void *attribute_val, int *flag) { - return MPI_SUCCESS; + int ret; + + if ((NULL == attribute_val) || (NULL == flag)) + return MPI_ERR_ARG; + + ret = lam_attr_get(TYPE_ATTR, type, type_keyval, + attribute_val, flag); + + return ret; } diff --git a/src/mpi/c/type_set_attr.c b/src/mpi/c/type_set_attr.c index 4bd2f6575d..82f05d31c9 100644 --- a/src/mpi/c/type_set_attr.c +++ b/src/mpi/c/type_set_attr.c @@ -6,9 +6,10 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES -#pragma weak MPI_Type_set_attr = PMPI_Type_set_attr +#pragma weak MPI_Type_get_attr = PMPI_Type_get_attr #endif int @@ -16,5 +17,14 @@ MPI_Type_set_attr (MPI_Datatype type, int type_keyval, void *attribute_val) { - return MPI_SUCCESS; + int ret; + + if (MPI_DATATYPE_NULL == type) + return MPI_ERR_TYPE; + + ret = lam_attr_set(TYPE_ATTR, type, type_keyval, attribute_val, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/win_create_keyval.c b/src/mpi/c/win_create_keyval.c index c845b6dcbb..bd0b36d2a4 100644 --- a/src/mpi/c/win_create_keyval.c +++ b/src/mpi/c/win_create_keyval.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Win_create_keyval = PMPI_Win_create_keyval @@ -14,5 +15,18 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn, MPI_Win_delete_attr_function *win_delete_attr_fn, int *win_keyval, void *extra_state) { - return MPI_SUCCESS; + + int ret; + + if ((NULL == win_copy_attr_fn) || (NULL == win_delete_attr_fn) || + (NULL == win_keyval)) + return MPI_ERR_ARG; + + ret = lam_attr_create_keyval(WIN_ATTR, (void *)win_copy_attr_fn, + (void *)win_delete_attr_fn, + win_keyval, extra_state, 0); + + /* Error handling code here */ + + return ret; } diff --git a/src/mpi/c/win_delete_attr.c b/src/mpi/c/win_delete_attr.c index a864ca2bdf..800f169af1 100644 --- a/src/mpi/c/win_delete_attr.c +++ b/src/mpi/c/win_delete_attr.c @@ -6,11 +6,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Win_delete_attr = PMPI_Win_delete_attr #endif -int MPI_Win_delete_attr(MPI_Win win, int win_keyval) { - return MPI_SUCCESS; +int MPI_Win_delete_attr(MPI_Win win, int win_keyval) +{ + int ret; + + if (MPI_WIN_NULL == win) + return MPI_ERR_WIN; + + ret = lam_attr_delete(WIN_ATTR, win, win_keyval, 0); + + /* Error hanndling code here */ + + return ret; } diff --git a/src/mpi/c/win_free_keyval.c b/src/mpi/c/win_free_keyval.c index 9e8181ec29..624ddd18c7 100644 --- a/src/mpi/c/win_free_keyval.c +++ b/src/mpi/c/win_free_keyval.c @@ -6,11 +6,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_free_keyval = PMPI_free_keyval #endif int MPI_Win_free_keyval(int *win_keyval) { - return MPI_SUCCESS; + + int ret; + + /* Check for valid key pointer */ + + if (NULL == win_keyval) + return MPI_ERR_ARG; + + ret = lam_attr_free_keyval(WIN_ATTR, win_keyval, 0); + + return ret; } diff --git a/src/mpi/c/win_get_attr.c b/src/mpi/c/win_get_attr.c index 017b6a1c4b..42945e783c 100644 --- a/src/mpi/c/win_get_attr.c +++ b/src/mpi/c/win_get_attr.c @@ -6,6 +6,7 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Win_get_attr = PMPI_Win_get_attr @@ -13,5 +14,14 @@ int MPI_Win_get_attr(MPI_Win win, int win_keyval, void *attribute_val, int *flag) { - return MPI_SUCCESS; + int ret; + + if ((NULL == attribute_val) || (NULL == flag)) + + return MPI_ERR_ARG; + + ret = lam_attr_get(WIN_ATTR, win, win_keyval, + attribute_val, flag); + + return ret; } diff --git a/src/mpi/c/win_set_attr.c b/src/mpi/c/win_set_attr.c index 07d0dcda91..ecaf362a6d 100644 --- a/src/mpi/c/win_set_attr.c +++ b/src/mpi/c/win_set_attr.c @@ -6,11 +6,22 @@ #include "mpi.h" #include "mpi/c/bindings.h" +#include "attribute/attribute.h" #if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES #pragma weak MPI_Win_set_attr = PMPI_Win_set_attr #endif int MPI_Win_set_attr(MPI_Win win, int win_keyval, void *attribute_val) { - return MPI_SUCCESS; + + int ret; + + if (MPI_WIN_NULL == win) + return MPI_ERR_WIN; + + ret = lam_attr_set(WIN_ATTR, win, win_keyval, attribute_val, 0); + + /* Error handling here */ + + return ret; }