Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This one was not ours.
[simgrid.git] / teshsuite / smpi / mpich3-test / util / mtest.c
index e922072..a13d88c 100644 (file)
@@ -7,7 +7,6 @@
 #include "mpi.h"
 #include "mpitestconf.h"
 #include "mpitest.h"
-#include "smpi_cocci.h"
 #if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
 #endif
@@ -49,13 +48,13 @@ static void MTestResourceSummary( FILE * );
 /* Here is where we could put the includes and definitions to enable
    memory testing */
 
-SMPI_VARINIT_GLOBAL_AND_SET(dbgflag, int, 0); /* Flag used for debugging */
-SMPI_VARINIT_GLOBAL_AND_SET(wrank, int, -1);  /* World rank */
-SMPI_VARINIT_GLOBAL_AND_SET(verbose, int, 0); /* Message level (0 is none) */
-SMPI_VARINIT_GLOBAL_AND_SET(returnWithVal, int, 0); /* Allow programs to return
-                                  with a non-zero if there was an error (may
-                                  cause problems with some runtime systems) */
-SMPI_VARINIT_GLOBAL_AND_SET(usageOutput, int, 0); /* */
+static int dbgflag = 0;         /* Flag used for debugging */
+static int wrank = -1;          /* World rank */
+static int verbose = 0;         /* Message level (0 is none) */
+static int returnWithVal = 0;   /* Allow programs to return with a non-zero 
+                                  if there was an error (may cause problems
+                                  with some runtime systems) */
+static int usageOutput = 0;     /* */
 
 /* Provide backward portability to MPI 1 */
 #ifndef MPI_VERSION
@@ -99,8 +98,8 @@ void MTest_Init_thread( int *argc, char ***argv, int required, int *provided )
     }
     /* Check for debugging control */
     if (getenv( "MPITEST_DEBUG" )) {
-       SMPI_VARGET_GLOBAL(dbgflag) = 1;
-       MPI_Comm_rank( MPI_COMM_WORLD, &SMPI_VARGET_GLOBAL(wrank) );
+       dbgflag = 1;
+       MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
     }
 
     /* Check for verbose control */
