Beispiel #1
0
/** Emitter function  */
int master(int argc, char *argv[])
{
  double task_comp_size = 5E7;
  double task_comm_size = 1E6;

  char mailbox[256];
  msg_task_t task = NULL;
  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
  sprintf(mailbox, "jupi");

  task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
  XBT_INFO("Sending \"%s\"", task->name);
  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
    MSG_task_destroy(task);

  MSG_process_sleep(1);
  MSG_host_off(jupiter);

  task = MSG_task_create("task off", task_comp_size, task_comm_size, NULL);
  XBT_INFO("Sending \"%s\"", task->name);
  if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
    MSG_task_destroy(task);

  MSG_host_on(jupiter);
  xbt_swag_t jupi_processes = MSG_host_get_process_list(jupiter);
  void *process;
  xbt_swag_foreach(process, jupi_processes) {
    MSG_process_kill(process);
  }
Beispiel #2
0
static void simulate_bootup(msg_host_t host) {
  int previous_pstate = MSG_host_get_pstate(host);

  XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
  MSG_host_set_pstate(host,3);

  msg_host_t host_list[1] = {host};
  double flops_amount[1] = {1};
  double bytes_amount[1] = {0};

  XBT_INFO("Actually start the host");
  MSG_host_on(host);

  XBT_INFO("Simulate the boot up by executing one flop on that host");
  // We use a parallel task to run some task on a remote host.
  msg_task_t bootup = MSG_parallel_task_create("boot up", 1, host_list, flops_amount, bytes_amount, NULL);
  MSG_task_execute(bootup);
  MSG_task_destroy(bootup);

  XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
  MSG_host_set_pstate(host, previous_pstate);
}
Beispiel #3
0
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_on(JNIEnv *env, jobject jhost) {
  msg_host_t host = jhost_get_native(env, jhost);
  MSG_host_on(host);
}