Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update init
authordegomme <augustin.degomme@unibas.ch>
Sat, 11 Feb 2017 20:35:34 +0000 (21:35 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Sun, 12 Feb 2017 01:08:28 +0000 (02:08 +0100)
teshsuite/smpi/mpich3-test/init/attrself.c
teshsuite/smpi/mpich3-test/init/exitst1.c
teshsuite/smpi/mpich3-test/init/exitst2.c
teshsuite/smpi/mpich3-test/init/exitst3.c
teshsuite/smpi/mpich3-test/init/finalized.c
teshsuite/smpi/mpich3-test/init/initstat.c
teshsuite/smpi/mpich3-test/init/timeout.c
teshsuite/smpi/mpich3-test/init/version.c

index 2339805..027a413 100644 (file)
@@ -13,126 +13,129 @@ static char MTestDescrip[] = "Test creating and inserting attributes in \
 different orders to ensure that the list management code handles all cases.";
 */
 
-int checkAttrs( MPI_Comm, int, int [], int [] );
-int delete_fn( MPI_Comm, int, void *, void *);
+int checkAttrs(MPI_Comm, int, int[], int[]);
+int delete_fn(MPI_Comm, int, void *, void *);
 
 #define NKEYS 5
-static int key[NKEYS];      /* Keys in creation order */
-static int keyorder[NKEYS]; /* Index (into key) of keys in order added to comm 
-                           (key[keyorder[0]] is first set) */
+static int key[NKEYS];          /* Keys in creation order */
+static int keyorder[NKEYS];     /* Index (into key) of keys in order added to comm
+                                 * (key[keyorder[0]] is first set) */
 static int nkeys = 0;
 static int ncall = 0;
-static int errs  = 0;
-/* 
- * Test that attributes on comm self are deleted in LIFO order 
+static int errs = 0;
+/*
+ * Test that attributes on comm self are deleted in LIFO order
  */
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
-    int      attrval[10];
-    int      wrank, i;
+    int attrval[10];
+    int wrank, i;
     MPI_Comm comm;
 
-    MPI_Init( &argc, &argv );
+    MPI_Init(&argc, &argv);
 
-    MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
+    MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
 
     comm = MPI_COMM_SELF;
-    
+
     /* Create key values */
-    for (nkeys=0; nkeys<NKEYS; nkeys++) {
-       MPI_Comm_create_keyval( MPI_NULL_COPY_FN, delete_fn,
-                               &key[nkeys], (void *)0 );
-       attrval[nkeys] = 1024 * nkeys;
+    for (nkeys = 0; nkeys < NKEYS; nkeys++) {
+        MPI_Comm_create_keyval(MPI_NULL_COPY_FN, delete_fn, &key[nkeys], (void *) 0);
+        attrval[nkeys] = 1024 * nkeys;
     }
-    
+
     /* Insert attribute in several orders.  Test after put with get,
-       then delete, then confirm delete with get. */
-    
-    MPI_Comm_set_attr( comm, key[3], &attrval[3] ); keyorder[0] = 3;
-    MPI_Comm_set_attr( comm, key[2], &attrval[2] ); keyorder[1] = 2;
-    MPI_Comm_set_attr( comm, key[0], &attrval[0] ); keyorder[2] = 0;
-    MPI_Comm_set_attr( comm, key[1], &attrval[1] ); keyorder[3] = 1;
-    MPI_Comm_set_attr( comm, key[4], &attrval[4] ); keyorder[4] = 4;
-    
-    errs += checkAttrs( comm, NKEYS, key, attrval );
-    
-    for (i=0; i<NKEYS; i++) {
-       /* Save the key value so that we can compare it in the 
-          delete function */
-       int keyval = key[i];
-       MPI_Comm_free_keyval( &keyval );
+     * then delete, then confirm delete with get. */
+
+    MPI_Comm_set_attr(comm, key[3], &attrval[3]);
+    keyorder[0] = 3;
+    MPI_Comm_set_attr(comm, key[2], &attrval[2]);
+    keyorder[1] = 2;
+    MPI_Comm_set_attr(comm, key[0], &attrval[0]);
+    keyorder[2] = 0;
+    MPI_Comm_set_attr(comm, key[1], &attrval[1]);
+    keyorder[3] = 1;
+    MPI_Comm_set_attr(comm, key[4], &attrval[4]);
+    keyorder[4] = 4;
+
+    errs += checkAttrs(comm, NKEYS, key, attrval);
+
+    for (i = 0; i < NKEYS; i++) {
+        /* Save the key value so that we can compare it in the
+         * delete function */
+        int keyval = key[i];
+        MPI_Comm_free_keyval(&keyval);
     }
-       
+
     MPI_Finalize();
-    
+
     if (wrank == 0) {
-       if (ncall != nkeys) {
-           printf( "Deleted %d keys but should have deleted %d\n", 
-                   ncall, nkeys );
-           errs++;
-       }
-       if (errs == 0) printf( " No Errors\n" );
-       else printf( " Found %d errors\n", errs );
+        if (ncall != nkeys) {
+            printf("Deleted %d keys but should have deleted %d\n", ncall, nkeys);
+            errs++;
+        }
+        if (errs == 0)
+            printf(" No Errors\n");
+        else
+            printf(" Found %d errors\n", errs);
     }
     return 0;
-  
+
 }
 
-int checkAttrs( MPI_Comm comm, int n, int lkey[], int attrval[] )
+int checkAttrs(MPI_Comm comm, int n, int lkey[], int attrval[])
 {
     int lerrs = 0;
     int i, flag, *val_p;
 
-    for (i=0; i<n; i++) {
-       MPI_Comm_get_attr( comm, lkey[i], &val_p, &flag );
-       if (!flag) {
-           lerrs++;
-           fprintf( stderr, "Attribute for key %d not set\n", i );
-       }
-       else if (val_p != &attrval[i]) {
-           lerrs++;
-           fprintf( stderr, "Attribute value for key %d not correct\n",
-                    i );
-       }
+    for (i = 0; i < n; i++) {
+        MPI_Comm_get_attr(comm, lkey[i], &val_p, &flag);
+        if (!flag) {
+            lerrs++;
+            fprintf(stderr, "Attribute for key %d not set\n", i);
+        }
+        else if (val_p != &attrval[i]) {
+            lerrs++;
+            fprintf(stderr, "Atribute value for key %d not correct\n", i);
+        }
     }
 
     return lerrs;
 }
 
 /* We *should* be deleting key[keyorder[nkeys-ncall]] */
-int delete_fn( MPI_Comm comm, int keyval, void *attribute_val, 
-              void *extra_state)
+int delete_fn(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state)
 {
     if (ncall >= nkeys) {
-       printf( "delete function called too many times!\n" );
-       errs++;
+        printf("delete function called too many times!\n");
+        errs++;
     }
 
-    /* As of MPI 2.2, the order of deletion of attributes on 
-       MPI_COMM_SELF is defined */
+    /* As of MPI 2.2, the order of deletion of attributes on
+     * MPI_COMM_SELF is defined */
     if (MPI_VERSION > 2 || (MPI_VERSION == 2 && MPI_SUBVERSION >= 2)) {
-       if (keyval != key[keyorder[nkeys-1-ncall]]) {
-           printf( "Expected key # %d but found key with value %d\n", 
-                   keyorder[nkeys-1-ncall], keyval );
-           errs++;
-       }
+        if (keyval != key[keyorder[nkeys - 1 - ncall]]) {
+            printf("Expected key # %d but found key with value %d\n",
+                   keyorder[nkeys - 1 - ncall], keyval);
+            errs++;
+        }
     }
     ncall++;
     return MPI_SUCCESS;
 }
 
 /*
-int checkNoAttrs( MPI_Comm comm, int n, int lkey[] )
+int checkNoAttrs(MPI_Comm comm, int n, int lkey[])
 {
     int lerrs = 0;
     int i, flag, *val_p;
 
     for (i=0; i<n; i++) {
-       MPI_Comm_get_attr( comm, lkey[i], &val_p, &flag );
+       MPI_Comm_get_attr(comm, lkey[i], &val_p, &flag);
        if (flag) {
            lerrs++;
-           fprintf( stderr, "Attribute for key %d set but should be deleted\n", i );
+           fprintf(stderr, "Attribute for key %d set but should be deleted\n", i);
        }
     }
 
index f01c6f9..85279f2 100644 (file)
@@ -5,13 +5,13 @@
  */
 #include "mpi.h"
 
-/* 
- * This is a special test to check that mpiexec handles zero/non-zero 
+/*
+ * This is a special test to check that mpiexec handles zero/non-zero
  * return status from an application
  */
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
-    MPI_Init( &argc, &argv );
-    MPI_Finalize( );
+    MPI_Init(&argc, &argv);
+    MPI_Finalize();
     return 1;
 }
index d1b878a..524fc52 100644 (file)
@@ -5,16 +5,16 @@
  */
 #include "mpi.h"
 
-/* 
- * This is a special test to check that mpiexec handles zero/non-zero 
- * return status from an application.  In this case, each process 
+/*
+ * This is a special test to check that mpiexec handles zero/non-zero
+ * return status from an application.  In this case, each process
  * returns a different return status
  */
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int rank;
-    MPI_Init( &argc, &argv );
-    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-    MPI_Finalize( );
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Finalize();
     return rank;
 }
index 3accbe4..33d7d78 100644 (file)
@@ -5,22 +5,22 @@
  */
 #include "mpi.h"
 
-/* 
+/*
  * This is a special test to check that mpiexec handles the death of
  * some processes without an Abort or clean exit
  */
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int rank, size;
-    MPI_Init( &argc, &argv );
-    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-    MPI_Comm_size( MPI_COMM_WORLD, &size );
-    MPI_Barrier( MPI_COMM_WORLD );
-    if (rank == size-1) {
-       /* Cause some processes to exit */
-       int *p =0 ;
-       *p = rank;
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+    MPI_Barrier(MPI_COMM_WORLD);
+    if (rank == size - 1) {
+        /* Cause some processes to exit */
+        int *p = 0;
+        *p = rank;
     }
-    MPI_Finalize( );
+    MPI_Finalize();
     return 0;
 }
index 32ac134..79acd8b 100644 (file)
@@ -9,13 +9,13 @@
 /* FIXME: This test program assumes that MPI_Error_string will work even
    if MPI is not initialized.  That is not guaranteed.  */
 
-/* Normally, when checking for error returns from MPI calls, you must ensure 
+/* Normally, when checking for error returns from MPI calls, you must ensure
    that the error handler on the relevant object (communicator, file, or
-   window) has been set to MPI_ERRORS_RETURN.  The tests in this 
+   window) has been set to MPI_ERRORS_RETURN.  The tests in this
    program are a special case, as either a failure or an abort will
    indicate a problem */
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int error;
     int flag;
@@ -25,92 +25,81 @@ int main( int argc, char *argv[] )
 
     flag = 0;
     error = MPI_Finalized(&flag);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Finalized failed: %s\n", err_string);
-       fflush(stdout);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Finalized failed: %s\n", err_string);
+        fflush(stdout);
+        return error;
     }
