Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #65 from fabienchaix/master
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 27 Feb 2016 16:22:54 +0000 (17:22 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 27 Feb 2016 16:22:54 +0000 (17:22 +0100)
Adding test for concurrency and cleaner concurrency support

1  2 
doc/doxygen/inside_tests.doc
src/surf/network_cm02.cpp
tools/cmake/Tests.cmake

@@@ -18,7 -18,7 +18,7 @@@ in examples/ is used as an integration 
  tests and corner cases integration tests are located in teshsuite/.
  For each integration test, we ensure that the output exactly matches
  the defined expectations. Since SimGrid displays the timestamp of
- every loggued line, this ensures that every change of the models'
+ every logged line, this ensures that every change of the models'
  prediction will be noticed. All these tests should ensure that SimGrid
  is safe to use and to depend on.
  
@@@ -41,17 -41,17 +41,17 @@@ ctest -R msg- -j5 --output-on-failure 
  
  \section inside_tests_rununit Running the unit tests
  
 -All unit tests are packed into the testall binary, that lives in src/.
 -These tests are run when you launch ctest, don't worry.
 +All unit tests are packed into the testall binary, that lives at the
 +source root. These tests are run when you launch ctest, don't worry.
  
  \verbatim
 -make testall                        # Rebuild the test runner on need
 -./src/testall                       # Launch all tests
 -./src/testall --help                # revise how it goes if you forgot
 -./src/testall --tests=-all          # run no test at all (yeah, that's useless)
 -./src/testall --dump-only           # Display all existing test suite
 -./src/testall --tests=-all,+dict    # Only launch the tests from the dict testsuite
 -./src/testall --tests=-all,+foo:bar # run only the bar test from the foo suite.
 +make testall                    # Rebuild the test runner on need
 +./testall                       # Launch all tests
 +./testall --help                # revise how it goes if you forgot
 +./testall --tests=-all          # run no test at all (yeah, that's useless)
 +./testall --dump-only           # Display all existing test suite
 +./testall --tests=-all,+dict    # Only launch the tests from the dict testsuite
 +./testall --tests=-all,+foo:bar # run only the bar test from the foo suite.
  \endverbatim
  
  
@@@ -182,7 -182,7 +182,7 @@@ integration tests. It is distributed wi
  even comes with a man page. TESH ensures that the output produced by a
  command perfectly matches the expected output. This is very precious
  to ensure that no change modifies the timings computed by the models
- without notice.
+ without notice. 
  
  To add a new integration test, you thus have 3 things to do:
  
     examples/ and modify the cmake files as explained on this page:
     \ref inside_cmake_examples. If you feel like you should write a
     torture test that is not interesting to the users (because nobody
-    would sainly write something similar in user code), then put it under 
+    would sanely write something similar in user code), then put it under 
     teshsuite/ somewhere.
+    
   - <b>Write the tesh file</b>, containing the command to run, the
     provided input (if any, but almost no SimGrid test provide such an
     input) and the expected output. Check the tesh man page for more
-    details. \n
+    details.\n
     Tesh is sometimes annoying as you have to ensure that the expected
     output will always be exactly the same. In particular, your should
