Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 27 May 2016 13:42:10 +0000 (15:42 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 27 May 2016 13:42:10 +0000 (15:42 +0200)
18 files changed:
doc/doxygen/inside_tests.doc
examples/smpi/CMakeLists.txt
examples/smpi/trace_call_location/smpi_trace_call_location [new file with mode: 0755]
examples/smpi/trace_call_location/trace_call_location.c [new file with mode: 0644]
examples/smpi/trace_call_location/trace_call_location.tesh [new file with mode: 0644]
include/smpi/smpi_extended_traces.h
sonar-project.properties
src/simix/ContextRaw.cpp
src/simix/ContextThread.hpp
src/simix/ContextUnix.cpp
src/simix/SynchroComm.hpp
src/simix/SynchroExec.hpp
src/simix/SynchroRaw.hpp
src/smpi/smpi_pmpi.cpp
src/smpi/smpicc.in
tools/cmake/GCCFlags.cmake
tools/internal/travis-sonarqube.sh
tools/smpi/generate_smpi_defines.pl

index 915ae64..9b0cc77 100644 (file)
@@ -322,4 +322,7 @@ open-source project can use it at no cost. That is what we are doing.
 Don't miss the great looking dashboard here: 
 https://nemo.sonarqube.org/overview?id=simgrid
 
+This tool is enriched by the script @c tools/internal/travis-sonarqube.sh 
+that is run from @c .travis.yml
+
 */
index c35eb8f..b8d676d 100644 (file)
@@ -8,20 +8,22 @@ if(enable_smpi)
 
   file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mc/")
 
-  foreach(x bcbench mvmul replay trace trace_simple energy)
+  foreach(x bcbench mvmul replay trace trace_simple trace_call_location energy)
     add_executable       (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
     target_link_libraries(smpi_${x} simgrid)
     set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
     set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
   endforeach()
 
+  set_target_properties(smpi_trace_call_location PROPERTIES COMPILE_FLAGS "-trace-call-location")
+
   foreach(x bugged1 bugged2 bugged1_liveness only_send_deterministic mutual_exclusion non_termination1 
             non_termination2 non_termination3 non_termination4)
     if(HAVE_MC)
       add_executable       (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/mc/${x}.c)
       target_link_libraries(smpi_${x} simgrid)
       set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mc)
-     endif()
+    endif()
     set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/mc/${x}.c)
   endforeach()
 endif()
@@ -30,6 +32,7 @@ set(examples_src  ${examples_src}
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/energy/energy.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace/trace.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_simple/trace_simple.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/trace_call_location/trace_call_location.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/replay/replay.tesh                          PARENT_SCOPE)
 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
                                    ${CMAKE_CURRENT_SOURCE_DIR}/energy/hostfile
@@ -62,6 +65,7 @@ if(enable_smpi)
 
   ADD_TESH(smpi-tracing        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace/trace.tesh)
   ADD_TESH(smpi-tracing-simple --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_simple/trace_simple.tesh)
