示例#1
0
void surf_new_model_init_default(void)
{
    surf_new_model_init_internal();
    new_model_define_callbacks();

    xbt_dynar_push(model_list, &surf_new_model);
}
示例#2
0
void STag_surfxml_include(void)
{
  XBT_DEBUG("STag_surfxml_include '%s'",A_surfxml_include_file);
  xbt_dynar_push(surf_parsed_filename_stack,&surf_parsed_filename); // save old file name
  surf_parsed_filename = xbt_strdup(A_surfxml_include_file);

  xbt_dynar_push(surf_file_to_parse_stack, &surf_file_to_parse); //save old file descriptor

  surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r"); // read new file descriptor
  xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n",
              A_surfxml_include_file);
  xbt_dynar_push(surf_input_buffer_stack,&surf_input_buffer);
  surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
  surf_parse_push_buffer_state(surf_input_buffer);

  fflush(NULL);
}
示例#3
0
static int coordinator(int argc, char *argv[])
{
  int CS_used = 0;   
  msg_task_t task = NULL, answer = NULL; 
  xbt_dynar_t requests = xbt_dynar_new(sizeof(char *), NULL);
  char *req;

  while(1){  
    MSG_task_receive(&task, "coordinator");
    const char *kind = MSG_task_get_name(task); 
    if (!strcmp(kind, "request")) {    
      req = MSG_task_get_data(task);
      if (CS_used) {           
        XBT_INFO("CS already used. Queue the request.");
        xbt_dynar_push(requests, &req);
      } else {               
        if(strcmp(req, "1") != 0){
          XBT_INFO("CS idle. Grant immediatly");
          answer = MSG_task_create("grant", 0, 1000, NULL);
          MSG_task_send(answer, req);
          CS_used = 1;
          answer = NULL;
        }
      }
    } else {
      if (!xbt_dynar_is_empty(requests)) {
        XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests));
        xbt_dynar_shift(requests, &req);
        if(strcmp(req, "1") != 0){
          MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
        }else{
          xbt_dynar_push(requests, &req);
          CS_used = 0;
        }
      }else{
        XBT_INFO("CS release. resource now idle");
        CS_used = 0;
      }
    }
    MSG_task_destroy(task);
    task = NULL;
    kind = NULL;
    req = NULL;
  }
  return 0;
}
示例#4
0
/* Build the set of the compute successors of a task that are ready (i.e., with all parents already scheduled). Both
 * data and control dependencies are checked. As more than one transfer may exist between two compute tasks, it is
 * mandatory to check whether the successor is not already in the set.
 */
xbt_dynar_t SD_task_get_ready_children(SD_task_t t){
  unsigned int i;
  xbt_dynar_t children=NULL, ready_children;
  xbt_dynar_t output_transfers = SD_task_get_children(t);
  SD_task_t output, child;

  ready_children = xbt_dynar_new(sizeof(SD_task_t), NULL);

  xbt_dynar_foreach(output_transfers, i, output){
    if (SD_task_get_kind(output) == SD_TASK_COMM_E2E) {
      /* Data dependency case: a compute task is followed by a data transfer. Its child (in a scheduling sense) is
       * then the grand child
       */
      children = SD_task_get_children(output);
      xbt_dynar_get_cpy(children, 0, &child);

      /* check if this child is already in the set */
      if (xbt_dynar_member(ready_children, &child)){
        XBT_DEBUG("%s already seen, ignore", SD_task_get_name(child));
        xbt_dynar_free_container(&children); /* avoid memory leaks */
        continue;
      }

      if (SD_task_get_kind(child) == SD_TASK_COMP_SEQ && (SD_task_get_state(child) == SD_NOT_SCHEDULED ||
           SD_task_get_state(child) == SD_SCHEDULABLE) && SD_task_is_ready(child)){
        xbt_dynar_push(ready_children, &child);
      }
      xbt_dynar_free_container(&children); /* avoid memory leaks */
    } else {
      /* Control dependency case: a compute task successor is another compute task. */
      /* check if this child is already in the set */
      if (xbt_dynar_member(ready_children, &output)){
        XBT_DEBUG("%s already seen, ignore", SD_task_get_name(output));
        continue;
      }
      if (SD_task_get_kind(output) == SD_TASK_COMP_SEQ && (SD_task_get_state(output) == SD_NOT_SCHEDULED ||
           SD_task_get_state(output) == SD_SCHEDULABLE)&& SD_task_is_ready(output)){
        xbt_dynar_push(ready_children, &output);
      }
    }
  }

  xbt_dynar_free_container(&output_transfers); /* avoid memory leaks */

  return ready_children;
}
示例#5
0
void surf_host_model_init_compound()
{
  xbt_assert(surf_cpu_model_pm, "No CPU model defined yet!");
  xbt_assert(surf_network_model, "No network model defined yet!");

  surf_host_model = new simgrid::surf::HostCLM03Model();
  xbt_dynar_push(all_existing_models, &surf_host_model);
}
/*********
 * Model *
 *********/