-    not output machine dependent informations, nor memory adresses as
+    not output machine dependent informations such as absolute data path, nor memory adresses as
     they would change on each run. Several steps can be used here, such
     as the obfucation of the memory adresses unless the verbose logs
     are displayed (using the #XBT_LOG_ISENABLED() macro), or the
     modification of the log formats to hide the timings when they
-    depend on the host machine.
+    depend on the host machine.\n
+    The script located in <project/directory>/tools/cmake/tesh/generate_tesh.sh can
+    help you a lot in particular if the output is large (though a smaller output is preferable). 
+    There are also example tesh files in the <project/directory>/tools/cmake/tesh/ directory, that can be useful to understand the tesh syntax.
+    
   - <b>Add your test in the cmake infrastructure</b>. For that, modify
     the file <project/directory>/tools/cmake/Tests.cmake. Make sure to
     pick a wise name for your test. It is often useful to check a
@@@ -9,7 -9,6 +9,7 @@@
  #include "network_cm02.hpp"
  #include "maxmin_private.hpp"
  #include "simgrid/sg_config.h"
 +#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
  
  XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
  
@@@ -163,7 -162,7 +163,7 @@@ NetworkCm02Model::NetworkCm02Model(
  
    routing_model_create(createLink("__loopback__",
                                  498000000, NULL, 0.000015, NULL,
 -                                1 /*SURF_RESOURCE_ON*/, NULL,
 +                                NULL,
                                  SURF_LINK_FATPIPE, NULL));
  
    if (p_updateMechanism == UM_LAZY) {
  Link* NetworkCm02Model::createLink(const char *name,
      double bw_initial, tmgr_trace_t bw_trace,
      double lat_initial, tmgr_trace_t lat_trace,
 -    int initiallyOn, tmgr_trace_t state_trace,
 +    tmgr_trace_t state_trace,
      e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
  {
    xbt_assert(NULL == Link::byName(name),
               name);
  
    Link* link = new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bw_initial,
 -                     initiallyOn, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
 +                     state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
    Link::onCreation(link);
    return link;
  }
@@@ -419,7 -418,9 +419,9 @@@ Action *NetworkCm02Model::communicate(N
        link = static_cast<NetworkCm02Link*>(_link);
        lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), .05);
      }
-     lmm_variable_concurrency_share_set(action->getVariable(),2);
+     //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
+     //(You would also have to change lmm_element_concurrency())
+     //lmm_variable_concurrency_share_set(action->getVariable(),2);
    }
  
    xbt_dynar_free(&route);
  NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
      lmm_system_t system,
      double constraint_value,
 -    int initiallyOn, tmgr_trace_t state_trace,
 +    tmgr_trace_t state_trace,
      double bw_peak, tmgr_trace_t bw_trace,
      double lat_initial, tmgr_trace_t lat_trace,
      e_surf_link_sharing_policy_t policy)
  : Link(model, name, props, lmm_constraint_new(system, this, constraint_value), state_trace)
  {
 -  if (initiallyOn)
 -    turnOn();
 -  else
 -    turnOff();
 -
    m_bandwidth.scale = 1.0;
    m_bandwidth.peak = bw_peak;
    if (bw_trace)
diff --combined tools/cmake/Tests.cmake
@@@ -157,7 -157,9 +157,9 @@@ IF(NOT enable_memcheck
    ### SURF ###
    # BEGIN TESH TESTS
    ADD_TESH(tesh-surf-lmm                         --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/lmm_usage --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/lmm_usage lmm_usage.tesh)
-   ADD_TESH(tesh-surf-maxmin                      --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/maxmin_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/maxmin_bench maxmin_bench.tesh)
+   ADD_TESH(tesh-surf-maxmin-small                --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/maxmin_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/maxmin_bench maxmin_bench_small.tesh)
+   ADD_TESH(tesh-surf-maxmin-debug                --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/maxmin_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/maxmin_bench maxmin_bench_medium.tesh)
+   ADD_TESH(tesh-surf-maxmin-large                --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/maxmin_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/maxmin_bench maxmin_bench_large.tesh)
    ADD_TESH(tesh-surf-usage                       --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/surf_usage --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/ surf_usage/surf_usage.tesh)
    ADD_TESH(tesh-surf-trace                       --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/surf/trace_usage --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/surf/ trace_usage/trace_usage.tesh)
    # END TESH TESTS
    ELSE()
      ADD_TESH(tesh-xbt-log                          --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/log_usage --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/log_usage log_usage_ndebug.tesh)
    ENDIF()
 -  ADD_TESH(tesh-xbt-graphxml                     --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/graphxml_usage --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/graphxml_usage graphxml_usage.tesh)
    ADD_TESH(tesh-xbt-heap                         --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/heap_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/heap_bench heap_bench.tesh)
    #ADD_TESH(test-xbt-parmap                         --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/parmap_bench --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/parmap_bench parmap_bench.tesh)
    # END TESH TESTS
      FOREACH (ALLREDUCE_COLL_LARGE ompi_ring_segmented)
        ADD_TESH(tesh-smpi-allreduce-coll-large-${ALLREDUCE_COLL_LARGE} --cfg smpi/allreduce:${ALLREDUCE_COLL_LARGE} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/allreduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allreduce allreduce_coll_large.tesh)
      ENDFOREACH()
 +    ADD_TESH(tesh-smpi-allreduce-coll-automatic --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/allreduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allreduce allreduce_coll_automatic.tesh)
      FOREACH (ALLTOALL_COLL 2dmesh 3dmesh pair pair_rma pair_one_barrier pair_light_barrier
                             pair_mpi_barrier rdb ring ring_light_barrier
                             ring_mpi_barrier ring_one_barrier
@@@ -525,7 -527,7 +527,7 @@@ ENDIF(
  
  
    ## OTHER ##
 -ADD_TEST(testall                                 ${CMAKE_BINARY_DIR}/src/testall)
 +ADD_TEST(testall                                 ${CMAKE_BINARY_DIR}/testall)
  
  IF(enable_auto_install)
    ADD_TEST(simgrid_install                       make install)