From: mquinson Date: Thu, 23 Jun 2005 21:57:37 +0000 (+0000) Subject: clean(?) reimport X-Git-Tag: v3.3~3936 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f1c4b3ead099df97f5dff00f22d5cbfbf3d32ec1 clean(?) reimport git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1419 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/amok/alnem/.cvsignore b/examples/amok/alnem/.cvsignore new file mode 100644 index 0000000000..6ed4f5d8e1 --- /dev/null +++ b/examples/amok/alnem/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in _*.c alnem_builder alnem_maestro alnem_sensor alnem_simulator diff --git a/examples/amok/alnem/Makefile.am b/examples/amok/alnem/Makefile.am new file mode 100644 index 0000000000..694b0f62c2 --- /dev/null +++ b/examples/amok/alnem/Makefile.am @@ -0,0 +1,27 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include +#-I../../src -I../../nws_portability/Include @CFLAGS_SimGrid@ +AM_CFLAGS=-g + +check_PROGRAMS=alnem_simulator alnem_sensor alnem_maestro + +alnem_simulator_SOURCES= _alnem_simulator.c alnem.c +alnem_sensor_SOURCES= _alnem_sensor.c alnem.c +alnem_maestro_SOURCES= _alnem_maestro.c alnem.c + + +alnem_simulator_LDADD= $(top_srcdir)/src/base/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ +alnem_sensor_LDADD= $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ +alnem_maestro_LDADD= $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ + +bin_PROGRAMS=alnem_builder +alnem_builder_LDADD= @LIBS_SimGrid@ + +# Take care of generatated sources +NAME=alnem +PROCESSES=sensor maestro +include $(top_srcdir)/examples/temps-gras-stub.mk + + + + diff --git a/examples/amok/alnem/alnem.c b/examples/amok/alnem/alnem.c new file mode 100644 index 0000000000..939cfd7444 --- /dev/null +++ b/examples/amok/alnem/alnem.c @@ -0,0 +1,217 @@ +/* $Id$ */ + +/* ALNeM itself */ + +/* Copyright (c) 2003 Martin Quinson. 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 +#include +#include +#include + +#include + +#include /* alvin's graph toolbox (+ reconstruction algorithm) */ + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} sensor_data_t; + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + xbt_error_t errcode; + sensor_data_t *g=gras_userdata_new(sensor_data_t); + + if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { + fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",xbt_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + while (1) { + if ((errcode=gras_msg_handle(3600.0)) && errcode != timeout_error) { + fprintf(stderr,"Sensor: Error '%s' while handling message\n", + xbt_error_name(errcode)); + } + } + + gras_sleep(5,0); + return gras_sock_close(g->sock); +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); + +#define MAXHOSTS 100 + +#define INTERF(graph,table,a,u,b,v) INTERFERENCE(table,\ + TBX_Graph_nodeSearch(graph,a),\ + TBX_Graph_nodeSearch(graph,u),\ + TBX_Graph_nodeSearch(graph,b),\ + TBX_Graph_nodeSearch(graph,v)) + +int maestro(int argc,char *argv[]) { + int bufSize=32 * 1024; + int expSize= 1024 * 1024; + int msgSize=expSize; + int satSize=msgSize * 100; + double dummy,beginSim; + xbt_error_t errcode; + maestro_data_t *g=gras_userdata_new(maestro_data_t); + + double bw[MAXHOSTS][MAXHOSTS]; + double bw_sat[MAXHOSTS][MAXHOSTS]; + + int a,b,c,d,begin; + + TBX_Graph_t graph = TBX_Graph_newGraph("Essai",0,NULL); /* a dummy graph containing all hosts */ + TBX_FIFO_t host_fifo = TBX_FIFO_newFIFO(); + TBX_InterfTable_t interf = NULL; /* the measured interferences */ + TBX_Graph_t builded_graph = NULL; /* the graph builded from the interferences */ + + /* basics setups */ + if (argc>MAXHOSTS) { + fprintf(stderr,"You gave more than %d sensors for this experiment. Increase the MAX HOSTS constant in alnem code to be bigger than this number.\n",argc); + return 1; + } + + if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { + fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",xbt_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + for (a=1; a %f (%f vs %f)%s\n", + gras_time(), + argv[c],argv[d],argv[a],argv[b], + bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d], + + (bw_sat[c][d]/bw[c][d] < 0.75) ? " THERE IS SOME INTERFERENCE !!!":""); + INTERF(graph,interf,argv[c],argv[d],argv[a],argv[b])= + (bw_sat[c][d]/bw[c][d] < 0.75) ? 1 : 0; + } + } + + if ((errcode=grasbw_saturate_stop(argv[a],4000,argv[b],4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + xbt_error_name(errcode)); + return -1; + } + fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n", + time(NULL)-begin, gras_time()-beginSim); + } + } + + /* reconstruct the graph */ + TBX_Graph_interferenceTableDump(interf); + TBX_Graph_interferenceTableSave(interf,"interference.dat"); + begin=time(NULL); + fprintf(stderr, "MAESTRO: Reconstruct the graph... "); + builded_graph = TBX_Graph_exploreInterference(interf); + TBX_Graph_exportToGraphViz(builded_graph, "toto.dot"); + fprintf(stderr, "done (took %d sec)",(int)time(NULL)); + + /* end */ + TBX_Graph_freeGraph(graph,NULL,NULL,NULL); + TBX_Graph_freeGraph(builded_graph,NULL,NULL,NULL); + TBX_Graph_freeInterfTable(interf); + + gras_sleep(5,0); + exit(0); /* FIXME: There is a bug in MSG preventing me from terminating this server properly */ + return gras_sock_close(g->sock); +} diff --git a/examples/amok/alnem/alnem_builder.c b/examples/amok/alnem/alnem_builder.c new file mode 100644 index 0000000000..6a4b82501a --- /dev/null +++ b/examples/amok/alnem/alnem_builder.c @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* ALNeM builder. Take an interference matrix as argument, */ +/* and reconstruct the corresponding graph itself */ + +/* Copyright (c) 2003 Martin Quinson. 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 +#include + +#include /* alvin's graph toolbox (+ reconstruction algorithm) */ + +int main(int argc,char *argv[]) { + TBX_Graph_t graph; /* a dummy graph containing all hosts */ + TBX_FIFO_t host_fifo; + TBX_InterfTable_t interf; /* the measured interferences */ + TBX_Graph_t builded_graph; /* the graph builded from the interferences */ + + if (argc != 2) { + fprintf(stderr,"alnem_builder: USAGE:\n"); + fprintf(stderr," alnem_builder interference_file\n"); + exit (1); + } + + if (TBX_Graph_interferenceTableRead (argv[1],&graph,&interf,&host_fifo)) { + fprintf(stderr,"Can't read the interference data, aborting\n"); + exit (1); + } + + builded_graph = TBX_Graph_exploreInterference(interf); + TBX_Graph_exportToGraphViz(builded_graph, "toto.dot"); + return 0; +} diff --git a/examples/amok/alnem/alnem_deployment.txt b/examples/amok/alnem/alnem_deployment.txt new file mode 100644 index 0000000000..963935a901 --- /dev/null +++ b/examples/amok/alnem/alnem_deployment.txt @@ -0,0 +1,5 @@ +A sensor +B sensor +C sensor +D sensor +Master maestro A B C D diff --git a/examples/amok/alnem/deploy_WAN3.txt b/examples/amok/alnem/deploy_WAN3.txt new file mode 100644 index 0000000000..6a88ba61ac --- /dev/null +++ b/examples/amok/alnem/deploy_WAN3.txt @@ -0,0 +1,34 @@ +61 sensor +62 sensor +63 sensor +69 sensor +70 sensor +77 sensor +81 sensor +83 sensor +85 sensor +87 sensor +88 sensor +95 sensor +98 sensor +107 sensor +109 sensor +111 sensor +112 sensor +121 sensor +124 sensor +125 sensor +131 sensor +145 sensor +150 sensor +156 sensor +157 sensor +162 sensor +165 sensor +168 sensor +169 sensor +170 sensor +175 sensor +177 sensor +178 sensor +109 maestro 61 62 63 69 70 77 81 83 85 98 107 109 111 112 121 124 125 131 145 150 156 157 162 165 168 169 170 175 177 178 diff --git a/examples/amok/alnem/interference.dat b/examples/amok/alnem/interference.dat new file mode 100644 index 0000000000..c2fdc05c83 --- /dev/null +++ b/examples/amok/alnem/interference.dat @@ -0,0 +1,30 @@ +INTERFERENCE GRAPH DUMPED TO FILE. DO NOT EDIT, EVEN TO ADD OR REMOVE A SPACE !! +4 +A +B +C +D +1 1 +1 1 +1 0 +1 1 +1 0 +1 1 +1 1 +1 1 +1 0 +1 1 +1 0 +1 1 +1 1 +0 1 +1 1 +0 1 +1 1 +1 1 +1 1 +0 1 +1 1 +0 1 +1 1 +1 1 diff --git a/examples/amok/bandwidth/.cvsignore b/examples/amok/bandwidth/.cvsignore new file mode 100644 index 0000000000..2d53770067 --- /dev/null +++ b/examples/amok/bandwidth/.cvsignore @@ -0,0 +1,3 @@ +.deps .libs Makefile Makefile.in _*.c bandwidth_maestro bandwidth_sensor bandwidth_simulator +test_sg +bandwidth.Makefile.local bandwidth.Makefile.remote bandwidth.deploy.sh bandwidth.trace diff --git a/examples/amok/bandwidth/Makefile.am b/examples/amok/bandwidth/Makefile.am new file mode 100644 index 0000000000..f172e6c350 --- /dev/null +++ b/examples/amok/bandwidth/Makefile.am @@ -0,0 +1,23 @@ +INCLUDES= -I$(top_srcdir)/include +AM_CFLAGS=-g +TESTS=test_rl test_sg +EXTRA_DIST=bandwidth_deployment.txt $(TESTS) + +noinst_PROGRAMS=bandwidth_maestro bandwidth_sensor bandwidth_simulator + +bandwidth_simulator_SOURCES= _bandwidth_simulator.c bandwidth.c +bandwidth_simulator_LDADD= $(top_builddir)/src/libsimgrid.la $(top_builddir)/src/amok/libamok.la + +bandwidth_maestro_SOURCES= _bandwidth_maestro.c bandwidth.c +bandwidth_maestro_LDADD= $(top_builddir)/src/libgras.la $(top_builddir)/src/amok/libamok.la + +bandwidth_sensor_SOURCES= _bandwidth_sensor.c bandwidth.c +bandwidth_sensor_LDADD= $(top_builddir)/src/libgras.la $(top_builddir)/src/amok/libamok.la + +# Take care of generatated sources +NAME=bandwidth +PROCESSES= maestro sensor +include $(top_srcdir)/examples/temps-gras-stub.mk + +# Cruft +include $(top_srcdir)/acmacro/dist-files.mk diff --git a/examples/amok/bandwidth/bandwidth.c b/examples/amok/bandwidth/bandwidth.c new file mode 100644 index 0000000000..59033b68fb --- /dev/null +++ b/examples/amok/bandwidth/bandwidth.c @@ -0,0 +1,134 @@ +/* $Id$ */ + +/* bandwidth - bandwidth test demo of GRAS features */ + +/* Copyright (c) 2003, 2004 Martin Quinson. 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 "gras.h" +#include "amok/bandwidth.h" + +XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth,"Messages specific to this example"); + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_socket_t sock; + int done; +} s_sensor_data_t,*sensor_data_t; + +static int sensor_cb_quit(gras_socket_t expeditor, + void *payload_data) { + sensor_data_t globals=(sensor_data_t)gras_userdata_get(); + + globals->done = 1; + return 1; +} + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + xbt_error_t errcode; + sensor_data_t g; + + gras_init(&argc, argv, NULL); + g=gras_userdata_new(s_sensor_data_t); + + amok_bw_init(); + + if ((errcode=gras_socket_server(atoi(argv[1]),&(g->sock)))) { + ERROR1("Sensor: Error %s encountered while opening the server socket",xbt_error_name(errcode)); + return 1; + } + g->done = 0; + + gras_msgtype_declare("quit",NULL); + gras_cb_register(gras_msgtype_by_name("quit"),&sensor_cb_quit); + + while (! g->done ) { + errcode=gras_msg_handle(60.0); + if (errcode != no_error) { + ERROR1("Sensor: Error '%s' while handling message",xbt_error_name(errcode)); + gras_socket_close(g->sock); + return errcode; + } + } + + gras_socket_close(g->sock); + return 0; +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_socket_t sock; +} s_maestro_data_t,*maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); + +int maestro(int argc,char *argv[]) { + xbt_error_t errcode; + maestro_data_t g; + double sec, bw; + int buf_size=32; + int exp_size=1024*50; + int msg_size=1024; + gras_socket_t peer; + + gras_init(&argc, argv, NULL); + g=gras_userdata_new(s_maestro_data_t); + amok_bw_init(); + + if ((errcode=gras_socket_server(6000,&(g->sock)))) { + ERROR1("Maestro: Error %s encountered while opening the server socket",xbt_error_name(errcode)); + return 1; + } + + + if (argc != 5) { + ERROR0("Usage: maestro host port host port\n"); + return 1; + } + + /* wait to ensure that all server sockets are there before starting the experiment */ + gras_os_sleep(1.0); + + if ((errcode=gras_socket_client(argv[1],atoi(argv[2]),&peer))) { + ERROR3("Client: Unable to connect to my peer on %s:%s. Got %s", + argv[1],argv[2],xbt_error_name(errcode)); + return 1; + } + + INFO0("Test the BW between me and one of the sensors"); + TRY(amok_bw_test(peer,buf_size,exp_size,msg_size,&sec,&bw)); + INFO6("maestro: Experience between me and %s:%d (%d kb in msgs of %d kb) took %f sec, achieving %f kb/s", + argv[1],atoi(argv[2]), + exp_size,msg_size, + sec,bw); + + INFO0("Test the BW between the two sensors"); + TRY(amok_bw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + buf_size,exp_size,msg_size,&sec,&bw)); + + /* ask sensors to quit */ + gras_msgtype_declare("quit",NULL); + TRY(gras_msg_send(peer,gras_msgtype_by_name("quit"), NULL)); + gras_socket_close(peer); + TRY(gras_socket_client(argv[3],atoi(argv[4]),&peer)); + TRY(gras_msg_send(peer,gras_msgtype_by_name("quit"), NULL)); + gras_socket_close(peer); + + gras_socket_close(g->sock); + return 0; +} diff --git a/examples/amok/bandwidth/bandwidth_deployment.xml b/examples/amok/bandwidth/bandwidth_deployment.xml new file mode 100644 index 0000000000..5947ac1da5 --- /dev/null +++ b/examples/amok/bandwidth/bandwidth_deployment.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/examples/amok/bandwidth/test_rl.in b/examples/amok/bandwidth/test_rl.in new file mode 100755 index 0000000000..dc09c1e29f --- /dev/null +++ b/examples/amok/bandwidth/test_rl.in @@ -0,0 +1,10 @@ +#! @BASH@ -e +if [ x@EXEEXT@ = x ] ; then + exenv="libtool --mode=execute valgrind --run-libc-freeres=no " +else + exenv=wine +fi + +$exenv ./bandwidth_sensor@EXEEXT@ 4000 $@& +#$exenv ./bandwidth_sensor@EXEEXT@ 5000 $@& +$exenv ./bandwidth_maestro@EXEEXT@ 127.0.0.1 4000 127.0.0.1 5000 $@ diff --git a/examples/amok/bandwidth/test_sg.in b/examples/amok/bandwidth/test_sg.in new file mode 100755 index 0000000000..b82ca1e6d7 --- /dev/null +++ b/examples/amok/bandwidth/test_sg.in @@ -0,0 +1,7 @@ +#! @BASH@ +if [ x@EXEEXT@ = x ] ; then + exenv="libtool --mode=execute valgrind" +else + exenv=wine +fi +exec $exenv ./bandwidth_simulator@EXEEXT@ @top_srcdir@/examples/msg/small_platform.xml @srcdir@/bandwidth_deployment.xml $@ diff --git a/examples/amok/saturate/.cvsignore b/examples/amok/saturate/.cvsignore new file mode 100644 index 0000000000..8d9dbb09bd --- /dev/null +++ b/examples/amok/saturate/.cvsignore @@ -0,0 +1,2 @@ +.deps .libs Makefile Makefile.in _*.c saturate_sensor saturate_maestro saturate_simulator +test_sg diff --git a/examples/amok/saturate/Makefile.am b/examples/amok/saturate/Makefile.am new file mode 100644 index 0000000000..0ade8928e3 --- /dev/null +++ b/examples/amok/saturate/Makefile.am @@ -0,0 +1,25 @@ +INCLUDES= -I$(top_srcdir)/include +AM_CFLAGS=-g + +TESTS=test_rl test_sg +EXTRA_DIST=saturate_deployment.txt $(TESTS) + +check_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro + +saturate_simulator_SOURCES=_saturate_simulator.c saturate.c +saturate_simulator_LDADD= $(top_builddir)/src/libsimgrid.la + +saturate_sensor_SOURCES= _saturate_sensor.c saturate.c +saturate_maestro_SOURCES= _saturate_maestro.c saturate.c + +saturate_sensor_LDADD= $(top_srcdir)/src/libgras.la # $(top_srcdir)/src/modules/libgrasmodules.a +saturate_maestro_LDADD= $(top_srcdir)/src/libgras.la # $(top_srcdir)/src/modules/libgrasmodules.a + +# Take care of generatated sources +NAME=saturate +PROCESSES=sensor maestro +include $(top_srcdir)/examples/temps-gras-stub.mk + + + + diff --git a/examples/amok/saturate/deploy_old.txt b/examples/amok/saturate/deploy_old.txt new file mode 100644 index 0000000000..88a1b07a61 --- /dev/null +++ b/examples/amok/saturate/deploy_old.txt @@ -0,0 +1,34 @@ +61 sensor +62 sensor +63 sensor +69 sensor +70 sensor +77 sensor +81 sensor +83 sensor +85 sensor +87 sensor +88 sensor +95 sensor +98 sensor +107 sensor +109 sensor +111 sensor +112 sensor +121 sensor +124 sensor +125 sensor +131 sensor +145 sensor +150 sensor +156 sensor +157 sensor +162 sensor +165 sensor +168 sensor +169 sensor +170 sensor +175 sensor +177 sensor +178 sensor +109 maestro 95 4000 112 4000 125 4000 87 4000 diff --git a/examples/amok/saturate/saturate.c b/examples/amok/saturate/saturate.c new file mode 100644 index 0000000000..e19549f716 --- /dev/null +++ b/examples/amok/saturate/saturate.c @@ -0,0 +1,258 @@ +/* $Id$ */ + +/* saturate - link saturation demo of GRAS features */ + +/* Copyright (c) 2003 Martin Quinson. 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 +#include +#include +#include + +#include + +XBT_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example"); + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_socket_t *sock; +} sensor_data_t; + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + xbt_error_t errcode; + sensor_data_t *g=gras_userdata_new(sensor_data_t); + + if ((errcode=gras_socket_server(4000,&(g->sock)))) { + CRITICAL1("Sensor: Error %s encountered while opening the server socket",xbt_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_socket_close(g->sock); + return 1; + } + + while (1) { + if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { + CRITICAL1("Sensor: Error '%s' while handling message", + xbt_error_name(errcode)); + } + } + + gras_os_sleep(5,0); + gras_socket_close(g->sock); + + return 0; +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_socket_t *sock; +} maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); +double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2); + +double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2) { + xbt_error_t errcode; + int bufSize=32 * 1024; + int expSize=64 * 1024; + int msgSize=64 * 1024; + int satSize=msgSize * 10; + double sec, bw, sec_sat,bw_sat; + + if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode)); + return -1; + } + + fprintf(stderr,"MAESTRO: BW(%s,%s) => %f sec, achieving %f Mb/s\n",bw1,bw2,sec,bw); + + if ((errcode=grasbw_saturate_start(sat1,4000,sat2,4000,satSize,60))) { + fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n", + xbt_error_name(errcode)); + return -1; + } + gras_os_sleep(1,0); + if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec_sat,&bw_sat))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode)); + return -1; + } + + fprintf(stderr,"MAESTRO: BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s\n", + bw1,bw2,sat1,sat2,sec_sat,bw_sat); + + if ((errcode=grasbw_saturate_stop(sat1,4000,sat2,4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + xbt_error_name(errcode)); + return -1; + } + + if (bw_sat/bw < 0.7) { + fprintf(stderr,"MAESTRO: THERE IS SOME INTERFERENCE !!!\n"); + } + if (bw/bw_sat < 0.7) { + fprintf(stderr,"MAESTRO: THERE IS SOME INTERFERENCE (and Im a cretin) !!!\n"); + } + return bw_sat/bw; + +} + +//#define MAXHOSTS 33 +#define MAXHOSTS 4 + +int maestro(int argc,char *argv[]) { + int bufSize=32 * 1024; + int expSize= 1024 * 1024; + int msgSize=expSize; + int satSize=msgSize * 100; + double dummy,beginSim; + xbt_error_t errcode; + maestro_data_t *g=gras_userdata_new(maestro_data_t); + // const char *hosts[MAXHOSTS] = { "61", "62", "63", "69", "70", "77", "81", "83", "85", "87", "88", "95", "98", "107", "109", "111", "112", "121", "124", "125", "131", "145", "150", "156", "157", "162", "165", "168", "169", "170", "175", "177", "178" }; + const char *hosts[MAXHOSTS] = { "A", "B", "C", "D" }; + + double bw[MAXHOSTS][MAXHOSTS]; + double bw_sat[MAXHOSTS][MAXHOSTS]; + + int a,b,c,d,begin; + + if ((errcode=gras_socket_server(4000,&(g->sock)))) { + fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",xbt_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_socket_close(g->sock); + return 1; + } + + begin=time(NULL); + beginSim=gras_os_time(); + for (a=0; a %f (%f vs %f)%s\n", + gras_os_time(), + hosts[c],hosts[d],hosts[a],hosts[b], + bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d], + + (bw_sat[c][d]/bw[c][d] < 0.7) ? " THERE IS SOME INTERFERENCE !!!": + ((bw[c][d]/bw_sat[c][d] < 0.7) ? " THERE IS SOME INTERFERENCE (and Im a cretin) !!!": + "")); + } + } + + if ((errcode=grasbw_saturate_stop(hosts[a],4000,hosts[b],4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + xbt_error_name(errcode)); + return -1; + } + fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n", + time(NULL)-begin, gras_os_time()-beginSim); + } + } + + gras_os_sleep(5,0); + exit(0); +#if 0 + return 0; + /* start saturation */ + fprintf(stderr,"MAESTRO: Start saturation with size %d\n",msgSize); + if ((errcode=grasbw_saturate_start(argv[5],atoi(argv[6]),argv[7],atoi(argv[8]),msgSize*10,60))) { + fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n", + xbt_error_name(errcode)); + return 1; + } + fprintf(stderr,"MAESTRO: Saturation started\n"); + gras_os_sleep(5,0); + + /* test with saturation */ + if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode)); + return 1; + } + + fprintf(stderr,"MAESTRO: Experience3 (%d ko in msgs of %d ko with saturation) took %f sec, achieving %f Mb/s\n", + expSize/1024,msgSize/1024, + sec,bw); + + /* stop saturation */ + if ((errcode=grasbw_saturate_stop(argv[5],atoi(argv[6]),argv[7],atoi(argv[8])))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + xbt_error_name(errcode)); + return 1; + } + + /* test without saturation */ + if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode)); + return 1; + } + + fprintf(stderr,"MAESTRO: Experience4 (%d ko in msgs of %d ko, without saturation) took %f sec, achieving %f Mb/s\n", + expSize/1024,msgSize/1024, + sec,bw); + + gras_os_sleep(5,0); +#endif + gras_socket_close(g->sock); + + return 0; +} diff --git a/examples/amok/saturate/saturate_deployment.txt b/examples/amok/saturate/saturate_deployment.txt new file mode 100644 index 0000000000..678c4e5188 --- /dev/null +++ b/examples/amok/saturate/saturate_deployment.txt @@ -0,0 +1,5 @@ +A sensor +B sensor +C sensor +D sensor +Master maestro diff --git a/examples/amok/saturate/test_sg.in b/examples/amok/saturate/test_sg.in new file mode 100755 index 0000000000..b80ebfd5da --- /dev/null +++ b/examples/amok/saturate/test_sg.in @@ -0,0 +1,5 @@ +#! @BASH@ +if test -x ./saturate_simulator ; then + exec ./saturate_simulator @srcdir@/../WAN_3.platform.txt @srcdir@/saturate_deployment.txt +fi +exit 77