void surf_network_model_init_Constant()
{
  xbt_assert(surf_network_model == nullptr);
  surf_network_model = new simgrid::surf::NetworkConstantModel();
  xbt_dynar_push(all_existing_models, &surf_network_model);

  routing_model_create(nullptr);
}
示例#7
0
void surfxml_bufferstack_push(int new_one)
{
  if (!new_one)
    old_buff = surfxml_bufferstack;
  else {
    xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack);
    surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
  }
}
示例#8
0
void surf_host_model_init_current_default(void)
{
  surf_host_model = new simgrid::surf::HostCLM03Model();
  xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
  surf_cpu_model_init_Cas01();
  surf_network_model_init_LegrandVelho();

  xbt_dynar_push(all_existing_models, &surf_host_model);
}
示例#9
0
int master_fun(int argc, char *argv[])
{
  msg_vm_t vm;
  unsigned int i;

  xbt_dynar_t worker_pms = MSG_process_get_data(MSG_process_self());
  int nb_workers = xbt_dynar_length(worker_pms);

  xbt_dynar_t vms = xbt_dynar_new(sizeof(msg_vm_t), NULL);


  /* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */

  XBT_INFO("# Launch %d VMs", nb_workers);
  for (i = 0; i< nb_workers; i++) {
    char *vm_name = bprintf("VM%02d", i);
    char *pr_name = bprintf("WRK%02d", i);

    msg_host_t pm = xbt_dynar_get_as(worker_pms, i, msg_host_t);

    XBT_INFO("create %s on PM(%s)", vm_name, MSG_host_get_name(pm));
    msg_vm_t vm = MSG_vm_create_core(pm, vm_name);

    s_vm_params_t params;
    memset(&params, 0, sizeof(params));
    params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
    MSG_host_set_params(vm, &params);

    MSG_vm_start(vm);
    xbt_dynar_push(vms, &vm);

    XBT_INFO("put a process (%s) on %s", pr_name, vm_name);
    MSG_process_create(pr_name, worker_fun, NULL, vm);

    xbt_free(vm_name);
    xbt_free(pr_name);
  }


  /* Send a bunch of work to every one */
  XBT_INFO("# Send a task to %d worker process", nb_workers);
  send_tasks(nb_workers);

  XBT_INFO("# Suspend all VMs");
  xbt_dynar_foreach(vms, i, vm) {
    const char *vm_name = MSG_host_get_name(vm);
    XBT_INFO("suspend %s", vm_name);
    MSG_vm_suspend(vm);
  }

  XBT_INFO("# Wait a while");
  MSG_process_sleep(2);

  XBT_INFO("# Resume all VMs");
  xbt_dynar_foreach(vms, i, vm) {
    MSG_vm_resume(vm);
  }
示例#10
0
/*********
 * Model *
 *********/
void surf_network_model_init_Constant()
{
  xbt_assert(surf_network_model == NULL);
  surf_network_model = new NetworkConstantModel();

  sg_platf_host_add_cb(netcste_count_hosts);

  ModelPtr model = surf_network_model;
  xbt_dynar_push(model_list, &model);
}
示例#11
0
tmgr_trace_t tmgr_trace_new_from_string(const char *name, const char *input, double periodicity)
{
  int linecount = 0;
  tmgr_event_t last_event = nullptr;
  unsigned int cpt;
  char *val;

  xbt_assert(trace_list.find(name) == trace_list.end(), "Refusing to define trace %s twice", name);
  xbt_assert(periodicity >= 0, "Invalid periodicity %g (must be positive)", periodicity);

  tmgr_trace_t trace = new simgrid::trace_mgr::trace();

  xbt_dynar_t list = xbt_str_split(input, "\n\r");
  xbt_dynar_foreach(list, cpt, val) {
    s_tmgr_event_t event;
    linecount++;
    xbt_str_trim(val, " \t\n\r\x0B");
    if (val[0] == '#' || val[0] == '\0' || val[0] == '%') // pass comments
      continue;

    if (sscanf(val, "PERIODICITY " "%lg" "\n", &periodicity) == 1)
      continue;

    xbt_assert(sscanf(val, "%lg" " " "%lg" "\n", &event.delta, &event.value) == 2,
        "%s:%d: Syntax error in trace\n%s", name, linecount, input);

    if (last_event) {
      xbt_assert(last_event->delta <= event.delta,
          "%s:%d: Invalid trace: Events must be sorted, but time %g > time %g.\n%s",
          name, linecount, last_event->delta, event.delta, input);

      last_event->delta = event.delta - last_event->delta;
    } else {
      if(event.delta > 0.0){
        s_tmgr_event_t first_event;
        first_event.delta=event.delta;
        first_event.value=-1.0;
        xbt_dynar_push(trace->event_list, &first_event);
      }
    }
    xbt_dynar_push(trace->event_list, &event);
    last_event = (tmgr_event_t)xbt_dynar_get_ptr(trace->event_list, xbt_dynar_length(trace->event_list) - 1);
  }
示例#12
0
/** @brief handles dup at the exit
    Update the table of file descriptors, and also the pipe objects if needed */
void syscall_dup_post(reg_s * reg, process_descriptor_t * proc)
{
  proc_outside(proc);
  unsigned int oldfd = (int) reg->arg[0];
  unsigned int newfd = (int) reg->ret;

  fd_descriptor_t *file_desc = process_descriptor_get_fd(proc, oldfd);
  file_desc->refcount++;
  process_descriptor_set_fd(proc, newfd, file_desc);

  if (strace_option)
    fprintf(stderr, "[%d] dup(%d, %d) = %d \n", proc->pid, oldfd, newfd, (int) reg->ret);

  if (file_desc->type == FD_PIPE) {
    pipe_t *pipe = file_desc->pipe;

    // look for the fd in the read end of the pipe
    xbt_dynar_t read_end = pipe->read_end;
    unsigned int cpt_in;
    pipe_end_t end_in;
    xbt_dynar_foreach(read_end, cpt_in, end_in) {
      if (end_in->fd == oldfd && end_in->proc == proc) {
        pipe_end_t dup_end = xbt_malloc0(sizeof(pipe_end_s));
        dup_end->fd = newfd;
        dup_end->proc = end_in->proc;
        xbt_dynar_push(read_end, &dup_end);
      }
    }

    // look for the fd in the write end of the pipe
    xbt_dynar_t write_end = pipe->write_end;
    unsigned int cpt_out;
    pipe_end_t end_out;
    xbt_dynar_foreach(write_end, cpt_out, end_out) {
      if (end_out->fd == oldfd && end_out->proc == proc) {
        pipe_end_t dup_end = xbt_malloc0(sizeof(pipe_end_s));
        dup_end->fd = newfd;
        dup_end->proc = end_out->proc;
        xbt_dynar_push(write_end, &dup_end);
      }
    }
  }
示例#13
0
/**
 * \brief This functions splits a string after using another string as separator
 * For example A!!B!!C splitted after !! will return the dynar {A,B,C}
 * \return An array of dynars containing the string tokens
 */
xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
{
  xbt_dynar_t res = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
  int done;
  const char *p, *q;

  p = q = s;
  done = 0;

  if (s[0] == '\0')
    return res;
  if (sep[0] == '\0') {
    s = xbt_strdup(s);
    xbt_dynar_push(res, &s);
    return res;
  }

  while (!done) {
    char *to_push;
    int v = 0;
    //get the start of the first occurence of the substring
    q = strstr(p, sep);
    //if substring was not found add the entire string
    if (NULL == q) {
      v = strlen(p);
      to_push = xbt_malloc(v + 1);
      memcpy(to_push, p, v);
      to_push[v] = '\0';
      xbt_dynar_push(res, &to_push);
      done = 1;
    } else {
      //get the appearance
      to_push = xbt_malloc(q - p + 1);
      memcpy(to_push, p, q - p);
      //add string terminator
      to_push[q - p] = '\0';
      xbt_dynar_push(res, &to_push);
      p = q + strlen(sep);
    }
  }
  return res;
}
示例#14
0
void jed_event_add_resources(jed_event_t event, xbt_dynar_t host_selection) {
  xbt_dynar_t resource_subset_list;
  jed_res_subset_t res_set;
  unsigned int i;

  resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), NULL);

  jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection);
  xbt_dynar_foreach(resource_subset_list, i, res_set)  {
    xbt_dynar_push(event->resource_subsets, &res_set);
  }
示例#15
0
/** \ingroup msg_task_usage
 * \brief This function checks if a communication is finished.
 * \param comms a vector of communications
 * \return the position of the finished communication if any
 * (but it may have failed, use MSG_comm_get_status() to know its status),
 * or -1 if none is finished
 */
int MSG_comm_testany(xbt_dynar_t comms)
{
  xbt_ex_t e;
  int finished_index = -1;

  /* create the equivalent dynar with SIMIX objects */
  xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL);
  msg_comm_t comm;
  unsigned int cursor;
  xbt_dynar_foreach(comms, cursor, comm) {
    xbt_dynar_push(s_comms, &comm->s_comm);
  }
示例#16
0
tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,
                                        double periodicity)
{
  tmgr_trace_t trace = NULL;
  int linecount = 0;
  s_tmgr_event_t event;
  tmgr_event_t last_event = NULL;
  xbt_dynar_t list;
  unsigned int cpt;
  char *val;

  if (trace_list) {
    trace = xbt_dict_get_or_null(trace_list, id);
    if (trace) {
      XBT_WARN("Ignoring redefinition of trace %s", id);
      return trace;
    }
  }

  xbt_assert(periodicity >= 0,
              "Invalid periodicity %lg (must be positive)", periodicity);

  trace = xbt_new0(s_tmgr_trace_t, 1);
  trace->type = e_trace_list;
  trace->s_list.event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);

  list = xbt_str_split(input, "\n\r");

  xbt_dynar_foreach(list, cpt, val) {
    linecount++;
    xbt_str_trim(val, " \t\n\r\x0B");
    if (val[0] == '#' || val[0] == '\0' || val[0] == '%')
      continue;

    if (sscanf(val, "PERIODICITY " "%lg" "\n", &periodicity) == 1)
      continue;

    if (sscanf(val, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2)
      xbt_die("%s:%d: Syntax error in trace\n%s", id, linecount, input);

    if (last_event) {
      if (last_event->delta > event.delta) {
        xbt_die("%s:%d: Invalid trace: Events must be sorted, "
                "but time %lg > time %lg.\n%s",
                id, linecount, last_event->delta, event.delta, input);
      }
      last_event->delta = event.delta - last_event->delta;
    }
    xbt_dynar_push(trace->s_list.event_list, &event);
    last_event =
        xbt_dynar_get_ptr(trace->s_list.event_list,
                          xbt_dynar_length(trace->s_list.event_list) - 1);
  }
示例#17
0
xbt_dynar_t sg_hosts_as_dynar(void)
{
  xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),NULL);

  xbt_dict_cursor_t cursor = nullptr;
  const char* name = nullptr;
  simgrid::s4u::Host* host = nullptr;
  xbt_dict_foreach(host_list, cursor, name, host)
    if (host && host->pimpl_netcard && host->pimpl_netcard->isHost())
       xbt_dynar_push(res, &host);
  return res;
}
示例#18
0
/** \ingroup m_host_management
 * \brief Return a dynar containing all the hosts declared at a given point of time
 */