@@ -116,7 +115,7 @@ void MTest_Init_thread( int *argc, char ***argv, int required, int *provided )
        }
        else {
            if (val >= 0) {
-               SMPI_VARGET_GLOBAL(verbose) = val;
+               verbose = val;
            }
            else {
                fprintf( stderr, "Warning: %s not valid for MPITEST_VERBOSE\n", 
@@ -132,13 +131,13 @@ void MTest_Init_thread( int *argc, char ***argv, int required, int *provided )
            strcmp( envval, "YES" ) == 0 ||
            strcmp( envval, "true" ) == 0 ||
            strcmp( envval, "TRUE" ) == 0) {
-           SMPI_VARGET_GLOBAL(returnWithVal) = 1;
+           returnWithVal = 1;
        }
        else if (strcmp( envval, "no" ) == 0 ||
            strcmp( envval, "NO" ) == 0 ||
            strcmp( envval, "false" ) == 0 ||
            strcmp( envval, "FALSE" ) == 0) {
-           SMPI_VARGET_GLOBAL(returnWithVal) = 0;
+           returnWithVal = 0;
        }
        else {
            fprintf( stderr, 
@@ -150,7 +149,7 @@ void MTest_Init_thread( int *argc, char ***argv, int required, int *provided )
     
     /* Print rusage data if set */
     if (getenv( "MPITEST_RUSAGE" )) {
-       SMPI_VARGET_GLOBAL(usageOutput) = 1;
+       usageOutput = 1;
     }
 }
 /* 
@@ -220,7 +219,7 @@ void MTest_Finalize( int errs )
        fflush( stdout );
     }
     
-    if (SMPI_VARGET_GLOBAL(usageOutput))
+    if (usageOutput) 
        MTestResourceSummary( stdout );
 
 
@@ -233,7 +232,7 @@ void MTest_Finalize( int errs )
  */
 int MTestReturnValue( int errors )
 {
-    if (SMPI_VARGET_GLOBAL(returnWithVal)) return errors ? 1 : 0;
+    if (returnWithVal) return errors ? 1 : 0;
     return 0;
 }
 /* ------------------------------------------------------------------------ */
@@ -243,7 +242,7 @@ int MTestReturnValue( int errors )
  * from the tests.
  * MTestSleep( seconds )
  */
-#ifdef HAVE_WINDOWS_H
+#ifdef _WIN32
 #include <windows.h>
 void MTestSleep( int sec )
 {
@@ -278,7 +277,7 @@ void MTestSleep( int sec )
  *    Indexed  - Indexed datatype.  Only for a count of 1 instance of the 
  *               datatype
  */
-SMPI_VARINIT_GLOBAL_AND_SET(datatype_index, int, 0);
+static int datatype_index = 0;
 
 /* ------------------------------------------------------------------------ */
 /* Datatype routines for contiguous datatypes                               */
@@ -547,14 +546,13 @@ static void *MTestTypeIndexedInitRecv( MTestDatatype *mtype )
 
 static void *MTestTypeIndexedFree( MTestDatatype *mtype )
 {
-    if (mtype->buf) {
-       free( mtype->buf );
+    if (mtype->buf) 
+      free( mtype->buf );
        free( mtype->displs );
        free( mtype->index );
        mtype->buf    = 0;
        mtype->displs = 0;
        mtype->index  = 0;
-    }
     return 0;
 }
 
@@ -637,7 +635,7 @@ int MTestGetDatatypes( MTestDatatype *sendtype, MTestDatatype *recvtype,
     recvtype->count      = count;
     /* Use datatype_index to choose a datatype to use.  If at the end of the
        list, return 0 */
-    switch (SMPI_VARGET_GLOBAL(datatype_index)) {
+    switch (datatype_index) {
     case 0:
        sendtype->datatype = MPI_INT;
        sendtype->isBasic  = 1;
@@ -859,7 +857,7 @@ int MTestGetDatatypes( MTestDatatype *sendtype, MTestDatatype *recvtype,
        break;
 #endif
     default:
-       SMPI_VARGET_GLOBAL(datatype_index) = -1;
+       datatype_index = -1;
     }
 
     if (!sendtype->InitBuf) {
@@ -870,29 +868,29 @@ int MTestGetDatatypes( MTestDatatype *sendtype, MTestDatatype *recvtype,
        sendtype->CheckBuf = MTestTypeContigCheckbuf;
        recvtype->CheckBuf = MTestTypeContigCheckbuf;
     }
-    SMPI_VARGET_GLOBAL(datatype_index)++;
+    datatype_index++;
 
-    if (SMPI_VARGET_GLOBAL(dbgflag) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
+    if (dbgflag && datatype_index > 0) {
        int typesize;
-       fprintf( stderr, "%d: sendtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( sendtype ) );
+       fprintf( stderr, "%d: sendtype is %s\n", wrank, MTestGetDatatypeName( sendtype ) );
        merr = MPI_Type_size( sendtype->datatype, &typesize );
        if (merr) MTestPrintError( merr );
-       fprintf( stderr, "%d: sendtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
-       fprintf( stderr, "%d: recvtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( recvtype ) );
+       fprintf( stderr, "%d: sendtype size = %d\n", wrank, typesize );
+       fprintf( stderr, "%d: recvtype is %s\n", wrank, MTestGetDatatypeName( recvtype ) );
        merr = MPI_Type_size( recvtype->datatype, &typesize );
        if (merr) MTestPrintError( merr );
-       fprintf( stderr, "%d: recvtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
+       fprintf( stderr, "%d: recvtype size = %d\n", wrank, typesize );
        fflush( stderr );
        
     }
-    else if (SMPI_VARGET_GLOBAL(verbose) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
+    else if (verbose && datatype_index > 0) {
        printf( "Get new datatypes: send = %s, recv = %s\n", 
                MTestGetDatatypeName( sendtype ), 
                MTestGetDatatypeName( recvtype ) );
        fflush( stdout );
     }
 
-    return SMPI_VARGET_GLOBAL(datatype_index);
+    return datatype_index;
 }
 
 /* Reset the datatype index (start from the initial data type.
@@ -901,13 +899,13 @@ int MTestGetDatatypes( MTestDatatype *sendtype, MTestDatatype *recvtype,
 */
 void MTestResetDatatypes( void )
 {
-    SMPI_VARGET_GLOBAL(datatype_index) = 0;
+    datatype_index = 0;
 }
 /* Return the index of the current datatype.  This is rarely needed and
    is provided mostly to enable debugging of the MTest package itself */
 int MTestGetDatatypeIndex( void )
 {
-    return SMPI_VARGET_GLOBAL(datatype_index);
+    return datatype_index;
 }
 
 /* Free the storage associated with a datatype */
@@ -954,15 +952,14 @@ int MTestCheckRecv( MPI_Status *status, MTestDatatype *recvtype )
    simplify the use of the routine */
 const char *MTestGetDatatypeName( MTestDatatype *dtype )
 {
-    typedef char name_type[4][MPI_MAX_OBJECT_NAME];
-    SMPI_VARINIT_STATIC(name, name_type);
-    SMPI_VARINIT_STATIC_AND_SET(sp, int, 0);
+    static char name[4][MPI_MAX_OBJECT_NAME];
+    static int sp=0;
     int rlen, merr;
 
-    if (SMPI_VARGET_STATIC(sp) >= 4) SMPI_VARGET_STATIC(sp) = 0;
-    merr = MPI_Type_get_name( dtype->datatype, SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)], &rlen );
+    if (sp >= 4) sp = 0;
+    merr = MPI_Type_get_name( dtype->datatype, name[sp], &rlen );
     if (merr) MTestPrintError( merr );
-    return (const char *)SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)++];
+    return (const char *)name[sp++];
 }
 /* ----------------------------------------------------------------------- */
 
@@ -973,10 +970,10 @@ const char *MTestGetDatatypeName( MTestDatatype *dtype )
  * that return value as well.
  * 
  */
-SMPI_VARINIT_GLOBAL_AND_SET(interCommIdx, int, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(intraCommIdx, int, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(intraCommName, const char *, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(interCommName, const char *, 0);
+static int interCommIdx = 0;
+static int intraCommIdx = 0;
+static const char *intraCommName = 0;
+static const char *interCommName = 0;
 
 /* 
  * Get an intracommunicator with at least min_size members.  If "allowSmaller"
@@ -994,18 +991,18 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
        MPI_COMM_NULL is always considered large enough */
     while (!done) {
        isBasic = 0;
-       SMPI_VARGET_GLOBAL(intraCommName) = "";
-       switch (SMPI_VARGET_GLOBAL(intraCommIdx)) {
+       intraCommName = "";
+       switch (intraCommIdx) {
        case 0:
            *comm = MPI_COMM_WORLD;
            isBasic = 1;
-           SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_WORLD";
+           intraCommName = "MPI_COMM_WORLD";
            break;
        case 1:
            /* dup of world */
            merr = MPI_Comm_dup(MPI_COMM_WORLD, comm );
            if (merr) MTestPrintError( merr );
-           SMPI_VARGET_GLOBAL(intraCommName) = "Dup of MPI_COMM_WORLD";
+           intraCommName = "Dup of MPI_COMM_WORLD";
            break;
        case 2:
            /* reverse ranks */
@@ -1015,7 +1012,7 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
            if (merr) MTestPrintError( merr );
            merr = MPI_Comm_split( MPI_COMM_WORLD, 0, size-rank, comm );
            if (merr) MTestPrintError( merr );
-           SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of MPI_COMM_WORLD";
+           intraCommName = "Rank reverse of MPI_COMM_WORLD";
            break;
        case 3:
            /* subset of world, with reversed ranks */
@@ -1026,12 +1023,12 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
            merr = MPI_Comm_split( MPI_COMM_WORLD, ((rank < size/2) ? 1 : MPI_UNDEFINED),
                                   size-rank, comm );
            if (merr) MTestPrintError( merr );
-           SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of half of MPI_COMM_WORLD";
+           intraCommName = "Rank reverse of half of MPI_COMM_WORLD";
            break;
        case 4:
            *comm = MPI_COMM_SELF;
            isBasic = 1;
-           SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_SELF";
+           intraCommName = "MPI_COMM_SELF";
            break;
 
            /* These next cases are communicators that include some
@@ -1044,7 +1041,7 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
            int newsize;
            merr = MPI_Comm_size( MPI_COMM_WORLD, &size );
            if (merr) MTestPrintError( merr );
-           newsize = size - (SMPI_VARGET_GLOBAL(intraCommIdx) - 4);
+           newsize = size - (intraCommIdx - 4);
            
            if (allowSmaller && newsize >= min_size) {
                merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
@@ -1058,13 +1055,13 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
                    *comm = MPI_COMM_NULL;
                }
                else {
-                   SMPI_VARGET_GLOBAL(intraCommName) = "Split of WORLD";
+                   intraCommName = "Split of WORLD";
                }
            }
            else {
                /* Act like default */
                *comm = MPI_COMM_NULL;
-               SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
+               intraCommIdx = -1;
            }
        }
        break;
@@ -1072,7 +1069,7 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
            /* Other ideas: dup of self, cart comm, graph comm */
        default:
            *comm = MPI_COMM_NULL;
-           SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
+           intraCommIdx = -1;
            break;
        }
 
@@ -1083,7 +1080,7 @@ int MTestGetIntracommGeneral( MPI_Comm *comm, int min_size, int allowSmaller )
                done = 1;
        }
         else {
-            SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_NULL";
+            intraCommName = "MPI_COMM_NULL";
             isBasic = 1;
             done = 1;
         }
@@ -1094,7 +1091,7 @@ done2=done;
         /* Advance the comm index whether we are done or not, otherwise we could
          * spin forever trying to allocate a too-small communicator over and
          * over again. */
-        SMPI_VARGET_GLOBAL(intraCommIdx)++;
+        intraCommIdx++;
 
         if (!done && !isBasic && *comm != MPI_COMM_NULL) {
             /* avoid leaking communicators */
@@ -1103,7 +1100,7 @@ done2=done;
         }
     }
 
-    return SMPI_VARGET_GLOBAL(intraCommIdx);
+    return intraCommIdx;
 }
 
 /* 
@@ -1117,7 +1114,7 @@ int MTestGetIntracomm( MPI_Comm *comm, int min_size )
 /* Return the name of an intra communicator */
 const char *MTestGetIntracommName( void )
 {
-    return SMPI_VARGET_GLOBAL(intraCommName);
+    return intraCommName;
 }
 
 /* 
@@ -1138,9 +1135,9 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
     while (!done) {
         *comm = MPI_COMM_NULL;
         *isLeftGroup = 0;
-        SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
+        interCommName = "MPI_COMM_NULL";
 
-       switch (SMPI_VARGET_GLOBAL(interCommIdx)) {
+       switch (interCommIdx) {
        case 0:
            /* Split comm world in half */
            merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
@@ -1166,7 +1163,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader,
                                             12345, comm );
                if (merr) MTestPrintError( merr );
-               SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD";
+               interCommName = "Intercomm by splitting MPI_COMM_WORLD";
            }
            else 
                *comm = MPI_COMM_NULL;
@@ -1196,7 +1193,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, 
                                             rleader, 12346, comm );
                if (merr) MTestPrintError( merr );
-               SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
+               interCommName = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
            }
            else
                *comm = MPI_COMM_NULL;
@@ -1227,7 +1224,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, 
                                             rleader, 12347, comm );
                if (merr) MTestPrintError( merr );
-               SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
+               interCommName = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
            }
            else 
                *comm = MPI_COMM_NULL;
@@ -1266,7 +1263,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                mcomm = *comm;
                merr = MPI_Comm_dup(mcomm, comm);
                if (merr) MTestPrintError( merr );
-               SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
+               interCommName = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
            }
            else 
                *comm = MPI_COMM_NULL;
@@ -1308,7 +1305,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                /* this split is effectively a dup but tests the split code paths */
                merr = MPI_Comm_split(mcomm, 0, rank, comm);
                if (merr) MTestPrintError( merr );
-               SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
+               interCommName = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
            }
            else
                *comm = MPI_COMM_NULL;
@@ -1345,7 +1342,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                     merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader, 12345, comm );
                     if (merr) MTestPrintError( merr );
                 }
