From: Aberrahmane Sider <ar.sider@univ-bejaia.dz>
Date: Sun, 24 Apr 2011 19:32:34 +0000 (+0100)
Subject: Merge branch 'master' of ssh://info.iut-bm.univ-fcomte.fr/loba
X-Git-Tag: v0.1~68
X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/7b62c7947835062683a092b95e52ca2a560a14e8?hp=3747a1927b03ebc8f22c0772f83a857a0bf3b811

Merge branch 'master' of ssh://info.iut-bm.univ-fcomte.fr/loba
---

diff --git a/.gitignore b/.gitignore
index d9a87ed..2bd8a79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,11 +13,8 @@ localversion
 loba
 loba-dev
 loba-stable
-simple_async
-
-*_dev.xml
 
 simgrid-dev
 simgrid-git
 simgrid-stable
-*/
+
diff --git a/ALGORITHMS b/ALGORITHMS
index 4a9b03c..e9f07fa 100644
--- a/ALGORITHMS
+++ b/ALGORITHMS
@@ -5,7 +5,7 @@ besteffort
 Ordonne les voisins du moins chargé au plus chargé.
 Trouve ensuite, en les prenant dans ce ordre, le nombre maximal de
 voisins tels que tous ont une charge inférieure à la moyenne des
-charges des voisins sélectionnes, et de soi-même.
+charges des voisins sélectionnés, et de soi-même.
 
 Les transferts de charge sont ensuite fait en visant cette moyenne pour
 tous les voisins sélectionnés.  On envoie une quantité de charge égale
diff --git a/BUGS b/BUGS
index 5c3d352..17da8da 100644
--- a/BUGS
+++ b/BUGS
@@ -25,7 +25,7 @@ $ ./loba-dev platform_dev.xml -Tline -abest -L500 -t1800 -c1e8,0 -C1e7,0 -M0 2>&
 [Ginette 1932.076243] [comm/DEBUG] received LOAD: 282.074 from Fafard
 [Ginette 1940.343540] [comm/DEBUG] received LOAD: 6.19507 from Fafard
 
-Par un bug dans SG 3.5 ?
+Probablement par un bug dans SG 3.5.
 
 ========================================================================
 Il semblerait qu'il y ait un bug dans SG 3.5, et qu'on ne puisse pas
@@ -44,3 +44,27 @@ Le problème devrait être contourné correctement depuis le commit
 404a8d5 Do not call flush automatically in communcator::send...
 
 ========================================================================