xbt_dynar_t MSG_hosts_as_dynar(void) {
  xbt_lib_cursor_t cursor;
  char *key;
  void **data;
  xbt_dynar_t res = xbt_dynar_new(sizeof(msg_host_t),NULL);

  xbt_lib_foreach(host_lib, cursor, key, data) {
    if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
      xbt_dynar_push(res, data + MSG_HOST_LEVEL);
  }
  return res;
}
示例#19
0
/*********
 * Model *
 *********/
void surf_cpu_model_init_Cas01()
{
  char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");

  xbt_assert(!surf_cpu_model_pm);
  xbt_assert(!surf_cpu_model_vm);

  if (!strcmp(optim, "TI")) {
    surf_cpu_model_init_ti();
    return;
  }

  surf_cpu_model_pm = new CpuCas01Model();
  surf_cpu_model_vm  = new CpuCas01Model();

  cpu_define_callbacks();
  ModelPtr model_pm = surf_cpu_model_pm;
  ModelPtr model_vm = surf_cpu_model_vm;
  xbt_dynar_push(model_list, &model_pm);
  xbt_dynar_push(model_list, &model_vm);
}
示例#20
0
/** @brief Push something to the message exchange queue.
 *
 * This is blocking if the declared capacity is non-nul, and if this amount is reached.
 *
 * @see #xbt_dynar_push
 */