-                SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
+                interCommName = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
             }
             else {
                 *comm = MPI_COMM_NULL;
@@ -1398,7 +1395,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
                 merr = MPI_Group_free(&newgroup);
                 if (merr) MTestPrintError( merr );
 
-                SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
+                interCommName = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
             }
             else {
                 *comm = MPI_COMM_NULL;
@@ -1407,7 +1404,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
 
        default:
            *comm = MPI_COMM_NULL;
-           SMPI_VARGET_GLOBAL(interCommIdx) = -1;
+           interCommIdx = -1;
            break;
        }
 
@@ -1419,7 +1416,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
            if (size + remsize >= min_size) done = 1;
        }
        else {
-           SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
+           interCommName = "MPI_COMM_NULL";
            done = 1;
         }
 
@@ -1429,7 +1426,7 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
         /* Advance the comm index whether we are done or not, otherwise we could
          * spin forever trying to allocate a too-small communicator over and
          * over again. */
-        SMPI_VARGET_GLOBAL(interCommIdx)++;
+        interCommIdx++;
 
         if (!done && *comm != MPI_COMM_NULL) {
             /* avoid leaking communicators */
@@ -1448,12 +1445,12 @@ int MTestGetIntercomm( MPI_Comm *comm, int *isLeftGroup, int min_size )
         }
     }
 