-    if (flag)
-    {
-       printf("MPI_Finalized returned true before MPI_Init.\n");
-       return -1;
+    if (flag) {
+        printf("MPI_Finalized returned true before MPI_Init.\n");
+        return -1;
     }
 
     error = MPI_Init(&argc, &argv);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Init failed: %s\n", err_string);
-       fflush(stdout);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Init failed: %s\n", err_string);
+        fflush(stdout);
+        return error;
     }
 
     error = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Comm_rank failed: %s\n", err_string);
-       fflush(stdout);
-       MPI_Abort(MPI_COMM_WORLD, error);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Comm_rank failed: %s\n", err_string);
+        fflush(stdout);
+        MPI_Abort(MPI_COMM_WORLD, error);
+        return error;
     }
 
     flag = 0;
     error = MPI_Finalized(&flag);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Finalized failed: %s\n", err_string);
-       fflush(stdout);
-       MPI_Abort(MPI_COMM_WORLD, error);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Finalized failed: %s\n", err_string);
+        fflush(stdout);
+        MPI_Abort(MPI_COMM_WORLD, error);
+        return error;
     }
-    if (flag)
-    {
-       printf("MPI_Finalized returned true before MPI_Finalize.\n");
-       fflush(stdout);
-       MPI_Abort(MPI_COMM_WORLD, error);
-       return -1;
+    if (flag) {
+        printf("MPI_Finalized returned true before MPI_Finalize.\n");
+        fflush(stdout);
+        MPI_Abort(MPI_COMM_WORLD, error);
+        return -1;
     }
 
     error = MPI_Barrier(MPI_COMM_WORLD);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Barrier failed: %s\n", err_string);
-       fflush(stdout);
-       MPI_Abort(MPI_COMM_WORLD, error);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Barrier failed: %s\n", err_string);
+        fflush(stdout);
+        MPI_Abort(MPI_COMM_WORLD, error);
+        return error;
     }
 
     error = MPI_Finalize();
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Finalize failed: %s\n", err_string);
-       fflush(stdout);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Finalize failed: %s\n", err_string);
+        fflush(stdout);
+        return error;
     }
 
     flag = 0;
     error = MPI_Finalized(&flag);