void xbt_queue_push(xbt_queue_t queue, const void *src)
{
  xbt_mutex_acquire(queue->mutex);
  while (queue->capacity != 0
         && queue->capacity == xbt_dynar_length(queue->data)) {
    XBT_DEBUG("Capacity of %p exceeded (=%d). Waiting", queue,
           queue->capacity);
    xbt_cond_wait(queue->not_full, queue->mutex);
  }
  xbt_dynar_push(queue->data, src);
  xbt_cond_signal(queue->not_empty);
  xbt_mutex_release(queue->mutex);
}
示例#21
0
/* Build an array that contains all the idle hosts/VMs in the platform */
xbt_dynar_t get_idle_VMs(){
  int i;
  const sg_host_t *hosts = sg_host_list();
  int nhosts = sg_host_count();
  xbt_dynar_t idleVMs = xbt_dynar_new(sizeof(sg_host_t), NULL);

  for (i = 0; i < nhosts; i++){
    if (is_on_and_idle(hosts[i]))
      xbt_dynar_push(idleVMs, &(hosts[i]));
  }

  return idleVMs;
}
示例#22
0
文件: msg_host.c 项目: cemsbr/simgrid
/** \ingroup msg_host_management
 * \brief Return the content of mounted storages on an host.
 * \param host a host
 * \return a dynar containing content (as a dict) of all storages mounted on the host
 */