-    return SMPI_VARGET_GLOBAL(interCommIdx);
+    return interCommIdx;
 }
 /* Return the name of an intercommunicator */
 const char *MTestGetIntercommName( void )
 {
-    return SMPI_VARGET_GLOBAL(interCommName);
+    return interCommName;
 }
 
 /* Get a communicator of a given minimum size.  Both intra and inter 
@@ -1461,19 +1458,19 @@ const char *MTestGetIntercommName( void )
 int MTestGetComm( MPI_Comm *comm, int min_size )
 {
     int idx=0;
-    SMPI_VARINIT_STATIC_AND_SET(getinter, int, 0);
+    static int getinter = 0;
 
-    if (!SMPI_VARGET_STATIC(getinter)) {
+    if (!getinter) {
        idx = MTestGetIntracomm( comm, min_size );
        if (idx == 0) {
-           SMPI_VARGET_STATIC(getinter) = 1;
+           getinter = 1;
        }
     }
-    if (SMPI_VARGET_STATIC(getinter)) {
+    if (getinter) {
        int isLeft;
        idx = MTestGetIntercomm( comm, &isLeft, min_size );
        if (idx == 0) {
-           SMPI_VARGET_STATIC(getinter) = 0;
+           getinter = 0;
        }
     }
 
@@ -1523,7 +1520,7 @@ void MTestPrintfMsg( int level, const char format[], ... )
 {
     va_list list;
 
-    if (SMPI_VARGET_GLOBAL(verbose) && level >= SMPI_VARGET_GLOBAL(verbose)) {
+    if (verbose && level >= verbose) {
        va_start(list,format);
        vprintf( format, list );
        va_end(list);
@@ -1543,20 +1540,20 @@ static void MTestResourceSummary( FILE *fp )
 {
 #ifdef HAVE_GETRUSAGE
     struct rusage ru;
-    SMPI_VARINIT_STATIC_AND_SET(pfThreshold, int, -2);
+    static int pfThreshold = -2;
     int doOutput = 1;
     if (getrusage( RUSAGE_SELF, &ru ) == 0) {
        /* There is an option to generate output only when a resource
           exceeds a threshold.  To date, only page faults supported. */
-       if (SMPI_VARGET_STATIC(pfThreshold) == -2) {
+       if (pfThreshold == -2) {
            char *p = getenv("MPITEST_RUSAGE_PF");
-           SMPI_VARGET_STATIC(pfThreshold) = -1;
+           pfThreshold = -1;
            if (p) {
-               SMPI_VARGET_STATIC(pfThreshold) = strtol( p, 0, 0 );
+               pfThreshold = strtol( p, 0, 0 );
            }
        }
-       if (SMPI_VARGET_STATIC(pfThreshold) > 0) {
-           doOutput = ru.ru_minflt > SMPI_VARGET_STATIC(pfThreshold);
+       if (pfThreshold > 0) {
+           doOutput = ru.ru_minflt > pfThreshold;
        }
        if (doOutput) {
            /* Cast values to long in case some system has defined them
@@ -1584,48 +1581,47 @@ static void MTestResourceSummary( FILE *fp )
 /*
  * Create MPI Windows
  */
-SMPI_VARINIT_GLOBAL_AND_SET(win_index, int, 0);
-SMPI_VARINIT_GLOBAL(winName, const char *);
+static int win_index = 0;
+static const char *winName;
 /* Use an attribute to remember the type of memory allocation (static,
    malloc, or MPI_Alloc_mem) */
-SMPI_VARINIT_GLOBAL_AND_SET(mem_keyval, int, MPI_KEYVAL_INVALID);
+static int mem_keyval = MPI_KEYVAL_INVALID;
 int MTestGetWin( MPI_Win *win, int mustBePassive )
 {
-    typedef char actbuf_type[1024];
-    SMPI_VARINIT_STATIC(actbuf, actbuf_type);
-    SMPI_VARINIT_STATIC(pasbuf, char *);
+    static char actbuf[1024];
+    static char *pasbuf;
     char        *buf;
     int         n, rank, merr;
     MPI_Info    info;
 
-    if (SMPI_VARGET_GLOBAL(mem_keyval) == MPI_KEYVAL_INVALID) {
+    if (mem_keyval == MPI_KEYVAL_INVALID) {
        /* Create the keyval */
        merr = MPI_Win_create_keyval( MPI_WIN_NULL_COPY_FN, 
                                      MPI_WIN_NULL_DELETE_FN, 
-                                     &SMPI_VARGET_GLOBAL(mem_keyval), 0 );
+                                     &mem_keyval, 0 );
        if (merr) MTestPrintError( merr );
 
     }
 
-    switch (SMPI_VARGET_GLOBAL(win_index)) {
+    switch (win_index) {
     case 0:
        /* Active target window */
-       merr = MPI_Win_create( SMPI_VARGET_STATIC(actbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+       merr = MPI_Win_create( actbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD, 
                               win );
        if (merr) MTestPrintError( merr );
-       SMPI_VARGET_GLOBAL(winName) = "active-window";
-       merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)0 );
+       winName = "active-window";
+       merr = MPI_Win_set_attr( *win, mem_keyval, (void *)0 );
        if (merr) MTestPrintError( merr );
        break;
     case 1:
        /* Passive target window */
-       merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &SMPI_VARGET_STATIC(pasbuf) );
+       merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &pasbuf );
        if (merr) MTestPrintError( merr );
-       merr = MPI_Win_create( SMPI_VARGET_STATIC(pasbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+       merr = MPI_Win_create( pasbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD, 
                               win );
        if (merr) MTestPrintError( merr );
-       SMPI_VARGET_GLOBAL(winName) = "passive-window";
-       merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)2 );
+       winName = "passive-window";
+       merr = MPI_Win_set_attr( *win, mem_keyval, (void *)2 );
        if (merr) MTestPrintError( merr );
        break;
     case 2:
@@ -1640,8 +1636,8 @@ int MTestGetWin( MPI_Win *win, int mustBePassive )
        merr = MPI_Win_create( buf, n, 1, MPI_INFO_NULL, MPI_COMM_WORLD, 
                               win );
        if (merr) MTestPrintError( merr );
-       SMPI_VARGET_GLOBAL(winName) = "active-all-different-win";
-       merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
+       winName = "active-all-different-win";
+       merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
        if (merr) MTestPrintError( merr );
        break;
     case 3:
@@ -1661,20 +1657,20 @@ int MTestGetWin( MPI_Win *win, int mustBePassive )
        if (merr) MTestPrintError( merr );
        merr = MPI_Info_free( &info );
        if (merr) MTestPrintError( merr );
-       SMPI_VARGET_GLOBAL(winName) = "active-nolocks-all-different-win";
-       merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
+       winName = "active-nolocks-all-different-win";
+       merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
        if (merr) MTestPrintError( merr );
        break;
     default:
-       SMPI_VARGET_GLOBAL(win_index) = -1;
+       win_index = -1;
     }
-    SMPI_VARGET_GLOBAL(win_index)++;
-    return SMPI_VARGET_GLOBAL(win_index);
+    win_index++;
+    return win_index;
 }
 /* Return a pointer to the name associated with a window object */
 const char *MTestGetWinName( void )
 {
-    return SMPI_VARGET_GLOBAL(winName);
+    return winName;
 }
 /* Free the storage associated with a window object */
 void MTestFreeWin( MPI_Win *win )
@@ -1689,7 +1685,7 @@ void MTestFreeWin( MPI_Win *win )
     }
     if (addr) {
        void *val;
-       merr = MPI_Win_get_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), &val, &flag );
+       merr = MPI_Win_get_attr( *win, mem_keyval, &val, &flag );
        if (merr) MTestPrintError( merr );
        if (flag) {
            if (val == (void *)1) {
@@ -1707,8 +1703,8 @@ void MTestFreeWin( MPI_Win *win )
 }
 static void MTestRMACleanup( void )
 {
-    if (SMPI_VARGET_GLOBAL(mem_keyval) != MPI_KEYVAL_INVALID) {
-       MPI_Win_free_keyval( &SMPI_VARGET_GLOBAL(mem_keyval) );
+    if (mem_keyval != MPI_KEYVAL_INVALID) {
+       MPI_Win_free_keyval( &mem_keyval );
     }
 }
 #else