+Valgrind détecte une fuite de mémoire liée à un appel à backtrace.
+
+Le problème semble être indépendant de SimGrid et peut être reproduit
+avec le code suivant (NB: l'équivalent, compilé avec gcc ne génère pas
+d'erreur).
+,----
+| #include <execinfo.h>
+| #include <iostream>
+| int main()
+| {
+|     void *buffer[64];
+|     int size = -1;
+|     size = backtrace(buffer, sizeof buffer / sizeof buffer[0]);
+|     std::cerr << "backtrace() returned " << size << "\n";
+| }
+`----
+==532== HEAP SUMMARY:
+==532==     in use at exit: 56 bytes in 1 blocks
+==532==     ...
+==532== LEAK SUMMARY:
+==532==    ...
+==532==    still reachable: 56 bytes in 1 blocks
+
+========================================================================
diff --git a/Experimentations/run-all b/Experimentations/run-all
new file mode 100755
index 0000000..60bfa07
--- /dev/null
+++ b/Experimentations/run-all
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+set -e
+#set -x
+
+usage() {
+    cat >&2 <<EOF
+Usage: $0 [-c] <parameters file>
+Options:
+    -h  print this help
+    -n  dry-run mode (for debugging)
+    -c  (continue) do not overwrite previous results
+EOF
+    exit $1
+}
+
+log() {
+    echo "-#- $@" >&2
+}
+
+die() {
+    echo "ERROR: $@" >&2
+    exit 2
+}
+
+variable_check() {
+    eval test -n "\${$1}" || die "undefined $1"
+}
+
+array_check() {
+    eval test "\${#$1}" -gt 0 || die "undefined $1"
+}
+
+# read args
+overwrite=1
+debug=0
+while getopts "chn" c; do
+    case "$c" in
+        'c') overwrite=0 ;;
+        'h') usage 0 ;;
+        'n') debug=1 ;;
+        '?') usage 1 ;;
+    esac
+done
+shift $((OPTIND - 1))
+[ $# -eq 1 ] || usage 1
+parameters="$1"
+
+log "Running: $0 $@"
+log "Hostname: $(hostname -f)"
+
+declare -a TOPOLOGIES ALGORITHMS PLATFORMS COMMON_OPTS
+
+# read parameters
+log "Reading parameters from \"$1\"."
+source "$parameters" || die "cannot read parameters file: \"$parameters\""
+
+array_check TOPOLOGIES
+array_check ALGORITHMS
+array_check PLATFORMS
+variable_check NHOSTS
+variable_check LOAD
+variable_check DEADLINE
+
+# default values
+: ${RESULTS:=$PWD/results}
+: ${LOBA:=$PWD/loba}
+
+COMMON_OPTS=(
+    --cfg=contexts/factory:raw
+)
+
+log "Results put in: \"$RESULTS\"."
+
+[ $debug = 1 ] && log "Running in dry-run mode"
+
+outfile() {
+    echo "$*" | sed 's,[^ ]*/,,g;s/\.xml//;y/ /_/'
+}
+
+for plat in "${PLATFORMS[@]}"; do
+    tmp=$(basename "$plat" ".xml")
+    plat_output="$RESULTS/plat_$tmp"
+    for topo in "${TOPOLOGIES[@]}"; do
+        topo_output="$plat_output/topo_$topo"
+        for algo in "${ALGORITHMS[@]}"; do
+            algo_output="$topo_output/algo_$algo"
+            [ $debug = 0 ] && mkdir -p "$algo_output"
+            args=(
+                -T"$topo"
+                -a"$algo"
+                -N"$NHOSTS"
+                -L"$LOAD"
+                -t"$DEADLINE"
+                "$plat"
+            )
+            for bk in "" "-b"; do
+                tmp=$(outfile "loba" $bk "${args[@]}")
+                out="$algo_output/$tmp.out"
+                cmd=( "$LOBA" "${COMMON_OPTS[@]}" $bk "${args[@]}" )
+                log "Run: ${cmd[@]}"$'\n'"... &> $out"
+                if [ $overwrite = 0 -a -e "$out" ]; then
+                    log "already run !"
+                    tail -n4 "$out"
+                    continue
+                fi
+                if [ $debug = 1 ]; then
+                    log "skipped (dry-run)"
+                else
+                    echo "# ${cmd[@]}" > "$out"
+                    "${cmd[@]}" >> "$out" 2>&1
+                    tail -n4 "$out"
+                fi
+            done
+        done
+    done
+done
diff --git a/Experimentations/sample_parameters b/Experimentations/sample_parameters
new file mode 100644
index 0000000..f4d740d
--- /dev/null
+++ b/Experimentations/sample_parameters
@@ -0,0 +1,38 @@
+
+# define the topologies
+TOPOLOGIES=(
+    btree
+    clique
+    hcube
+    line
+    ring
+    star
+    torus
+)
+
+# define the algorithms
+ALGORITHMS=(
+    besteffort
+    makhoul
+    simple
+)
+
+# the different platform files
+PLATFORMS=(
+    ../platform.xml
+)
+
+# number of hosts
+NHOSTS=0
+
+# total load
+LOAD=1000
+
+# time limit for the simulation
+DEADLINE=10000
+
+# optional: path to binary (default: ./loba)
+#LOBA=./loba
+
+# optional: path to results (default: ./results)
+#RESULTS=./results
diff --git a/NOTES b/NOTES
index 12f082b..5399a4c 100644
--- a/NOTES
+++ b/NOTES
@@ -69,5 +69,5 @@ process::expected_load          Current load estimation.
                                 diffusing to neighbors.
                                 * Without bookkeeping, it equals real_load
                                   minus pending sends.
-                                * With bookkeeping, it corresponds to the "virtual
-                                  load".
+                                * With bookkeeping, it corresponds to the
+                                  "virtual load".
diff --git a/neighbor.cpp b/neighbor.cpp
index 266f516..be80664 100644
--- a/neighbor.cpp
+++ b/neighbor.cpp
@@ -8,7 +8,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(proc); // needed to compile neighbor.h
 #include "neighbor.h"
 
 neighbor::neighbor(const char* hostname)
-    : host(static_cast<hostdata*>(MSG_host_get_data(MSG_get_host_by_name(hostname))))
+    : host(static_cast<hostdata*>
+           (MSG_host_get_data(MSG_get_host_by_name(hostname))))
     , load(std::numeric_limits<double>::infinity())
     , debt(0.0)
     , to_send(0.0)
diff --git a/valgrind_suppressions b/valgrind_suppressions
index a7c0e9e..8c54c73 100644
--- a/valgrind_suppressions
+++ b/valgrind_suppressions
@@ -1,5 +1,5 @@
 {
-   Memory leak in libc?
+   Memory leak in glibc/backtrace
    Memcheck:Leak
    fun:malloc
    fun:_dl_map_object_deps
@@ -11,6 +11,7 @@
    fun:dlerror_run
    fun:__libc_dlopen_mode
    fun:init
-   fun:pthread_once
-   fun:backtrace
+   ...
+   fun:*backtrace*
+   ...
 }