From: Augustin Degomme Date: Mon, 3 Nov 2014 13:05:39 +0000 (+0100) Subject: Add mpich3 tests for MPI_Info calls. X-Git-Tag: v3_12~732^2~241 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bc75e22e7ea7c0fdc45e5622d8f95b90bdcf2c27?ds=sidebyside Add mpich3 tests for MPI_Info calls. As expected, the get_nthkey does not behave as expected, and it won't. --- diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index ff453f3350..0270d01b8c 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -458,8 +458,9 @@ ENDIF() ADD_TEST(test-smpi-mpich3-pt2pt-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/pt2pt 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/pt2pt -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) ADD_TEST(test-smpi-mpich3-topo-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/topo 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/topo -tests=testlist -execarg=--cfg=contexts/factory:raw) ADD_TEST(test-smpi-mpich3-rma-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma 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/rma -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) + ADD_TEST(test-smpi-mpich3-info-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/info 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/info -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) ADD_TEST(test-smpi-mpich3-perf-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf 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/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/running_power:-1) - SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") + SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ENDIF() IF(SMPI_FORTRAN) ADD_TEST(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) diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index ad84be8bac..e83f2c3266 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -1081,6 +1081,7 @@ set(TESHSUITE_CMAKEFILES_TXT teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt teshsuite/smpi/mpich3-test/group/CMakeLists.txt + teshsuite/smpi/mpich3-test/info/CMakeLists.txt teshsuite/smpi/mpich3-test/init/CMakeLists.txt teshsuite/smpi/mpich3-test/pt2pt/CMakeLists.txt teshsuite/smpi/mpich3-test/topo/CMakeLists.txt diff --git a/buildtools/Cmake/MakeExe.cmake b/buildtools/Cmake/MakeExe.cmake index 2328e391f0..f15d5e5429 100644 --- a/buildtools/Cmake/MakeExe.cmake +++ b/buildtools/Cmake/MakeExe.cmake @@ -146,6 +146,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/init) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info) #add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/attr) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/util) diff --git a/teshsuite/smpi/mpich3-test/info/CMakeLists.txt b/teshsuite/smpi/mpich3-test/info/CMakeLists.txt new file mode 100644 index 0000000000..be5ba74d98 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required(VERSION 2.6) + +if(enable_smpi) + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else() + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") + set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff") + endif() + + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") + + include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") + + + add_executable(infodel infodel.c) + add_executable(infodup infodup.c) +# add_executable(infoenv infoenv.c) + add_executable(infomany2 infomany2.c) + add_executable(infomany infomany.c) + add_executable(infoorder infoorder.c) + add_executable(infotest infotest.c) + add_executable(infovallen infovallen.c) + + + + target_link_libraries(infodel simgrid mtest_c) + target_link_libraries(infodup simgrid mtest_c) +# target_link_libraries(infoenv simgrid mtest_c) + target_link_libraries(infomany2 simgrid mtest_c) + target_link_libraries(infomany simgrid mtest_c) + target_link_libraries(infoorder simgrid mtest_c) + target_link_libraries(infotest simgrid mtest_c) + target_link_libraries(infovallen simgrid mtest_c) + + + + +endif() + +set(tesh_files + ${tesh_files} + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + PARENT_SCOPE + ) +set(examples_src + ${examples_src} + ${CMAKE_CURRENT_SOURCE_DIR}/infodel.c + ${CMAKE_CURRENT_SOURCE_DIR}/infodup.c + ${CMAKE_CURRENT_SOURCE_DIR}/infoenv.c + ${CMAKE_CURRENT_SOURCE_DIR}/infomany2.c + ${CMAKE_CURRENT_SOURCE_DIR}/infomany.c + ${CMAKE_CURRENT_SOURCE_DIR}/infoorder.c + ${CMAKE_CURRENT_SOURCE_DIR}/infotest.c + ${CMAKE_CURRENT_SOURCE_DIR}/infovallen.c + PARENT_SCOPE + ) +set(bin_files + ${bin_files} + PARENT_SCOPE + ) +set(txt_files + ${txt_files} + ${CMAKE_CURRENT_SOURCE_DIR}/testlist + PARENT_SCOPE + ) diff --git a/teshsuite/smpi/mpich3-test/info/infodel.c b/teshsuite/smpi/mpich3-test/info/infodel.c new file mode 100644 index 0000000000..a62f362789 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infodel.c @@ -0,0 +1,83 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + char value[MPI_MAX_INFO_VAL]; + int i, flag, nkeys; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info1, infodup; + int nkeys, nkeysdup, i, vallen, flag, flagdup; + char key[MPI_MAX_INFO_KEY], keydup[MPI_MAX_INFO_KEY]; + char value[MPI_MAX_INFO_VAL], valdup[MPI_MAX_INFO_VAL]; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info1 ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + MPI_Info_set( info1, (char*)"host", (char*)"myhost.myorg.org" ); + MPI_Info_set( info1, (char*)"file", (char*)"runfile.txt" ); + MPI_Info_set( info1, (char*)"soft", (char*)"2:1000:4,3:1000:7" ); + + MPI_Info_dup( info1, &infodup ); + + MPI_Info_get_nkeys( infodup, &nkeysdup ); + MPI_Info_get_nkeys( info1, &nkeys ); + if (nkeys != nkeysdup) { + errs++; + printf( "Dup'ed info has a different number of keys; is %d should be %d\n", + nkeysdup, nkeys ); + } + vallen = MPI_MAX_INFO_VAL; + for (i=0; i + +static int verbose = 0; + +int main(int argc, char *argv[]) +{ + char value[MPI_MAX_INFO_VAL]; + char *keys[] = { "command", "argv", "maxprocs", "soft", "host", "arch", "wdir", "file", + "thread_level", 0 }; + int flag, i; + + MPI_Init(NULL, NULL); + + for (i = 0; keys[i]; i++) { + MPI_Info_get(MPI_INFO_ENV, keys[i], MPI_MAX_INFO_VAL, value, &flag); + if (flag && verbose) + printf("command: %s\n", value); + } + + printf(" No Errors\n"); + + MPI_Finalize(); + return 0; +} diff --git a/teshsuite/smpi/mpich3-test/info/infomany.c b/teshsuite/smpi/mpich3-test/info/infomany.c new file mode 100644 index 0000000000..c9f8213598 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infomany.c @@ -0,0 +1,105 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +/* Test of info that makes use of the extended handles */ +#include "mpi.h" +#include +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#ifndef MAX_INFOS +#define MAX_INFOS 4000 +#endif +#define MAX_ERRORS 10 +#define info_list 16 +/* #define DBG */ + +int main( int argc, char *argv[] ) +{ + MPI_Info infos[MAX_INFOS]; + char key[64], value[64]; + int errs = 0; + int i, j; + + MTest_Init( &argc, &argv ); + + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#ifndef MAX_INFOS +#define MAX_INFOS 4000 +#endif +#define MAX_ERRORS 10 +#define info_list 16 +/* #define DBG */ + +#ifdef DEBUG +#define DBGPRINTF(a) printf a; fflush(stdout) +#else +#define DBGPRINTF(a) +#endif + +int main( int argc, char *argv[] ) +{ + MPI_Info infos[MAX_INFOS]; + char key[64], value[64]; + int errs = 0; + int i, j; + + MTest_Init( &argc, &argv ); + + /* We create max_info items, then delete the middle third of them, + then recreate them, then check them, then + delete them all. This checks that the MPICH algorithm for + handling large numbers of items works correctly; other MPI + implementations should also be able to handle this */ + + /* Create them all */ + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys1[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values1[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + + char value[MPI_MAX_INFO_VAL]; + int i, flag; + + MTest_Init( &argc, &argv ); + + /* 1,2,3 */ + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i=0; i--) { + MPI_Info_set( info, keys1[i], values1[i] ); + } + + /* Check that all values are present */ + for (i=0; i +#include +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +int main( int argc, char *argv[] ) +{ + MPI_Info i1, i2; + int errs = 0; + char value[64]; + int flag; + + MPI_Init( &argc, &argv ); + + MPI_Info_create( &i1 ); + MPI_Info_create( &i2 ); + + MPI_Info_set( i1, (char*)"key1", (char*)"value1" ); + MPI_Info_set( i2, (char*)"key2", (char*)"value2" ); + + MPI_Info_get( i1, (char*)"key2", 64, value, &flag ); + if (flag) { + printf( "Found key2 in info1\n" ); + errs ++; + } + MPI_Info_get( i1, (char*)"key1", 64, value, &flag ); + if (!flag) { + errs++; + printf( "Did not find key1 in info1\n" ); + } + else if (strcmp( value, "value1" )) { + errs++; + printf( "Found wrong value (%s), expected value1\n", value ); + } + + MPI_Info_free( &i1 ); + MPI_Info_free( &i2 ); + if (errs) { + printf( " Found %d errors\n", errs ); + } + else { + printf( " No Errors\n" ); + } + MPI_Finalize( ); + return 0; +} diff --git a/teshsuite/smpi/mpich3-test/info/infovallen.c b/teshsuite/smpi/mpich3-test/info/infovallen.c new file mode 100644 index 0000000000..fdce0e37c6 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infovallen.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include "mpitest.h" + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + char value[MPI_MAX_INFO_VAL]; + int i, flag, vallen; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i