Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of github.com:mquinson/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 28 Feb 2016 12:02:28 +0000 (13:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 28 Feb 2016 12:02:28 +0000 (13:02 +0100)
1  2 
src/surf/network_cm02.cpp
tools/cmake/Tests.cmake

@@@ -308,32 -308,41 +308,32 @@@ void NetworkCm02Model::updateActionsSta
  Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst,
                                                  double size, double rate)
  {
 -  unsigned int i;
 -  void *_link;
 -  NetworkCm02Link *link;
    int failed = 0;
    NetworkCm02Action *action = NULL;
    double bandwidth_bound;
    double latency = 0.0;
 -  xbt_dynar_t back_route = NULL;
 +  std::vector<Link*> * back_route = NULL;
    int constraints_per_variable = 0;
  
 -  xbt_dynar_t route = xbt_dynar_new(sizeof(NetCard*), NULL);
 +  std::vector<Link*> *route = new std::vector<Link*>();
  
    XBT_IN("(%s,%s,%g,%g)", src->name(), dst->name(), size, rate);
  
 -  routing_platf->getRouteAndLatency(src, dst, &route, &latency);
 -  xbt_assert(!xbt_dynar_is_empty(route) || latency,
 +  routing_platf->getRouteAndLatency(src, dst, route, &latency);
 +  xbt_assert(! route->empty() || latency,
               "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
               src->name(), dst->name());
  
 -  xbt_dynar_foreach(route, i, _link) {
 -  link = static_cast<NetworkCm02Link*>(_link);
 -    if (link->isOff()) {
 +  for (auto link: *route)
 +    if (link->isOff())
        failed = 1;
 -      break;
 -    }
 -  }
 +
    if (sg_network_crosstraffic == 1) {
 -    routing_platf->getRouteAndLatency(dst, src, &back_route, NULL);
 -    xbt_dynar_foreach(back_route, i, _link) {
 -      link = static_cast<NetworkCm02Link*>(_link);
 -      if (link->isOff()) {
 +    back_route = new std::vector<Link*>();
 +    routing_platf->getRouteAndLatency(dst, src, back_route, NULL);
 +    for (auto link: *back_route)
 +      if (link->isOff())
          failed = 1;
 -        break;
 -      }
 -    }
    }
  
    action = new NetworkCm02Action(this, size, failed);
    }
  
    bandwidth_bound = -1.0;
 -  if (sg_weight_S_parameter > 0) {
 -    xbt_dynar_foreach(route, i, _link) {
 -      link = static_cast<NetworkCm02Link*>(_link);
 +  if (sg_weight_S_parameter > 0)
 +    for (auto link : *route)
        action->m_weight += sg_weight_S_parameter / link->getBandwidth();
 -    }
 -  }
 -  xbt_dynar_foreach(route, i, _link) {
 -    link = static_cast<NetworkCm02Link*>(_link);
 +
 +  for (auto link : *route) {
      double bb = bandwidthFactor(size) * link->getBandwidth();
 -    bandwidth_bound =
 -        (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
 +    bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
    }
  
    action->m_latCurrent = action->m_latency;
    action->m_latency *= latencyFactor(size);
    action->m_rate = bandwidthConstraint(action->m_rate, bandwidth_bound, size);
    if (m_haveGap) {
 -    xbt_assert(!xbt_dynar_is_empty(route),
 +    xbt_assert(! route->empty(),
                 "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
  
 -    link = *static_cast<NetworkCm02Link **>(xbt_dynar_get_ptr(route, 0));
 -    gapAppend(size, link, action);
 -    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)",
 -              action, src->name(), dst->name(), action->m_senderGap,
 -              action->m_latency);
 +    gapAppend(size, route->at(0), action);
 +    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->name(), dst->name(), action->m_senderGap, action->m_latency);
    }
  
 -  constraints_per_variable = xbt_dynar_length(route);
 +  constraints_per_variable = route->size();
    if (back_route != NULL)
 -    constraints_per_variable += xbt_dynar_length(back_route);
 +    constraints_per_variable += back_route->size();
  
    if (action->m_latency > 0) {
      action->p_variable = lmm_variable_new(p_maxminSystem, action, 0.0, -1.0,
                           constraints_per_variable);
      if (p_updateMechanism == UM_LAZY) {
        // add to the heap the event when the latency is payed
 -      XBT_DEBUG("Added action (%p) one latency event at date %f", action,
 -                action->m_latency + action->m_lastUpdate);
 -      action->heapInsert(p_actionHeap, action->m_latency + action->m_lastUpdate, xbt_dynar_is_empty(route) ? NORMAL : LATENCY);
 +      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->m_latency + action->m_lastUpdate);
 +      action->heapInsert(p_actionHeap, action->m_latency + action->m_lastUpdate, route->empty() ? NORMAL : LATENCY);
      }
    } else
      action->p_variable = lmm_variable_new(p_maxminSystem, action, 1.0, -1.0, constraints_per_variable);
      lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
    }
  
 -  xbt_dynar_foreach(route, i, _link) {
 -    link = static_cast<NetworkCm02Link*>(_link);
 +  for (auto link: *route)
      lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), 1.0);
 -  }
  
    if (sg_network_crosstraffic == 1) {
      XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
 -    xbt_dynar_foreach(back_route, i, _link) {
 -      link = static_cast<NetworkCm02Link*>(_link);
 +    for (auto link : *back_route)
        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);
 +  delete route;
    XBT_OUT();
  
    networkCommunicateCallbacks(action, src, dst, size, rate);
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
      ENDIF()
      # smpi broken usage
      ADD_TESH_FACTORIES(tesh-smpi-broken          "thread"              --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong broken_hostfiles.tesh)
 -    # https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
 -    ADD_TESH_FACTORIES(tesh-smpi-bug-17132       "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.tesh)
 -    IF(enable_debug)
 -      ADD_TESH_FACTORIES(tesh-smpi-bug-17132-surf-debug "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132-surf-debug.tesh)
 -    ENDIF()
      ADD_TESH(tesh-smpi-replay-ti-tracing       --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong TI_output.tesh)
      FOREACH (GATHER_COLL default ompi mpich ompi_basic_linear ompi_linear_sync ompi_binomial mvapich2 mvapich2_two_level impi)
        ADD_TESH(tesh-smpi-gather-coll-${GATHER_COLL} --cfg smpi/gather:${GATHER_COLL} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/gather --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/gather gather_coll.tesh)