xbt_dynar_t MSG_host_get_storage_content(msg_host_t host)
{
  xbt_assert((host != NULL), "Invalid parameters");
  xbt_dynar_t contents = xbt_dynar_new(sizeof(void *),NULL);
  msg_storage_t storage;
  char* storage_name;
  unsigned int i;
  xbt_dynar_t storage_list = simcall_host_get_storage_list(host);
  xbt_dynar_foreach(storage_list, i, storage_name){
	storage = xbt_lib_get_elm_or_null(storage_lib,storage_name);
	xbt_dict_t content = simcall_storage_get_content(storage);
	xbt_dynar_push(contents, &content);
  }
示例#23
0
static void action_Irecv(const char *const *action)
{
  char mailbox[250];
  double clock = MSG_get_clock();
  process_globals_t globals =
      (process_globals_t) MSG_process_get_data(MSG_process_self());

  XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));

  sprintf(mailbox, "%s_%s", action[2],
          MSG_process_get_name(MSG_process_self()));
  msg_task_t t = NULL;
  xbt_dynar_push(globals->tasks, &t);
  msg_comm_t c =
      MSG_task_irecv(xbt_dynar_get_ptr
                     (globals->tasks, xbt_dynar_length(globals->tasks) - 1),
                     mailbox);
  xbt_dynar_push(globals->irecvs, &c);

  log_action(action, MSG_get_clock() - clock);
  asynchronous_cleanup();
}
示例#24
0
/*  } */
void surf_network_model_init_IB(void)
{

  if (surf_network_model)
    return;
  surf_network_model = new NetworkIBModel();
  net_define_callbacks();
  xbt_dynar_push(model_list, &surf_network_model);
  surf_callback_connect(networkActionStateChangedCallbacks, IB_action_state_changed_callback);
  surf_callback_connect(networkCommunicateCallbacks, IB_action_init_callback);

  sg_platf_host_add_cb(IB_create_host_callback);
  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
  
}
示例#25
0
/* Build an array that contains all the busy hosts/VMs in the platform */
xbt_dynar_t get_running_VMs(){
  int i;
  const sg_host_t *hosts = sg_host_list ();
  int nhosts = sg_host_count ();
  HostAttribute attr;
  xbt_dynar_t runningVMs = xbt_dynar_new(sizeof(sg_host_t), NULL);

  for (i = 0; i < nhosts; i++){
    attr = sg_host_user(hosts[i]);
    if (attr->on_off)
      xbt_dynar_push(runningVMs, &(hosts[i]));
  }

  return runningVMs;
}
示例#26
0
void *xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys)
{
  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL);
  unsigned long i;
  void *res;

  for (i = 0; i < xbt_dynar_length(keys); i++) {
    char *thiskey = xbt_dynar_get_as(keys, i, char *);
    unsigned long int thislen = (unsigned long int) strlen(thiskey);
    xbt_dynar_push(lens, &thislen);
  }

  res = xbt_multidict_get_ext(mdict, keys, lens), xbt_dynar_free(&lens);
  return res;
}
示例#27
0
static xbt_dynar_t get_ready_tasks(xbt_dynar_t dax)
{
  unsigned int i;
  xbt_dynar_t ready_tasks;
  SD_task_t task;

  ready_tasks = xbt_dynar_new(sizeof(SD_task_t), NULL);
  xbt_dynar_foreach(dax, i, task) {
    if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ && SD_task_get_state(task) == SD_SCHEDULABLE) {
      xbt_dynar_push(ready_tasks, &task);
    }
  }
  XBT_DEBUG("There are %lu ready tasks", xbt_dynar_length(ready_tasks));

  return ready_tasks;
}
示例#28
0
/** @brief Initialize the xbt mechanisms. */
void xbt_init(int *argc, char **argv)
{
  xbt_set_terminate();

  if (xbt_initialized++) {
    XBT_DEBUG("XBT was initialized %d times.", xbt_initialized);
    return;
  }

  xbt_binary_name = xbt_strdup(argv[0]);
  xbt_cmdline = xbt_dynar_new(sizeof(char*),NULL);
  for (int i=0;i<*argc;i++)
    xbt_dynar_push(xbt_cmdline,&(argv[i]));
  
  xbt_log_init(argc, argv);
}
示例#29
0
JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls, jobjectArray jcomms)
{
  int count;
  msg_comm_t* comms = jarray_to_commArray(env, jcomms, &count);
  if (not comms)
    return -1;
  xbt_dynar_t dyn = xbt_dynar_new(sizeof(msg_comm_t),nullptr);
  for (int i=0; i<count; i++) {
    xbt_dynar_push(dyn, &(comms[i]));
  }

  int rank = MSG_comm_waitany(dyn);
  delete[] comms;
  xbt_dynar_free(&dyn);
  return rank;
}
示例#30
0
/* } */
void surf_network_model_init_CM02(void)
{

  if (surf_network_model)
    return;

  surf_network_model = new NetworkCm02Model();
  net_define_callbacks();
  ModelPtr model = surf_network_model;
  xbt_dynar_push(model_list, &model);

  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0);
  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",
                            1.0);
  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 0.0);
}