Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 19 Mar 2014 14:52:07 +0000 (15:52 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 19 Mar 2014 14:52:07 +0000 (15:52 +0100)
16 files changed:
ChangeLog
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/MakeLib.cmake
src/smpi/smpi_f77.c
src/smpi/smpirun.in
src/xbt/mmalloc/mm_legacy.c
src/xbt/mmalloc/mmorecore.c
teshsuite/smpi/allreduce_coll_large.tesh
tools/tesh/background.tesh
tools/tesh/bg-set-signal.tesh
tools/tesh/catch-return.tesh
tools/tesh/catch-signal.tesh
tools/tesh/set-return.tesh
tools/tesh/set-signal.tesh
tools/tesh/setenv.tesh

index 2351083..5abdda7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,10 +31,13 @@ SimGrid (3.11) NOT RELEASED; urgency=low
    - creation of a VM on a PM
    - migration of a VM from a PM to another PM
 
- Simcalls:
- * Simcalls are now generated by a python script
-   - generate files include by simgrid
-   - check that all the functions exists and propose prototypes
+ SIMIX:
+ * Protect context stacks against stack overflow. The number of protected memory
+   pages allocated on the top of each stack (1 by default) can be configured
+   with the new command line option --cfg=contexts/guard_size:<value>.
+ * Simcalls are now generated by a python script that
+   - generates files included by SimGrid
+   - checks that all the functions exist, and proposes prototypes
  * Clean simcalls
    - remove sem_destroy, file_set_data, comm_destroy, vm_set_state,
      host_set_data, host_get_data
@@ -70,7 +73,7 @@ SimGrid (3.11) NOT RELEASED; urgency=low
  * Supernovae build mode is definitively removed. It was used to improve
    inlining and inter-module optimizations. It is nowadays superseded by
    link-time optimizations commonly available in compilers.
- * Update ns3 find lib. NS3 bindings should work again now.
+ * Update ns-3 find lib. Bindings for ns-3 should work again now.
  * Add boost dependency for surf++
 
  -- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
@@ -295,7 +298,7 @@ SimGrid (3.8) stable; urgency=low
  * New option "enable_mallocators" to disable mallocators, for debugging
    purpose ("on" by default).
 
- Simix:
+ SIMIX:
  * Bug fixes around the resource failures: don't let the processes
    survive the host they are running onto.
  * Add an interface to auto-restart processes when the host in which they are
index 719dc51..33ecd81 100644 (file)
@@ -649,7 +649,7 @@ if(NOT enable_memcheck)
     ADD_TEST(stack-overflow-ucontext            ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/stack_overflow.tesh)
   endif()
   if(HAVE_RAWCTX)
-  ADD_TEST(stack-overflow-raw                   ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:raw --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/stack_overflow.tesh)
+    ADD_TEST(stack-overflow-raw                 ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:raw --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/stack_overflow.tesh)
   endif()
 
   # examples/msg/mc
@@ -668,6 +668,23 @@ if(NOT enable_memcheck)
     endif()
   endif()
 
+  ###
+  ### Declare that we know that some tests are broken
+  ###
+  if(release)
+    if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+      # These tests are known to fail on Mac OS X (the expected error message is
+      # not shown).
+      set_tests_properties(stack-overflow-thread PROPERTIES WILL_FAIL true)
+      if(CONTEXT_UCONTEXT)
+        set_tests_properties(stack-overflow-ucontext PROPERTIES WILL_FAIL true)
+      endif()
+      if(HAVE_RAWCTX)
+        set_tests_properties(stack-overflow-raw PROPERTIES WILL_FAIL true)
+      endif()
+    endif()
+  endif()
+
 endif()
 
 ADD_TEST(tesh-simdag-full-links01               ${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms/basic_parsing_test ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms/two_clusters.xml FULL_LINK)
index 04a2a3e..1085ffd 100644 (file)
@@ -107,6 +107,8 @@ else()
 endif()
 
 # Checks for header libraries functions.
+CHECK_LIBRARY_EXISTS(dl      dlopen                  "" HAVE_DLOPEN_IN_LIBDL)
+CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" pthread)
 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
@@ -249,7 +251,10 @@ CHECK_TYPE_SIZE(void* SIZEOF_VOIDP)
 ### Check for GNU dynamic linker
 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
 if (HAVE_DLFCN_H)
-    execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gnu_dynlinker.c -ldl -o test_gnu_ld
+    if(HAVE_DLOPEN_IN_LIBDL)
+      set(DL_LIBRARY "-ldl")
+    endif(HAVE_DLOPEN_IN_LIBDL)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       OUTPUT_VARIABLE HAVE_GNU_LD_compil
     )
index 1e21137..bbf9eab 100644 (file)
@@ -20,7 +20,16 @@ add_dependencies(simgrid maintainer_files)
 
 # Compute the dependencies of SimGrid
 #####################################
-set(SIMGRID_DEP "-lm -lstdc++")
+set(SIMGRID_DEP "-lm")
+
+if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
+    AND NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.0
+    AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+  # FreeBSD from 10.0 provide a internal C++ stack (unused by gcc)
+  set(SIMGRID_DEP "${SIMGRID_DEP} -lc++")
+else()
+  set(SIMGRID_DEP "${SIMGRID_DEP} -lstdc++")
+endif()
 
 if(pthread)
   if(${CONTEXT_THREADS})
@@ -87,7 +96,7 @@ if(HAVE_MC)
 endif()
 
 if(MMALLOC_WANT_OVERRIDE_LEGACY AND HAVE_GNU_LD)
-  SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl")
+  SET(SIMGRID_DEP "${SIMGRID_DEP} ${DL_LIBRARY}")
 endif()
 
 if(HAVE_NS3)
@@ -104,6 +113,10 @@ if(HAVE_POSIX_GETTIME)
   SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
 endif()
 
+if(HAVE_BACKTRACE_IN_LIBEXECINFO)
+  SET(SIMGRID_DEP "${SIMGRID_DEP} -lexecinfo")
+endif(HAVE_BACKTRACE_IN_LIBEXECINFO)
+
 # Compute the dependencies of SMPI
 ##################################
 if(enable_smpi AND APPLE)
index 7c3e483..aa9af8c 100644 (file)
@@ -23,29 +23,24 @@ static int running_processes = 0;
 /* Bindings for MPI special values */
 union u_smpi_common {
   struct s_smpi_common {
-    integer mpi_in_place;
-    integer mpi_bottom;
-    integer mpi_status_ignore;
-    integer mpi_statuses_ignore;
-  } f90;                        /* with gftortran */
-  struct s_smpi_common *f77;    /* with f2c */
-} smpi_;
+    integer _MPI_IN_PLACE;
+    integer _MPI_BOTTOM;
+    integer _MPI_STATUS_IGNORE;
+    integer _MPI_STATUSES_IGNORE;
+  } *f77;                       /* with f2c, remains NULL with gfortran */
+  struct s_smpi_common f90;     /* with gftortran */
+} smpi_ = { NULL };
 
 /* Convert between Fortran and C */
