X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d0ffc37686edcc803601f76ab51fdfed5fc2f241..839ca861fcbfe4230637ffc30766445cc7b4918f:/teshsuite/smpi/mpich3-test/attr/attr2type.c diff --git a/teshsuite/smpi/mpich3-test/attr/attr2type.c b/teshsuite/smpi/mpich3-test/attr/attr2type.c index 69706cf596..90e9f1f120 100644 --- a/teshsuite/smpi/mpich3-test/attr/attr2type.c +++ b/teshsuite/smpi/mpich3-test/attr/attr2type.c @@ -14,10 +14,10 @@ int foo_initialize(void); void foo_finalize(void); int foo_copy_attr_function(MPI_Datatype type, int type_keyval, - void *extra_state, void *attribute_val_in, - void *attribute_val_out, int *flag); + void *extra_state, void *attribute_val_in, + void *attribute_val_out, int *flag); int foo_delete_attr_function(MPI_Datatype type, int type_keyval, - void *attribute_val, void *extra_state); + void *attribute_val, void *extra_state); static const char *my_func = 0; static int verbose = 0; static int delete_called = 0; @@ -25,48 +25,46 @@ static int copy_called = 0; int main(int argc, char *argv[]) { - int mpi_errno; MPI_Datatype type, duptype; int rank; MPI_Init(&argc, &argv); - - MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); foo_initialize(); - mpi_errno = MPI_Type_contiguous(2, MPI_INT, &type); + MPI_Type_contiguous(2, MPI_INT, &type); - mpi_errno = MPI_Type_set_attr(type, foo_keyval, NULL); + MPI_Type_set_attr(type, foo_keyval, NULL); - mpi_errno = MPI_Type_dup(type, &duptype); + MPI_Type_dup(type, &duptype); my_func = "Free of type"; - mpi_errno = MPI_Type_free(&type); + MPI_Type_free(&type); my_func = "free of duptype"; - mpi_errno = MPI_Type_free(&duptype); + MPI_Type_free(&duptype); foo_finalize(); if (rank == 0) { - int errs = 0; - if (copy_called != 1) { - printf( "Copy called %d times; expected once\n", copy_called ); - errs++; - } - if (delete_called != 2) { - printf( "Delete called %d times; expected twice\n", delete_called ); - errs++; - } - if (errs == 0) { - printf( " No Errors\n" ); - }else if(mpi_errno!=MPI_SUCCESS){ - printf( " Output fail - Found %d errors\n", errs ); - }else { - printf( " Found %d errors\n", errs ); - } - fflush(stdout); + int errs = 0; + if (copy_called != 1) { + printf("Copy called %d times; expected once\n", copy_called); + errs++; + } + if (delete_called != 2) { + printf("Delete called %d times; expected twice\n", delete_called); + errs++; + } + if (errs == 0) { + printf(" No Errors\n"); + } + else { + printf(" Found %d errors\n", errs); + } + fflush(stdout); } MPI_Finalize(); @@ -74,53 +72,47 @@ int main(int argc, char *argv[]) } int foo_copy_attr_function(MPI_Datatype type, - int type_keyval, - void *extra_state, - void *attribute_val_in, - void *attribute_val_out, - int *flag) + int type_keyval, + void *extra_state, + void *attribute_val_in, void *attribute_val_out, int *flag) { - if (verbose) printf("copy fn. called\n"); - copy_called ++; - * (char **) attribute_val_out = NULL; + if (verbose) + printf("copy fn. called\n"); + copy_called++; + *(char **) attribute_val_out = NULL; *flag = 1; return MPI_SUCCESS; } int foo_delete_attr_function(MPI_Datatype type, - int type_keyval, - void *attribute_val, - void *extra_state) + int type_keyval, void *attribute_val, void *extra_state) { - if (verbose) printf("delete fn. called in %s\n", my_func ); - delete_called ++; + if (verbose) + printf("delete fn. called in %s\n", my_func); + delete_called++; return MPI_SUCCESS; } int foo_initialize(void) { - int mpi_errno; - /* create keyval for use later */ - mpi_errno = MPI_Type_create_keyval(foo_copy_attr_function, - foo_delete_attr_function, - &foo_keyval, - NULL); - if (mpi_errno==MPI_SUCCESS && verbose) printf("created keyval\n"); + MPI_Type_create_keyval(foo_copy_attr_function, + foo_delete_attr_function, &foo_keyval, NULL); + if (verbose) + printf("created keyval\n"); return 0; } void foo_finalize(void) { - int mpi_errno; - /* remove keyval */ - mpi_errno = MPI_Type_free_keyval(&foo_keyval); + MPI_Type_free_keyval(&foo_keyval); - if (mpi_errno==MPI_SUCCESS && verbose) printf("freed keyval\n"); + if (verbose) + printf("freed keyval\n"); return; }