Exemplo n.º 1
0
//
// Get ID.
//
chpl_taskID_t chpl_task_getId(void) {
  chpl_taskID_t tid;
  enter_();
  tid = (chpl_taskID_t)myth_self();
  return_from_();
  return tid;
}
Exemplo n.º 2
0
chpl_bool chpl_sync_isFull(void * val_ptr, chpl_sync_aux_t * s) {
  chpl_bool x;
  enter_();
  x = myth_felock_status(s->felock);
  return_from_();
  return x;
}
Exemplo n.º 3
0
//
// Get and set dynamic serial state.
//
chpl_bool chpl_task_getSerial(void) {
  void * r;
  enter_();
  r = myth_getspecific(myth_key_serial_state);
  return_from_();
  return (chpl_bool)r;
}
Exemplo n.º 4
0
void chpl_task_init(void) {
  size_t css;
  int _ = enter_();
  myth_globalattr_t attr[1];
  int r = myth_globalattr_init(attr);
  (void)_; (void)r;
  assert(r == 0);
  /* set call stack size */
  css = chpl_task_getEnvCallStackSize();
  if (css) {
    myth_globalattr_set_stacksize(attr, css);
  } else {
    /* chpl_task_getDefaultCallStackSize() generally returns
       a too larger value. we do not use it.
       this essentially uses MassiveThreads default stack size */
#if 0
    css = chpl_task_getDefaultCallStackSize();
    myth_globalattr_set_stacksize(attr, css);
#endif
  }
  myth_init_ex(attr);
  r = myth_key_create(&myth_key_serial_state, 0);
  assert(r == 0);
  (void)r;
  return_from_();
}
Exemplo n.º 5
0
void chpl_task_sleep(double secs) {
  double t, end_t;
  enter_();
  t = cur_time();
  end_t = t + secs;
  while (t < end_t) {
    myth_yield();
    t = cur_time();
  }
  return_from_();
}
Exemplo n.º 6
0
//
// Call a function in a task.
//
void chpl_task_taskCallFTable(chpl_fn_int_t fid,          // function to call
                              //void* arg,              // function arg
                              chpl_task_bundle_t* arg,// function arg
                              size_t arg_size,        // length of arg
                              c_sublocid_t subloc,       // desired sublocale
                              int lineno,                // line at which function begins
                              int32_t filename) {           // name of file containing function
  enter_();
  myth_chpl_create(/* is_executeOn = */ false,
                   lineno, filename,
                   subloc, fid, get_next_task_id(), arg, arg_size);
  return_from_();
}
Exemplo n.º 7
0
//
// Launch a task that is the logical continuation of some other task,
// but on a different locale.  This is used to invoke the body of an
// "on" statement.
//
void chpl_task_startMovedTask(chpl_fn_int_t fid,          // function to call
                              chpl_fn_p fp,
                              //void* arg,              // function arg
                              chpl_task_bundle_t* arg,// function arg
                              size_t arg_size, // length of arg in bytes
                              c_sublocid_t subloc,       // desired sublocale
                              chpl_taskID_t id      // task identifier
                             ) {
  enter_();
  myth_chpl_create(/* is_executeOn = */ true,
                   0, CHPL_FILE_IDX_UNKNOWN,
                   subloc, fid, id, arg, arg_size);
  return_from_();
}
Exemplo n.º 8
0
//
// Task list processing.  These are called by the compiler-emitted
// code for all parallel constructs.  addToTaskList() is called for
// each task and builds a list of all of them.  processTaskList()
// actually adds the tasks to the task pool.  executeTasksInList()
// makes sure all the tasks have at least started.  freeTaskList()
// just reclaims space associated with the list.
//
void chpl_task_addToTaskList(
         chpl_fn_int_t fid,      // function to call for task
         //void* arg,              // argument to the function
         chpl_task_bundle_t* arg, size_t arg_size,
         c_sublocid_t subloc,       // desired sublocale
         void** p_task_list_void,             // task list
         c_nodeid_t task_list_locale,         // locale (node) where task list resides
         chpl_bool is_begin_stmt,          // is begin{} stmt?  (vs. cobegin or coforall)
         int lineno,                // line at which function begins
         int32_t filename) { // name of file containing function
  enter_();
  myth_chpl_create(/* is_executeOn = */ false,
                   lineno, filename,
                   subloc, fid, get_next_task_id(), arg, arg_size);
  return_from_();
}
Exemplo n.º 9
0
//
// Launch a task that is the logical continuation of some other task,
// but on a different locale.  This is used to invoke the body of an
// "on" statement.
//
void chpl_task_startMovedTask(chpl_fn_int_t fid,          // function to call
                              chpl_fn_p fp,
                              //void* arg,              // function arg
                              chpl_task_bundle_t* arg,// function arg
                              size_t arg_size, // length of arg in bytes
                              c_sublocid_t subloc,       // desired sublocale
                              chpl_taskID_t id,      // task identifier
                              chpl_bool serial_state) {         // serial state
  enter_();
  if (chpl_task_getSerial()) {
    chpl_ftable[fid](arg);
  } else {
    myth_chpl_create(/* serial_state = */ false,
                     /* is_executeOn = */ true,
                     0, CHPL_FILE_IDX_UNKNOWN, 
                     subloc, fid, id, arg, arg_size);
  }
  return_from_();
}
Exemplo n.º 10
0
void chpl_task_setSerial(chpl_bool state) {
  enter_();
  myth_setspecific(myth_key_serial_state, (void *)state);
  return_from_();
}
Exemplo n.º 11
0
c_sublocid_t chpl_task_getRequestedSubloc(void) {
  enter_();
  return_from_();
  return c_sublocid_any;
}
Exemplo n.º 12
0
void chpl_task_setSubloc(c_sublocid_t subloc) {
  enter_();
  return_from_();
}
Exemplo n.º 13
0
c_sublocid_t chpl_task_getSubloc(void) {
  enter_();
  return_from_();
  return 0;
}
Exemplo n.º 14
0
void chpl_sync_markAndSignalEmpty(chpl_sync_aux_t * s) {
  enter_();
  myth_felock_mark_and_signal(s->felock, 0);
  return_from_();
}
Exemplo n.º 15
0
void chpl_task_exit(void) {
  // called by the main task
  enter_();
  myth_fini();
  return_from_();
}
Exemplo n.º 16
0
void chpl_sync_destroyAux(chpl_sync_aux_t * s) {
  enter_();
  myth_felock_destroy(s->felock);
  return_from_();
}
Exemplo n.º 17
0
void chpl_sync_initAux(chpl_sync_aux_t * s) {
  enter_();
  myth_felock_init(s->felock, 0);
  return_from_();
}
Exemplo n.º 18
0
void chpl_sync_unlock(chpl_sync_aux_t * s) {
  enter_();
  myth_felock_unlock(s->felock);
  return_from_();
}
Exemplo n.º 19
0
//
// Yield.
//
void chpl_task_yield(void) {
  enter_();
  myth_yield();
  return_from_();
}
Exemplo n.º 20
0
void chpl_task_executeTasksInList(void** p_task_list_void) {
  enter_();
  return_from_();
}
Exemplo n.º 21
0
//
// Have the tasking layer call the 'chpl_main' function pointer
// representing the entry point for the user's Chapel code.  This
// can either be done by invoking the function directly or by creating
// a task that evaluates the function.
//
void chpl_task_callMain(void (*chpl_main)(void)) {
  enter_();
  chpl_main();
  return_from_();
}
Exemplo n.º 22
0
void chpl_sync_waitEmptyAndLock(chpl_sync_aux_t * s,
                                int32_t lineno, int32_t filename) {
  enter_();
  myth_felock_wait_and_lock(s->felock, 0);
  return_from_();
}