summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ca7838c)
and make_deployment to add a massage size in deployment files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2426
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
int myport; /* port on which I receive stuff */
int todo; /* amount of messages I should get */
int myport; /* port on which I receive stuff */
int todo; /* amount of messages I should get */
- int data; /* message content */
+ char *data; /* message content */
gras_socket_t mysock; /* socket on which other people contact me */
gras_socket_t expeditor; /* to notice who wrote me */
gras_socket_t mysock; /* socket on which other people contact me */
gras_socket_t expeditor; /* to notice who wrote me */
mysock = gras_socket_server(myport);
/* Register the known messages */
mysock = gras_socket_server(myport);
/* Register the known messages */
- gras_msgtype_declare("data", gras_datadesc_by_name("int"));
+ gras_msgtype_declare("data", gras_datadesc_by_name("string"));
- INFO4("Got Data(%d) from %s:%d (still %d to go)",
- data,
+ INFO3("Got Data from %s:%d (still %d to go)",
+ /* data,*/
gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
todo);
}
gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
todo);
}
/* Free the allocated resources, and shut GRAS down */
gras_socket_close(mysock);
/* Free the allocated resources, and shut GRAS down */
gras_socket_close(mysock);
gras_exit();
return 0;
} /* end_of_receiver */
gras_exit();
return 0;
} /* end_of_receiver */
int sender (int argc,char *argv[]) {
int i; /* iterator */
int sender (int argc,char *argv[]) {
int i; /* iterator */
- int data; /* data exchanged */
-
+ char *data; /* data exchanged */
+ int datasize; /* size of message */
xbt_host_t h; /* iterator */
gras_socket_t peer; /* socket to node */
xbt_host_t h; /* iterator */
gras_socket_t peer; /* socket to node */
/* xbt_dynar for hosts */
xbt_dynar_t hosts = xbt_dynar_new(sizeof(xbt_host_t),&xbt_host_free_voidp);
/* xbt_dynar for hosts */
xbt_dynar_t hosts = xbt_dynar_new(sizeof(xbt_host_t),&xbt_host_free_voidp);
gras_init(&argc,argv);
/* Get the node location from argc/argv */
gras_init(&argc,argv);
/* Get the node location from argc/argv */
- for (i=1; i<argc; i++){
+ for (i=1; i<argc-1; i++){
xbt_host_t host = xbt_host_from_string(argv[i]);
xbt_dynar_push(hosts,&host);
}
xbt_host_t host = xbt_host_from_string(argv[i]);
xbt_dynar_push(hosts,&host);
}
+
+ datasize=atoi(argv[argc-1]);
+
+ data=(char *) malloc(datasize+1); // allocation of datasize octets
+ memset(data, 32, datasize);
+ data[datasize] = '\0';
INFO0("Launch current node");
/* Register the known messages */
INFO0("Launch current node");
/* Register the known messages */
- gras_msgtype_declare("data", gras_datadesc_by_name("int"));
+ gras_msgtype_declare("data", gras_datadesc_by_name("string"));
+
/* Wait for receivers to startup */
gras_os_sleep(1);
/* write 'em */
/* Wait for receivers to startup */
gras_os_sleep(1);
/* write 'em */
xbt_dynar_foreach(hosts,i,h) {
peer = gras_socket_client(h->name,h->port);
gras_msg_send(peer,gras_msgtype_by_name("data"),&data);
xbt_dynar_foreach(hosts,i,h) {
peer = gras_socket_client(h->name,h->port);
gras_msg_send(peer,gras_msgtype_by_name("data"),&data);
- INFO3(" Sent Data (%d) from %s to %s",
- data,gras_os_myname(),h->name);
+ INFO2(" Sent Data from %s to %s",
+ /*data,*/gras_os_myname(),h->name);
gras_socket_close(peer);
}
gras_socket_close(peer);
}
sub usage {
print STDERR <<EOH
sub usage {
print STDERR <<EOH
-Usage: all2all_make_deployment.pl platform_file.xml nb_host (bcast source?)
+Usage: all2all_make_deployment.pl platform_file.xml nb_host size_msg (bcast source?)
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.
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.
-
-If a third argument is passed, this is the source of the broadcast
+
+The third argument is a size of the message to send ( octets )
+
+If a fourth argument is passed, this is the source of the broadcast
(given as a number between 0 and nb_host-1).
EOH
;
(given as a number between 0 and nb_host-1).
EOH
;
my $input = shift @ARGV || usage();
my $nb_hosts = shift @ARGV || usage();
my $input = shift @ARGV || usage();
my $nb_hosts = shift @ARGV || usage();
+my $size_msg = shift @ARGV || usage();
my $source = shift || "";
my @host;
my $source = shift || "";
my @host;
+$receivers .= " <argument value=\"$size_msg\"/>\n";
#
# and now, really generate the file. Receiver first.
#
# and now, really generate the file. Receiver first.