+  ADD_TESH(smpi-tracing-call-location --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_call_location/trace_call_location.tesh)
   ADD_TESH(smpi-replay         --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/replay.tesh)
   ADD_TESH_FACTORIES(smpi-energy "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
 endif()
diff --git a/examples/smpi/trace_call_location/smpi_trace_call_location b/examples/smpi/trace_call_location/smpi_trace_call_location
new file mode 100755 (executable)
index 0000000..9ddb4ef
Binary files /dev/null and b/examples/smpi/trace_call_location/smpi_trace_call_location differ
diff --git a/examples/smpi/trace_call_location/trace_call_location.c b/examples/smpi/trace_call_location/trace_call_location.c
new file mode 100644 (file)
index 0000000..0491db5
--- /dev/null
@@ -0,0 +1,17 @@
+/* Copyright (c) 2012, 2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <mpi.h>
+
+/* test*/
+int main(int argc, char *argv[])
+{
+  MPI_Init(&argc, &argv);
+  MPI_Barrier (MPI_COMM_WORLD);
+  MPI_Finalize();
+  return 0;
+}
diff --git a/examples/smpi/trace_call_location/trace_call_location.tesh b/examples/smpi/trace_call_location/trace_call_location.tesh
new file mode 100644 (file)
index 0000000..0d23db6
--- /dev/null
@@ -0,0 +1,18 @@
+# use the tested library, not the installed one
+# (since we want to pass it to the child, it has to be redefined before each command)
+# Go for the first test
+
+p Test SMPI with call-location tracing. This means that the binary must have
+p already been compiled with the -trace-call-location switch.
+$ ../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ./trace_call_location/smpi_trace_call_location --log=smpi_kernel.thres:warning 
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'smpi_trace.trace'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/smpi' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'surf/precision' to '1e-9'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP-gamma' to '4194304'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/trace-call-location' to '1'
+
+$ grep --quiet "12 0.000000 2 1 5 .*trace_call_location\.c\" 14$" smpi_trace.trace 
+
+$ rm -f smpi_trace.trace 
index c856e41..f5dd7e5 100644 (file)
@@ -1,7 +1,7 @@
 // This file has been automatically generated by the script
 // in tools/smpi/./generate_smpi_defines.pl
 // DO NOT EDIT MANUALLY. ALL CHANGES WILL BE OVERWRITTEN!
-#define MPI_Init(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(__VA_ARGS__); })
+#define MPI_Init(...) ({ smpi_process_init(__VA_ARGS__); smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(NULL, NULL); })
 #define MPI_Finalize(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Finalize(__VA_ARGS__); })
 #define MPI_Finalized(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Finalized(__VA_ARGS__); })
 #define MPI_Init_thread(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init_thread(__VA_ARGS__); })
index a893088..a43fc78 100644 (file)
@@ -11,10 +11,10 @@ sonar.links.issue=http://github.com/simgrid/simgrid/issues
 # Comma-separated paths to directories with sources (required)
 sonar.sources=src,examples,include,teshsuite
 
-# Exclude out unit tests from the analysis
-sonar.exclusions=src/*_unit.c,src/*_unit.cpp
-# Exclude the tests that we borrowed elsewhere
-sonar.exclusions=teshsuite/smpi/mpich3-test/*,teshsuite/smpi/isp/*
+# Exclude some files from the analysis:
+#  - our unit tests 
+#  - the tests that we borrowed elsewhere (MPICH and ISP)
+sonar.exclusions=src/*_unit.c*,teshsuite/smpi/mpich3-test/*,teshsuite/smpi/isp/*
 
 # The build-wrapper output dir
 sonar.cfamily.build-wrapper-output=bw-outputs
index b9bd0fe..10330cb 100644 (file)
@@ -43,7 +43,7 @@ public:
   RawContext(std::function<void()> code,
           void_pfn_smxprocess_t cleanup_func,
           smx_process_t process);
-  ~RawContext();
+  ~RawContext() override;
 public:
   static void wrapper(void* arg);
   void stop() override;
@@ -59,7 +59,7 @@ private:
 class RawContextFactory : public ContextFactory {
 public:
   RawContextFactory();
-  ~RawContextFactory();
+  ~RawContextFactory() override;
   RawContext* create_context(std::function<void()> code,
     void_pfn_smxprocess_t, smx_process_t process) override;
   void run_all() override;
index abed187..77923bf 100644 (file)
@@ -24,7 +24,7 @@ public:
   ThreadContext(std::function<void()> code,
           void_pfn_smxprocess_t cleanup_func,
           smx_process_t process, bool maestro =false);
-  ~ThreadContext();
+  ~ThreadContext() override;
   void stop() override;
   void suspend() override;
   void attach_start() override;
@@ -46,8 +46,8 @@ public:
 class ThreadContextFactory : public ContextFactory {
 public:
   ThreadContextFactory();
-  ~ThreadContextFactory();
-  virtual ThreadContext* create_context(std::function<void()> code,
+  ~ThreadContextFactory() override;
+  ThreadContext* create_context(std::function<void()> code,
     void_pfn_smxprocess_t cleanup_func,  smx_process_t process) override;
   void run_all() override;
   ThreadContext* self() override;
index 3d9e4bb..ebdd9b0 100644 (file)
@@ -82,7 +82,7 @@ public:
   friend UContextFactory;
   UContext(std::function<void()>  code,
     void_pfn_smxprocess_t cleanup_func, smx_process_t process);
-  ~UContext();
+  ~UContext() override;
 };
 
 class SerialUContext : public UContext {
@@ -114,8 +114,8 @@ public:
   friend ParallelUContext;
 
   UContextFactory();
-  virtual ~UContextFactory();
-  virtual Context* create_context(std::function<void()> code,
+  ~UContextFactory() override;
+  Context* create_context(std::function<void()> code,
     void_pfn_smxprocess_t, smx_process_t process) override;
   void run_all() override;
 };
index d2c549b..cd02960 100644 (file)
@@ -20,7 +20,7 @@ namespace simgrid {
 namespace simix {
 
   XBT_PUBLIC_CLASS Comm : public Synchro {
-    ~Comm();
+    ~Comm() override;
   public:
     Comm(e_smx_comm_type_t type);
     void suspend() override;
index 58951ce..b771a39 100644 (file)
@@ -13,7 +13,7 @@ namespace simgrid {
 namespace simix {
 
   XBT_PUBLIC_CLASS Exec : public Synchro {
-    ~Exec();
+    ~Exec() override;
   public:
     Exec(const char*name, sg_host_t host);
     void suspend() override;
index 7086bd3..2b62f87 100644 (file)
@@ -15,7 +15,7 @@ namespace simix {
   /** Used to implement mutexes, semaphores and conditions */
   XBT_PUBLIC_CLASS Raw : public Synchro {
   public:
-    ~Raw();
+    ~Raw() override;
     void suspend() override;
     void resume() override;
     void post() override;
index 729c51a..4d87717 100644 (file)
@@ -27,7 +27,7 @@ int PMPI_Init(int *argc, char ***argv)
   // PMPI_Init is call only one time by only by SMPI process
   int already_init;
   MPI_Initialized(&already_init);
-  if(!(already_init)){
+  if(already_init == 0){
     smpi_process_init(argc, argv);
     smpi_process_mark_as_initialized();
     int rank = smpi_process_index();
index d664bbf..33b1391 100755 (executable)
@@ -52,7 +52,7 @@ while [ $# -gt 0 ]; do
             exit 0
             ;;
         '-trace-call-location')
-            list_add_not_empty CMDLINE "-DTRACE_CALL_LOCATION"
+            list_add_not_empty CMDARGS "-DTRACE_CALL_LOCATION"
             ;;
         '-compiler-version' | '--compiler-version')
             ${CC} --version
index 5f1be60..077e85a 100644 (file)
@@ -11,7 +11,7 @@
 
 set(warnCFLAGS "")
 set(optCFLAGS "")
-
+set(warnCXXFLAGS "")
 
 if(enable_compile_warnings)
   set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
@@ -19,12 +19,12 @@ if(enable_compile_warnings)
     set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs -Wno-error=attributes")
   endif()
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment  -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
+  set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment  -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
   if(CMAKE_COMPILER_IS_GNUCXX)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs -Wno-error=attributes")
+    set(warnCXXFLAGS "${warnCXXFLAGS} -Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs -Wno-error=attributes")
   endif()
   if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # don't care about class that become struct
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
+    set(warnCXXFLAGS "${warnCXXFLAGS} -Wno-mismatched-tags")
   endif()
 
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall")
@@ -129,8 +129,8 @@ if(NOT enable_debug)
   set(CMAKE_CXX_FLAGS "-DNDEBUG ${CMAKE_CXX_FLAGS}")
 endif()
 
-set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   ${optCFLAGS} ${warnCFLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${optCFLAGS}")
+set(CMAKE_C_FLAGS   "${warnCFLAGS} ${CMAKE_C_FLAGS}   ${optCFLAGS}")
+set(CMAKE_CXX_FLAGS "${warnCXXFLAGS} ${CMAKE_CXX_FLAGS} ${optCFLAGS}")
 
 # Try to make Mac a bit more complient to open source standards
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
index e19f120..3bdf700 100755 (executable)
@@ -21,9 +21,10 @@ installSonarQubeScanner
 installBuildWrapper
 
 # triggers the compilation through the build wrapper to gather compilation database
-# We need to clean the build that was used for the tests before to ensure that everything gets rebuilt:
-#   sonarqube only use what's built throught its wrappers
+# We need to clean the build that was used for the tests before to ensure that everything gets rebuilt (sonarqube only use what's built throught its wrappers)
+# Plus, we need to activate MC so that it does not get throught the quality net :)
 make clean
+cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=ON -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF .
 ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make all
 
 # and finally execute the actual SonarQube analysis (the SONAR_TOKEN is set from the travis web interface, to not expose it)
index a719771..1306f45 100755 (executable)
@@ -40,7 +40,12 @@ sub output_macro {
     print "#define ". uc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". lc $id ."\n";
   }
   else {
-    print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n";
+    if ($id eq "MPI_Init") {
+      print "#define MPI_Init(...) ({ smpi_process_init(__VA_ARGS__); smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(NULL, NULL); })\n";
+    }
+    else {
+      print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n";
+    }
   }
 }