-static XBT_INLINE void *f2c_addr(void *addr, void *cval, void *chk1, void *chk2)
-{
-  return (addr == chk1 || addr == chk2) ? cval : addr;
-}
-#define F2C_ADDR(addr, cval, fval) \
-  f2c_addr(addr, cval, &smpi_.f90.fval, &smpi_.f77[smpi_current_rank].fval)
-#define F2C_BOTTOM(addr) \
-  F2C_ADDR(addr, MPI_BOTTOM, mpi_bottom)
-#define F2C_IN_PLACE(addr) \
-  F2C_ADDR(addr, MPI_IN_PLACE, mpi_in_place)
-#define F2C_STATUS_IGNORE(addr) \
-  F2C_ADDR(addr, MPI_STATUS_IGNORE, mpi_status_ignore)
-#define F2C_STATUSES_IGNORE(addr) \
-  F2C_ADDR(addr, MPI_STATUSES_IGNORE, mpi_statuses_ignore)
+#define F2C_ADDR(addr, val)                                             \
+  (((void *)(addr) == (void *)(smpi_.f77                                \
+                               ? &smpi_.f77[smpi_current_rank]._ ## val \
+                               : &smpi_.f90._ ## val))                  \
+   ? (val) : (void *)(addr))
+#define F2C_BOTTOM(addr)          F2C_ADDR(addr, MPI_BOTTOM)
+#define F2C_IN_PLACE(addr)        F2C_ADDR(addr, MPI_IN_PLACE)
+#define F2C_STATUS_IGNORE(addr)   F2C_ADDR(addr, MPI_STATUS_IGNORE)
+#define F2C_STATUSES_IGNORE(addr) F2C_ADDR(addr, MPI_STATUSES_IGNORE)
 
 #define KEY_SIZE (sizeof(int) * 2 + 1)
 
index 9ba0724..90c0d1e 100755 (executable)
@@ -426,10 +426,6 @@ fi
 ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP}
 status=$?
 
-if [ ${status} = 139 ]; then echo "ERROR: A segmentation fault was triggered. 
-A common cause in SimGrid may be the use of a too small stack size for the simulated processes (default 8192 KiB).
-Please see contexts/stack_size parameter , or http://simgrid.org/simgrid/latest/doc/options.html#options_virt_stacksize "; fi
-
 if [ -z "${KEEP}" ] ; then
    if [ -z "${PLATFORM}" ]; then
        rm ${PLATFORMTMP}
index 7984ad0..0073245 100644 (file)
@@ -7,6 +7,7 @@
 /* Redefine the classical malloc/free/realloc functions so that they fit well in the mmalloc framework */
 
 #include "mmprivate.h"
+#include "xbt_modinter.h"
 #include "internal_config.h"
 #include <math.h>
 
index 2182cc4..014b8b8 100644 (file)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/mman.h>
+#include <sys/wait.h>
 
 #include "mmprivate.h"
 
index ec96371..e13e40c 100644 (file)
@@ -4,7 +4,7 @@
 
 ! timeout 20
 p Test allreduce
-$ ../../smpi_script/bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./allreduce_coll 300000 --log=smpi_kernel.thres:warning
+$ ../../smpi_script/bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./allreduce_coll 30000 --log=smpi_kernel.thres:warning
 > You requested to use 16 processes, but there is only 5 processes in your hostfile...
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
index 359d2a5..1029d89 100644 (file)
@@ -43,7 +43,7 @@ $ cd temp_testdir_background
 < }
 $ mkfile delayed_cat.c
 
-$ gcc -Wall -o delayed_cat delayed_cat.c
+$ cc -Wall -o delayed_cat delayed_cat.c
 
 & ./delayed_cat
 > TOTO
index 3efe2c3..ff9c3d5 100644 (file)
@@ -13,7 +13,7 @@ $ cd temp_testdir-bg-set-signal
 < }
 $ mkfile segfault.c
 
-$ gcc -o segfault segfault.c
+$ cc -o segfault segfault.c
 ! expect signal SIGSEGV
 & ./segfault
 $ sleep 1
index ea794f1..f9d21a2 100644 (file)
@@ -12,7 +12,7 @@ $ cd temp_testdir-catch-return
 < }
 $ mkfile return1.c
 
-$ gcc -o return1 return1.c
+$ cc -o return1 return1.c
 
 ! expect return 41
 < $ ./return1
index 5c7b45f..64d37e8 100644 (file)
@@ -13,7 +13,7 @@ $ cd temp_testdir-catch-signal
 < }
 $ mkfile segfault.c
 
-$ gcc -o segfault segfault.c
+$ cc -o segfault segfault.c
 
 ! expect return 15
 < $ ./segfault
index ff0dd17..679234d 100644 (file)
@@ -12,7 +12,7 @@ $ cd temp_testdir-set-return
 < }
 $ mkfile return1.c
 
-$ gcc -o return1 return1.c
+$ cc -o return1 return1.c
 
 ! expect return 1
 $ ./return1
index 43f105e..314b7f0 100644 (file)
@@ -13,7 +13,7 @@ $ cd temp_testdir-set-signal
 < }
 $ mkfile segfault.c
 
-$ gcc -o segfault segfault.c
+$ cc -o segfault segfault.c
 ! expect signal SIGSEGV
 $ ./segfault
 $ cd ..
index 72d5566..632fd8b 100644 (file)
@@ -21,7 +21,7 @@ $ cd temp_testdir-setenv
 < }
 $ mkfile getenv.c
 
-$ gcc -o getenv getenv.c -g
+$ cc -o getenv getenv.c -g
 
 ! setenv tesh_test_toto=blah
 $ ./getenv