-    if (error != MPI_SUCCESS)
-    {
-       MPI_Error_string(error, err_string, &length);
-       printf("MPI_Finalized failed: %s\n", err_string);
-       fflush(stdout);
-       return error;
+    if (error != MPI_SUCCESS) {
+        MPI_Error_string(error, err_string, &length);
+        printf("MPI_Finalized failed: %s\n", err_string);
+        fflush(stdout);
+        return error;
     }
-    if (!flag)
-    {
-       printf("MPI_Finalized returned false after MPI_Finalize.\n");
-       return -1;
+    if (!flag) {
+        printf("MPI_Finalized returned false after MPI_Finalize.\n");
+        return -1;
     }
-    if (rank == 0)
-    {
-       printf(" No Errors\n");
+    if (rank == 0) {
+        printf(" No Errors\n");
     }
-    return 0;  
+    return 0;
 }
index f3d42e1..198ba22 100644 (file)
@@ -8,29 +8,28 @@
 #include <stdio.h>
 #include "mpitest.h"
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     int provided, flag, claimed;
 
-    /* MTest_Init( &argc, &argv ); */
+    /* MTest_Init(&argc, &argv); */
 
-    MPI_Init_thread( &argc, &argv, MPI_THREAD_MULTIPLE, &provided );
-    
-    MPI_Is_thread_main( &flag );
+    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
+
+    MPI_Is_thread_main(&flag);
     if (!flag) {
-       errs++;
-       printf( "This thread called init_thread but Is_thread_main gave false\n" );
+        errs++;
+        printf("This thread called init_thread but Is_thread_main gave false\n");
     }
-    MPI_Query_thread( &claimed );
+    MPI_Query_thread(&claimed);
     if (claimed != provided) {
-       errs++;
-       printf( "Query thread gave thread level %d but Init_thread gave %d\n",
-               claimed, provided );
+        errs++;
+        printf("Query thread gave thread level %d but Init_thread gave %d\n", claimed, provided);
     }
 
-    MTest_Finalize( errs );
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }
index 912619f..316eb50 100644 (file)
@@ -7,14 +7,14 @@
 
 /* This is a program that tests the ability of mpiexec to timeout a process
    after no more than 3 minutes.  By default, it will run for 5 minutes */
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     double t1;
     double deltaTime = 300;
 
-    MPI_Init( &argc, &argv );
+    MPI_Init(0, 0);
     t1 = MPI_Wtime();
-    while (MPI_Wtime() - t1 < deltaTime) ;
-    MPI_Finalize( );
+    while (MPI_Wtime() - t1 < deltaTime);
+    MPI_Finalize();
     return 0;
 }
index 40c5895..46044d0 100644 (file)
@@ -8,27 +8,25 @@
 #include <stdio.h>
 #include "mpitest.h"
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     int majversion, subversion;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    MPI_Get_version( &majversion, &subversion );
+    MPI_Get_version(&majversion, &subversion);
     if (majversion != MPI_VERSION) {
-       errs++;
-       printf( "Major version is %d but is %d in the mpi.h file\n", 
-               majversion, MPI_VERSION );
+        errs++;
+        printf("Major version is %d but is %d in the mpi.h file\n", majversion, MPI_VERSION);
     }
     if (subversion != MPI_SUBVERSION) {
-       errs++;
-       printf( "Minor version is %d but is %d in the mpi.h file\n", 
-               subversion, MPI_SUBVERSION );
+        errs++;
+        printf("Minor version is %d but is %d in the mpi.h file\n", subversion, MPI_SUBVERSION);
     }
-    
-    MTest_Finalize( errs );
+
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }