From f8aee9e9605123e308d1e1ece136c5912f3dc367 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 21 Mar 2014 16:40:24 +0100 Subject: [PATCH] Have some mpich3 tests use the automatic privatization instead of manual one. Add some fortran tests which were buggy and needed privatization as well. --- buildtools/Cmake/AddTests.cmake | 14 +- .../smpi/mpich3-test/f77/pt2pt/CMakeLists.txt | 4 +- teshsuite/smpi/mpich3-test/f77/pt2pt/testlist | 4 +- teshsuite/smpi/mpich3-test/f77/util/mtestf.f | 7 +- .../smpi/mpich3-test/f90/pt2pt/CMakeLists.txt | 4 +- .../smpi/mpich3-test/f90/pt2pt/allpairf90.f90 | 1 + teshsuite/smpi/mpich3-test/f90/pt2pt/testlist | 2 +- .../smpi/mpich3-test/f90/util/mtestf90.f90 | 35 +-- teshsuite/smpi/mpich3-test/util/mtest.c | 211 +++++++++--------- 9 files changed, 130 insertions(+), 152 deletions(-) diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index f9b62f92bb..a3330e3552 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -570,16 +570,16 @@ if(NOT enable_memcheck) # END TESH TESTS if(enable_smpi_MPICH3_testsuite) - ADD_TEST(smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread) - ADD_TEST(smpi-mpich3-coll-ompi-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0) - ADD_TEST(smpi-mpich3-coll-mpich-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich) + ADD_TEST(smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatize_global_variables:yes) + ADD_TEST(smpi-mpich3-coll-ompi-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0 -execarg=--cfg=smpi/privatize_global_variables:yes) + ADD_TEST(smpi-mpich3-coll-mpich-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:yes) set_tests_properties(smpi-mpich3-coll-thread smpi-mpich3-coll-ompi-thread smpi-mpich3-coll-mpich-thread PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") if(CONTEXT_UCONTEXT) - ADD_TEST(smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0) + ADD_TEST(smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0 -execarg=--cfg=smpi/privatize_global_variables:yes) set_tests_properties(smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") endif() if(HAVE_RAWCTX) - ADD_TEST(smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich) + ADD_TEST(smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:yes) set_tests_properties(smpi-mpich3-coll-mpich-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") endif() @@ -594,11 +594,11 @@ if(NOT enable_memcheck) endif() if(SMPI_F2C) - ADD_TEST(smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=contexts/stack_size:8000) + ADD_TEST(smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=smpi/privatize_global_variables:yes) set_tests_properties(smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") endif() if(SMPI_F90) - ADD_TEST(smpi-mpich3-thread-f90 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -execarg=--cfg=contexts/factory:thread) + ADD_TEST(smpi-mpich3-thread-f90 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -execarg=--cfg=smpi/privatize_global_variables:yes) set_tests_properties(smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") endif() endif() diff --git a/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt index 5d4714b624..e7cc14aaec 100644 --- a/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt @@ -16,12 +16,12 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C) add_executable(allpairf allpairf.f) # add_executable(greqf greqf.f dummyf.f) #add_executable(mprobef mprobef.f) -# add_executable(statusesf statusesf.f) + add_executable(statusesf statusesf.f) target_link_libraries(allpairf simgrid mtest_f77) # target_link_libraries(greqf simgrid mtest_f77) #target_link_libraries(mprobef simgrid mtest_f77) -# target_link_libraries(statusesf simgrid mtest_f77) + target_link_libraries(statusesf simgrid mtest_f77) endif() diff --git a/teshsuite/smpi/mpich3-test/f77/pt2pt/testlist b/teshsuite/smpi/mpich3-test/f77/pt2pt/testlist index 3385b9d641..fe7ad6b359 100644 --- a/teshsuite/smpi/mpich3-test/f77/pt2pt/testlist +++ b/teshsuite/smpi/mpich3-test/f77/pt2pt/testlist @@ -1,4 +1,4 @@ -#statusesf 1 +statusesf 1 #greqf 1 allpairf 2 -#mprobef 2 mpiversion=3.0 +mprobef 2 mpiversion=3.0 diff --git a/teshsuite/smpi/mpich3-test/f77/util/mtestf.f b/teshsuite/smpi/mpich3-test/f77/util/mtestf.f index f1a137ca7b..81edc25f71 100644 --- a/teshsuite/smpi/mpich3-test/f77/util/mtestf.f +++ b/teshsuite/smpi/mpich3-test/f77/util/mtestf.f @@ -15,8 +15,6 @@ C about out-of-order statements logical dbgflag integer wrank common /mtest/ dbgflag, wrank - integer myindex - common /grr/ myindex call MPI_Initialized( flag, ierr ) if (.not. flag) then @@ -24,7 +22,6 @@ C about out-of-order statements endif dbgflag = .false. - myindex = 0 call MPI_Comm_rank( MPI_COMM_WORLD, wrank, ierr ) end C @@ -56,7 +53,8 @@ C A simple get intracomm for now integer comm, min_size, size, rank logical qsmaller integer myindex - common /grr/ myindex + save myindex + data myindex /0/ comm = MPI_COMM_NULL if (myindex .eq. 0) then @@ -75,7 +73,6 @@ C A simple get intracomm for now endif myindex = mod( myindex, 4 ) + 1 MTestGetIntracomm = comm .ne. MPI_COMM_NULL - qsmaller=.true. end C subroutine MTestFreeComm( comm ) diff --git a/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt index 51a0fcbf9c..9275e6a0a7 100644 --- a/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt @@ -11,11 +11,11 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") -# add_executable(allpairf90 allpairf90.f90) + add_executable(allpairf90 allpairf90.f90) # add_executable(greqf90 greqf90.f90 dummyf90.f90) # add_executable(mprobef90 mprobef90.f90) add_executable(statusesf90 statusesf90.f90) -# target_link_libraries(allpairf90 simgrid mtest_f90) + target_link_libraries(allpairf90 simgrid mtest_f90) # target_link_libraries(greqf90 simgrid mtest_f90) # target_link_libraries(mprobef90 simgrid mtest_f90) target_link_libraries(statusesf90 simgrid mtest_f90) diff --git a/teshsuite/smpi/mpich3-test/f90/pt2pt/allpairf90.f90 b/teshsuite/smpi/mpich3-test/f90/pt2pt/allpairf90.f90 index 70f5c51081..92251df6b1 100644 --- a/teshsuite/smpi/mpich3-test/f90/pt2pt/allpairf90.f90 +++ b/teshsuite/smpi/mpich3-test/f90/pt2pt/allpairf90.f90 @@ -21,6 +21,7 @@ call MTest_Init( ierr ) do while ( mtestGetIntraComm( comm, 2, .false. ) ) + call test_pair_send( comm, errs ) call test_pair_ssend( comm, errs ) !call test_pair_rsend( comm, errs ) diff --git a/teshsuite/smpi/mpich3-test/f90/pt2pt/testlist b/teshsuite/smpi/mpich3-test/f90/pt2pt/testlist index b39a1a0462..920fba2c4b 100644 --- a/teshsuite/smpi/mpich3-test/f90/pt2pt/testlist +++ b/teshsuite/smpi/mpich3-test/f90/pt2pt/testlist @@ -1,5 +1,5 @@ # This file generated by f77tof90 statusesf90 1 #greqf90 1 -#allpairf90 2 +allpairf90 2 mprobef90 2 mpiversion=3.0 diff --git a/teshsuite/smpi/mpich3-test/f90/util/mtestf90.f90 b/teshsuite/smpi/mpich3-test/f90/util/mtestf90.f90 index 8e447927a3..56b76b7e88 100644 --- a/teshsuite/smpi/mpich3-test/f90/util/mtestf90.f90 +++ b/teshsuite/smpi/mpich3-test/f90/util/mtestf90.f90 @@ -43,51 +43,34 @@ endif endif end - -module array - integer, dimension(:), allocatable :: myindex -end module - ! ! A simple get intracomm for now logical function MTestGetIntracomm( comm, min_size, qsmaller ) - use array use mpi - integer ierr integer comm, min_size, size, rank logical qsmaller + integer myindex + save myindex + data myindex /0/ - integer status - call mpi_comm_size( MPI_COMM_WORLD, size, ierr ) - - if(.not. allocated(myindex)) then - allocate(myindex(size), STAT=status) - call mpi_comm_rank( MPI_COMM_WORLD, rank, ierr ) - myindex(rank+1)=0 - endif - - !data myindex /0/ - - - - if (myindex(rank+1) .eq. 0) then + comm = MPI_COMM_NULL + if (myindex .eq. 0) then comm = MPI_COMM_WORLD - else if (myindex(rank+1) .eq. 1) then + else if (myindex .eq. 1) then call mpi_comm_dup( MPI_COMM_WORLD, comm, ierr ) - else if (myindex(rank+1) .eq. 2) then + else if (myindex .eq. 2) then call mpi_comm_size( MPI_COMM_WORLD, size, ierr ) call mpi_comm_rank( MPI_COMM_WORLD, rank, ierr ) call mpi_comm_split( MPI_COMM_WORLD, 0, size - rank, comm, & & ierr ) else - if (min_size .eq. 1 .and. myindex(rank+1) .eq. 3) then + if (min_size .eq. 1 .and. myindex .eq. 3) then comm = MPI_COMM_SELF endif endif - myindex(rank+1) = mod( myindex(rank+1), 4 ) + 1 + myindex = mod( myindex, 4 ) + 1 MTestGetIntracomm = comm .ne. MPI_COMM_NULL - qsmaller=.true. end ! subroutine MTestFreeComm( comm ) diff --git a/teshsuite/smpi/mpich3-test/util/mtest.c b/teshsuite/smpi/mpich3-test/util/mtest.c index e922072ddf..e75d17b94f 100644 --- a/teshsuite/smpi/mpich3-test/util/mtest.c +++ b/teshsuite/smpi/mpich3-test/util/mtest.c @@ -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 #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; } /* ------------------------------------------------------------------------ */ @@ -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 */ @@ -637,7 +636,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 +858,7 @@ int MTestGetDatatypes( MTestDatatype *sendtype, MTestDatatype *recvtype, break; #endif default: - SMPI_VARGET_GLOBAL(datatype_index) = -1; + datatype_index = -1; } if (!sendtype->InitBuf) { @@ -870,29 +869,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 +900,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 +953,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 +971,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 +992,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 +1013,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 +1024,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 +1042,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 +1056,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 +1070,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 +1081,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 +1092,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 +1101,7 @@ done2=done; } } - return SMPI_VARGET_GLOBAL(intraCommIdx); + return intraCommIdx; } /* @@ -1117,7 +1115,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 +1136,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 +1164,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 +1194,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 +1225,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 +1264,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 +1306,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 +1343,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 +1396,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 +1405,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 +1417,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 +1427,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 +1446,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 +1459,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 +1521,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 +1541,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 +1582,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 +1637,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 +1658,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 +1686,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 +1704,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 -- 2.20.1