--- /dev/null
+#! /usr/bin/perl
+
+use strict;
+
+sub usage {
+ print STDERR <<EOH
+Usage: all2all_make_deployment.pl platform_file.xml nb_host
+
+This script generates a deployment file for the all2all program. It takes
+a SimGrid platform file as first argument and the number of wanted peers as
+second argument. If the amount of peers exceeds the amount of available
+hosts in the deployment file, several peers will be placed on the same host.
+EOH
+ ;
+ die "\n";
+}
+
+my $input = shift @ARGV || usage();
+my $nb_hosts = shift @ARGV || usage();
+
+my @host;
+
+open IN,$input || die "Cannot open $input: $!\n";
+
+while (<IN>) {
+ next unless /<cpu name="([^"]*)"/; # "
+
+ push @host, $1;
+}
+
+# map { print "$_\n" } @host;
+
+die "No host found in $input. Is it really a SimGrid platform file?\nCheck that you didn't pass a deployment file, for example.\n"
+ unless (scalar @host);
+
+#
+# Build the receiver string
+
+my $receivers; # strings containing sender argument describing all receivers.
+
+my $it_host=0; # iterator
+my $it_port=4000; # iterator, in case we have so much processes to add that we must change it
+
+for (my $i=0; $i<$nb_hosts; $i++) {
+ $receivers .= " <argument value=\"$host[$it_host]:$it_port\"/>\n";
+ $it_host ++;
+ if ($it_host == scalar @host) {
+ $it_host=0;
+ $it_port++;
+ }
+}
+
+#
+# and now, really generate the file
+
+print "<?xml version='1.0'?>\n";
+print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
+print "<platform_description>\n\n";
+
+# reset iterators
+$it_port=4000;
+$it_host=0;
+
+for (my $i=0; $i<$nb_hosts; $i++) {
+ print " <process host=\"".$host[$it_host]."\" function=\"sender\">\n";
+ print $receivers;
+ print " </process>\n";
+
+ print " <process host=\"".$host[$it_host]."\" function=\"receiver\">\n";
+ print " <argument value=\"$it_port\"/><argument value=\"$nb_hosts\"/>\n";
+ print " </process>\n\n";
+
+ $it_host ++;
+ if ($it_host == scalar @host) {
+ $it_host=0;
+ $it_port++;
+ }
+}
+
+print "</platform_description>\n";
--- /dev/null
+#! /bin/bash
+
+#
+# USAGE: run.sh plaform nb_host
+#
+# This script takes a platform file and a number of hosts as argument.
+#
+# It generates the right deployment platform and run the experiment,
+# only showing the last line of the run, showing the resulting time.
+
+plat=$1
+nb_host=$2
+set -e
+
+if [ -z $plat -o -z $nb_host ] ; then
+ # invalid argument. Display the comment at the script begining & exit
+ grep '^#\(\([^!]\)\|$\)' $0 | sed 's/# *//' >&2
+ exit 1
+fi
+if ! [ -e $plat ] ; then
+ echo "Platform file not found" >&2
+ exit 1
+fi
+
+echo "Generating the deployment"
+./make_deployment.pl $plat $nb_host > tmp_deployment_$nb_host
+echo "Running the experiment"
+./all2all_simulator $plat tmp_deployment_$nb_host 2>&1 |tee run.log|grep "Congrat"
+rm tmp_deployment_$nb_host