Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpich3 tests for MPI_Info calls.
authorAugustin Degomme <augustin.degomme@imag.fr>
Mon, 3 Nov 2014 13:05:39 +0000 (14:05 +0100)
committerAugustin Degomme <augustin.degomme@imag.fr>
Mon, 3 Nov 2014 13:05:55 +0000 (14:05 +0100)
As expected, the get_nthkey does not behave as expected, and it won't.

14 files changed:
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExe.cmake
teshsuite/smpi/mpich3-test/info/CMakeLists.txt [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infodel.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infodup.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infoenv.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infomany.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infomany2.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infoorder.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infotest.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infovallen.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/testlist [new file with mode: 0644]
teshsuite/smpi/mpich3-test/testlist

index ff453f3..0270d01 100644 (file)
@@ -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-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)
         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)
       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)
index ad84be8..e83f2c3 100644 (file)
@@ -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/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
   teshsuite/smpi/mpich3-test/init/CMakeLists.txt
   teshsuite/smpi/mpich3-test/pt2pt/CMakeLists.txt
   teshsuite/smpi/mpich3-test/topo/CMakeLists.txt
index 2328e39..f15d5e5 100644 (file)
@@ -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/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)
 
 #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 (file)
index 0000000..be5ba74
--- /dev/null
@@ -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 (file)
index 0000000..a62f362
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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<NKEYS; i++) {
+       MPI_Info_set( info, keys[i], values[i] );
+    }
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) { 
+       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys[i] );
+       }
+       if (strcmp( value, values[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s, got %s expected %s\n", 
+                   keys[i], value, values[i] );
+       }
+    }
+
+    /* Now, change one value and remove another, then check again */
+    MPI_Info_delete( info, keys[NKEYS-1] );
+    MPI_Info_get_nkeys( info, &nkeys );
+    if (nkeys != NKEYS - 1) {
+       errs++;
+       printf( "Deleting a key did not change the number of keys\n" );
+    }
+
+    values[0] = (char*)"backfile.txt";
+    MPI_Info_set( info, keys[0], values[0] );
+    for (i=0; i<NKEYS-1; i++) {
+       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "(after reset) No value for key %s\n", keys[i] );
+       }
+       if (strcmp( value, values[i] )) {
+           errs++;
+           printf( "(after reset) Incorrect value for key %s, got %s expected %s\n", 
+                   keys[i], value, values[i] );
+       }
+    }
+
+    MPI_Info_free( &info );
+    if (info != MPI_INFO_NULL) {
+       errs++;
+       printf( "MPI_Info_free should set info to MPI_INFO_NULL\n" );
+    }
+
+    MTest_Finalize( errs );
+    MPI_Finalize();
+    return 0;
+  
+}
diff --git a/teshsuite/smpi/mpich3-test/info/infodup.c b/teshsuite/smpi/mpich3-test/info/infodup.c
new file mode 100644 (file)
index 0000000..b89d020
--- /dev/null
@@ -0,0 +1,82 @@
+/* -*- 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 <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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<nkeys; i++) {
+       /* MPI requires that the keys are in the same order after the dup */
+       MPI_Info_get_nthkey( info1, i, key );
+       MPI_Info_get_nthkey( infodup, i, keydup );
+       if (strcmp(key, keydup)) {
+           errs++;
+           printf( "keys do not match: %s should be %s\n", keydup, key );
+       }
+
+       vallen = MPI_MAX_INFO_VAL;
+       MPI_Info_get( info1, key, vallen, value, &flag );
+       MPI_Info_get( infodup, keydup, vallen, valdup, &flagdup );
+       if (!flag || !flagdup) {
+           errs++;
+           printf( "Info get failed for key %s\n", key );
+       }
+       else if (strcmp( value, valdup )) {
+           errs++;
+           printf( "Info values for key %s not the same after dup\n", key );
+       }
+    }
+
+    /* Change info and check that infodup does NOT have the new value 
+       (ensure that lazy dups are still duped) */
+    MPI_Info_set( info1, (char*)"path", (char*)"/a:/b:/c/d" );
+
+    MPI_Info_get( infodup, (char*)"path", vallen, value, &flag );
+    if (flag) {
+       errs++;
+       printf( "inserting path into info changed infodup\n" );
+    }
+    
+    MPI_Info_free( &info1 );
+    MPI_Info_free( &infodup );
+    
+    MTest_Finalize( errs );
+    MPI_Finalize();
+    return 0;
+  
+}
diff --git a/teshsuite/smpi/mpich3-test/info/infoenv.c b/teshsuite/smpi/mpich3-test/info/infoenv.c
new file mode 100644 (file)
index 0000000..ff895c8
--- /dev/null
@@ -0,0 +1,31 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpi.h"
+#include <stdio.h>
+
+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 (file)
index 0000000..c9f8213
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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<MAX_INFOS; i++) {
+       MPI_Info_create( &infos[i] );
+#ifdef DBG
+       printf( "Info handle is %x\n", infos[i] );
+#endif
+       for (j=0; j<info_list; j++) {
+           sprintf( key, "key%d-%d", i, j );
+           sprintf( value, "value%d-%d", i, j );
+#ifdef DBG
+           printf( "Creating key/value %s=%s\n", key, value );
+#endif
+           MPI_Info_set( infos[i], key, value );
+       }
+#ifdef DBG
+       { int nkeys;
+       MPI_Info_get_nkeys( infos[0], &nkeys );
+       if (nkeys != info_list) {
+           printf( "infos[0] changed at %d info\n", i );}
+       }
+#endif
+    }
+    
+    for (i=0; i<MAX_INFOS; i++) {
+       int nkeys;
+       /*printf( "info = %x\n", infos[i] );
+         print_handle( infos[i] ); printf( "\n" );*/
+       MPI_Info_get_nkeys( infos[i], &nkeys );
+       if (nkeys != info_list) {
+           errs++;
+           if (errs < MAX_ERRORS) {
+               printf( "Wrong number of keys for info %d; got %d, should be %d\n",
+                       i, nkeys, info_list );
+           }
+       }
+       for (j=0; j<nkeys; j++) {
+           char keystr[64];
+           char valstr[64];
+           int  flag;
+           MPI_Info_get_nthkey( infos[i], j, key );
+           sprintf( keystr, "key%d-%d", i, j );
+           if (strcmp( keystr, key ) != 0) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Wrong key for info %d; got %s expected %s\n", 
+                           i, key, keystr );
+               }
+               continue;
+           }
+           MPI_Info_get( infos[i], key, sizeof(value), value, &flag );
+           if (!flag) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Get failed to return value for info %d\n", i );
+               }
+               continue;
+           }
+           sprintf( valstr, "value%d-%d", i, j );
+           if (strcmp( valstr, value ) != 0) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Wrong value for info %d; got %s expected %s\n",
+                           i, value, valstr );
+               }
+           }
+       }
+    }
+    for (i=0; i<MAX_INFOS; i++) {
+       MPI_Info_free( &infos[i] );
+    }
+    
+    MTest_Finalize( errs );
+    MPI_Finalize( );
+    return 0;
+}
diff --git a/teshsuite/smpi/mpich3-test/info/infomany2.c b/teshsuite/smpi/mpich3-test/info/infomany2.c
new file mode 100644 (file)
index 0000000..f400648
--- /dev/null
@@ -0,0 +1,133 @@
+/* -*- 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, including
+   inserts and deletes */
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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<MAX_INFOS; i++) {
+       MPI_Info_create( &infos[i] );
+       DBGPRINTF( ( "Info handle is %x\n", infos[i] ) );
+       for (j=0; j<info_list; j++) {
+           sprintf( key, "key%d-%d", i, j );
+           sprintf( value, "value%d-%d", i, j );
+           DBGPRINTF( ( "Creating key/value %s=%s\n", key, value ));
+           MPI_Info_set( infos[i], key, value );
+       }
+#ifdef DBG
+       { int nkeys;
+       MPI_Info_get_nkeys( infos[0], &nkeys );
+       if (nkeys != info_list) {
+           printf( "infos[0] changed at %d info\n", i );}
+       }
+#endif
+    }
+
+    /* Delete the middle set */
+    for (i=MAX_INFOS/3; i<(2*MAX_INFOS/3); i++) {
+       MPI_Info_free( &infos[i] );
+    }
+    
+    /* Recreate the middle set */
+    for (i=MAX_INFOS/3; i<(2*MAX_INFOS/3); i++) {
+       MPI_Info_create( &infos[i] );
+       DBGPRINTF( ( "Info handle is %x\n", infos[i] ) );
+       for (j=0; j<info_list; j++) {
+           sprintf( key, "key%d-%d", i, j );
+           sprintf( value, "value%d-%d", i, j );
+           DBGPRINTF( ( "Creating key/value %s=%s\n", key, value ));
+           MPI_Info_set( infos[i], key, value );
+       }
+    }
+
+    /* Now, check that they are still valid */
+    for (i=0; i<MAX_INFOS; i++) {
+       int nkeys;
+       /*printf( "info = %x\n", infos[i] );
+         print_handle( infos[i] ); printf( "\n" );*/
+       MPI_Info_get_nkeys( infos[i], &nkeys );
+       if (nkeys != info_list) {
+           errs++;
+           if (errs < MAX_ERRORS) {
+               printf( "Wrong number of keys for info %d; got %d, should be %d\n",
+                       i, nkeys, info_list );
+           }
+       }
+       for (j=0; j<nkeys; j++) {
+           char keystr[64];
+           char valstr[64];
+           int  flag;
+           MPI_Info_get_nthkey( infos[i], j, key );
+           sprintf( keystr, "key%d-%d", i, j );
+           if (strcmp( keystr, key ) != 0) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Wrong key for info %d; got %s expected %s\n", 
+                           i, key, keystr );
+               }
+               continue;
+           }
+           MPI_Info_get( infos[i], key, 64, value, &flag );
+           if (!flag) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Get failed to return value for info %d\n", i );
+               }
+               continue;
+           }
+           sprintf( valstr, "value%d-%d", i, j );
+           if (strcmp( valstr, value ) != 0) {
+               errs++;
+               if (errs < MAX_ERRORS) {
+                   printf( "Wrong value for info %d; got %s expected %s\n",
+                           i, value, valstr );
+               }
+           }
+       }
+    }
+    for (i=0; i<MAX_INFOS; i++) {
+       MPI_Info_free( &infos[i] );
+    }
+    
+    MTest_Finalize( errs );
+    MPI_Finalize( );
+    return 0;
+}
diff --git a/teshsuite/smpi/mpich3-test/info/infoorder.c b/teshsuite/smpi/mpich3-test/info/infoorder.c
new file mode 100644 (file)
index 0000000..aa1db8c
--- /dev/null
@@ -0,0 +1,166 @@
+/* -*- 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 <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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<NKEYS; i++) {
+       MPI_Info_set( info, keys1[i], values1[i] );
+    }
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+
+    /* 3,2,1 */
+    MPI_Info_create( &info );
+    /* Use only named keys incase the info implementation only supports
+       the predefined keys (e.g., IBM) */
+    for (i=NKEYS-1; i>=0; i--) {
+       MPI_Info_set( info, keys1[i], values1[i] );
+    }
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+
+    /* 1,3,2 */
+    MPI_Info_create( &info );
+    /* Use only named keys incase the info implementation only supports
+       the predefined keys (e.g., IBM) */
+    MPI_Info_set( info, keys1[0], values1[0] );
+    MPI_Info_set( info, keys1[2], values1[2] );
+    MPI_Info_set( info, keys1[1], values1[1] );
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+
+    /* 2,1,3 */
+    MPI_Info_create( &info );
+    /* Use only named keys incase the info implementation only supports
+       the predefined keys (e.g., IBM) */
+    MPI_Info_set( info, keys1[1], values1[1] );
+    MPI_Info_set( info, keys1[0], values1[0] );
+    MPI_Info_set( info, keys1[2], values1[2] );
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+
+    /* 2,3,1 */
+    MPI_Info_create( &info );
+    /* Use only named keys incase the info implementation only supports
+       the predefined keys (e.g., IBM) */
+    MPI_Info_set( info, keys1[1], values1[1] );
+    MPI_Info_set( info, keys1[2], values1[2] );
+    MPI_Info_set( info, keys1[0], values1[0] );
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+    
+    /* 3,1,2 */
+    MPI_Info_create( &info );
+    /* Use only named keys incase the info implementation only supports
+       the predefined keys (e.g., IBM) */
+    MPI_Info_set( info, keys1[2], values1[2] );
+    MPI_Info_set( info, keys1[0], values1[0] );
+    MPI_Info_set( info, keys1[1], values1[1] );
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys1[i] );
+       }
+       if (strcmp( value, values1[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys1[i] );
+       }
+    }
+    MPI_Info_free( &info );
+    
+    MTest_Finalize( errs );
+    MPI_Finalize();
+    return 0;
+  
+}
diff --git a/teshsuite/smpi/mpich3-test/info/infotest.c b/teshsuite/smpi/mpich3-test/info/infotest.c
new file mode 100644 (file)
index 0000000..1ce76ae
--- /dev/null
@@ -0,0 +1,56 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+/* Simple info test */
+
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpitestconf.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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 (file)
index 0000000..fdce0e3
--- /dev/null
@@ -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 <stdio.h>
+#include <string.h>
+#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<NKEYS; i++) {
+       MPI_Info_set( info, keys[i], values[i] );
+    }
+
+    /* Check that all values are present */
+    for (i=0; i<NKEYS; i++) {
+       MPI_Info_get_valuelen( info, keys[i], &vallen, &flag );
+       if (!flag) {
+           errs++;
+           printf( "get_valuelen failed for valid key %s\n", keys[i] );
+       }
+       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
+       if (!flag) {
+           errs++;
+           printf( "No value for key %s\n", keys[i] );
+       }
+       if (strcmp( value, values[i] )) {
+           errs++;
+           printf( "Incorrect value for key %s\n", keys[i] );
+       }
+       if (strlen(value) != vallen) {
+           errs++;
+           printf( "value_len returned %d but actual len is %d\n", 
+                   vallen, (int) strlen(value) );
+       }
+    }
+
+    MPI_Info_free( &info );
+    
+    MTest_Finalize( errs );
+    MPI_Finalize();
+    return 0;
+  
+}
diff --git a/teshsuite/smpi/mpich3-test/info/testlist b/teshsuite/smpi/mpich3-test/info/testlist
new file mode 100644 (file)
index 0000000..3ecf7f7
--- /dev/null
@@ -0,0 +1,9 @@
+infodup 1
+infodel 1
+infovallen 1
+infoorder 1
+#need a really working mpi_info_get_nthkey..
+#infomany 1
+#infomany2 1
+infotest 1
+infoenv 1 mpiversion=3.0
index aef3b2c..9904225 100644 (file)
@@ -8,7 +8,7 @@ datatype
 #errhan
 rma
 group
 #errhan
 rma
 group
-#info
+info
 init
 #mpi_t
 pt2pt
 init
 #mpi_t
 pt2pt