Exemplo n.º 1
0
/**
 * \brief Main function.
 */
int main(int argc, char *argv[])
{
#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_t timer = xbt_os_timer_new();
#endif

    MSG_init(&argc, argv);

    char **options = &argv[1];
    const char* platform_file = options[0];
    const char* application_file = options[1];

    MSG_create_environment(platform_file);

    MSG_function_register("node", node);
    MSG_launch_application(application_file);

#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_start(timer);
#endif
    msg_error_t res = MSG_main();
#ifdef BENCH_THIS_CODE
    xbt_os_cputimer_stop(timer);
#endif
    XBT_CRITICAL("Simulated time: %g", MSG_get_clock());

    if (res == MSG_OK)
        return 0;
    else
        return 1;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
  int i, j;
  xbt_os_timer_t timer = xbt_os_timer_new();

  SD_init(&argc, argv);
  SD_create_environment(argv[1]);

  sg_host_t *hosts = sg_host_list();
  int host_count = sg_host_count();

  /* Random number initialization */
  srand( (int) (xbt_os_time()*1000) );

  do {
    i = rand()%host_count;
    j = rand()%host_count;
  } while(i==j);

  sg_host_t h1 = hosts[i];
  sg_host_t h2 = hosts[j];
  printf("%d\tand\t%d\t\t",i,j);

  xbt_os_cputimer_start(timer);
  SD_route_get_list(h1, h2);
  xbt_os_cputimer_stop(timer);

  printf("%f\n", xbt_os_timer_elapsed(timer) );

  xbt_free(hosts);
  SD_exit();

  return 0;
}
Exemplo n.º 3
0
static void create_environment(xbt_os_timer_t parse_time, const char *platformFile)
{
  try {
    xbt_os_cputimer_start(parse_time);
    SD_create_environment(platformFile);
    xbt_os_cputimer_stop(parse_time);
  }
  catch (std::exception& e) {
    xbt_die("Error while loading %s: %s", platformFile, e.what());
  }
}
Exemplo n.º 4
0
static void create_environment(xbt_os_timer_t parse_time, const char *platformFile)
{
  xbt_ex_t e;
  TRY {
    xbt_os_cputimer_start(parse_time);
    SD_create_environment(platformFile);
    xbt_os_cputimer_stop(parse_time);
  }
  CATCH(e) {
    xbt_die("Error while loading %s: %s", platformFile, e.msg);
  }
}
Exemplo n.º 5
0
int main(int argc, char **argv) {
  xbt_os_timer_t timer = xbt_os_timer_new();

  /* initialization of SD */
  SD_init(&argc, argv);

  if (argc > 1) {
    SD_create_environment(argv[1]);
  } else {
    SD_create_environment("../../platforms/One_cluster_no_backbone.xml");
  }

  ws_list = SD_workstation_get_list();
  reclaimed = xbt_dynar_new(sizeof(bcast_task_t),xbt_free_ref);
  xbt_dynar_t done = NULL;

  xbt_os_cputimer_start(timer);
  send_one(0,SD_workstation_get_number());
  do {
    if (done != NULL && !xbt_dynar_is_empty(done)) {
      unsigned int cursor;
      SD_task_t task;

      xbt_dynar_foreach(done, cursor, task) {
        bcast_task_t bt = SD_task_get_data(task);

        if (bt->i != bt->j -1)
          send_one(bt->i,bt->j);
        if (bt->j != bt->k -1)
          send_one(bt->j,bt->k);

        if (xbt_dynar_length(reclaimed)<100) {
          xbt_dynar_push_as(reclaimed,bcast_task_t,bt);
        } else {
          free(bt);
        }
        SD_task_destroy(task);
      }
      xbt_dynar_free(&done);
    }