const char *me = "host0"; /* FIXME: hardcoded*/ /*MSG_host_get_name(MSG_host_self());*/
msg_comm_t comm = NULL;
msg_task_t task = NULL;
- int status;
bc->current_piece = 0;
while (bc->current_piece < bc->piece_count) {
if (xbt_dynar_length(bc->pending_sends) < bc->max_pending_sends) {
task = task_message_data_new(me, bc->first, NULL, PIECE_SIZE);
- XBT_DEBUG("Sending (isend) piece %d from %s into mailbox %s (current pending %d)", bc->current_piece, me, bc->first, xbt_dynar_length(bc->pending_sends));
+ XBT_DEBUG("Sending (isend) piece %d from %s into mailbox %s (current pending %lu)", bc->current_piece, me, bc->first, xbt_dynar_length(bc->pending_sends));
comm = MSG_task_isend(task, bc->first);
queue_pending_connection(comm, bc->pending_sends);
bc->current_piece++;
return MSG_OK;
}
-broadcaster_t broadcaster_init(xbt_dynar_t host_list)
+broadcaster_t broadcaster_init(xbt_dynar_t host_list, unsigned int piece_count)
{
int status;
broadcaster_t bc = xbt_new(s_broadcaster_t, 1);
- bc->piece_count = PIECE_COUNT;
+ bc->piece_count = piece_count;
bc->current_piece = 0;
bc->host_list = host_list;
bc->it = xbt_dynar_iterator_new(bc->host_list, forward_indices_list);
{
broadcaster_t bc = NULL;
xbt_dynar_t host_list = NULL;
- const char *first = NULL;
int status;
+ unsigned int piece_count = PIECE_COUNT;
- XBT_INFO("broadcaster");
+ XBT_DEBUG("broadcaster");
/* Add every mailbox given by the hostcount in argv[1] to a dynamic array */
host_list = build_hostlist_from_hostcount(atoi(argv[1]));
-
- bc = broadcaster_init(host_list);
+
+ /* argv[2] is the number of pieces */
+ if (argc > 2) {
+ piece_count = atoi(argv[2]);
+ XBT_DEBUG("piece_count set to %d", piece_count);
+ } else {
+ XBT_DEBUG("No piece_count specified, defaulting to %d", piece_count);
+ }
+ bc = broadcaster_init(host_list, piece_count);
/* TODO: Error checking */
status = broadcaster_send_file(bc);