Example #1
0
static int64_t _computeNumChunks_chpl(int64_t maxTasks_chpl, chpl_bool ignoreRunning_chpl, int64_t minSize_chpl, int64_t numElems_chpl, int64_t _ln_chpl, int32_t _fn_chpl) {
#line 37 "DSIUtil.chpl"
  int32_t local_c_sublocid_any_chpl;
#line 37 "DSIUtil.chpl"
  int64_t ret_chpl;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl;
#line 37 "DSIUtil.chpl"
  uint64_t unumElems_chpl;
#line 37 "DSIUtil.chpl"
  uint64_t call_tmp_chpl2;
#line 37 "DSIUtil.chpl"
  int64_t numChunks_chpl;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl3;
#line 37 "DSIUtil.chpl"
  chpl_localeID_t _autoCopy_tmp__chpl;
#line 37 "DSIUtil.chpl"
  locale call_tmp_chpl4 = NULL;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl5;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl6;
#line 37 "DSIUtil.chpl"
  int64_t tmp_chpl;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl7;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl8;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl9;
#line 37 "DSIUtil.chpl"
  chpl_bool tmp_chpl2;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl10;
#line 37 "DSIUtil.chpl"
  uint64_t call_tmp_chpl11;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl12;
#line 37 "DSIUtil.chpl"
  chpl_bool tmp_chpl3;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl13;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl14;
#line 37 "DSIUtil.chpl"
  uint64_t call_tmp_chpl15;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl16;
#line 37 "DSIUtil.chpl"
  chpl_bool tmp_chpl4;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl17;
#line 37 "DSIUtil.chpl"
  uint64_t call_tmp_chpl18;
#line 37 "DSIUtil.chpl"
  chpl_bool call_tmp_chpl19;
#line 37 "DSIUtil.chpl"
  int64_t call_tmp_chpl20;
#line 100 "DSIUtil.chpl"
  local_c_sublocid_any_chpl = c_sublocid_any;
#line 93 "DSIUtil.chpl"
  call_tmp_chpl = (numElems_chpl <= INT64(0));
#line 93 "DSIUtil.chpl"
  if (call_tmp_chpl) /* ZLINE: 93 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 93 "DSIUtil.chpl"
  {
#line 94 "DSIUtil.chpl"
    ret_chpl = INT64(0);
#line 94 "DSIUtil.chpl"
    goto _end__computeNumChunks_chpl;
#line 94 "DSIUtil.chpl"
  }
#line 97 "DSIUtil.chpl"
  call_tmp_chpl2 = ((uint64_t)(numElems_chpl));
#line 97 "DSIUtil.chpl"
  unumElems_chpl = call_tmp_chpl2;
#line 98 "DSIUtil.chpl"
  numChunks_chpl = maxTasks_chpl;
#line 99 "DSIUtil.chpl"
  call_tmp_chpl3 = (! ignoreRunning_chpl);
#line 99 "DSIUtil.chpl"
  if (call_tmp_chpl3) /* ZLINE: 100 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 99 "DSIUtil.chpl"
  {
#line 100 "DSIUtil.chpl"
    _autoCopy_tmp__chpl = chpl_rt_buildLocaleID(chpl_nodeID, local_c_sublocid_any_chpl);
#line 100 "DSIUtil.chpl"
    call_tmp_chpl4 = chpl_localeID_to_locale(&_autoCopy_tmp__chpl, _ln_chpl, _fn_chpl);
#line 100 "DSIUtil.chpl"
    chpl_check_nil(call_tmp_chpl4, INT64(100), INT64(0));
#line 100 "DSIUtil.chpl"
    call_tmp_chpl5 = runningTasks(call_tmp_chpl4, _ln_chpl, _fn_chpl);
#line 100 "DSIUtil.chpl"
    call_tmp_chpl6 = (call_tmp_chpl5 - INT64(1));
#line 101 "DSIUtil.chpl"
    call_tmp_chpl7 = (call_tmp_chpl6 < maxTasks_chpl);
#line 101 "DSIUtil.chpl"
    if (call_tmp_chpl7) /* ZLINE: 101 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 101 "DSIUtil.chpl"
    {
#line 101 "DSIUtil.chpl"
      call_tmp_chpl8 = (maxTasks_chpl - call_tmp_chpl6);
#line 101 "DSIUtil.chpl"
      tmp_chpl = call_tmp_chpl8;
#line 101 "DSIUtil.chpl"
    } else /* ZLINE: 101 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 101 "DSIUtil.chpl"
    {
#line 101 "DSIUtil.chpl"
      tmp_chpl = INT64(1);
#line 101 "DSIUtil.chpl"
    }
#line 101 "DSIUtil.chpl"
    numChunks_chpl = tmp_chpl;
#line 101 "DSIUtil.chpl"
  }
#line 106 "DSIUtil.chpl"
  call_tmp_chpl9 = (minSize_chpl > INT64(0));
#line 106 "DSIUtil.chpl"
  if (call_tmp_chpl9) /* ZLINE: 108 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 106 "DSIUtil.chpl"
  {
#line 108 "DSIUtil.chpl"
    call_tmp_chpl10 = (minSize_chpl * numChunks_chpl);
#line 108 "DSIUtil.chpl"
    call_tmp_chpl11 = ((uint64_t)(call_tmp_chpl10));
#line 108 "DSIUtil.chpl"
    call_tmp_chpl12 = (call_tmp_chpl2 < call_tmp_chpl11);
#line 108 "DSIUtil.chpl"
    if (call_tmp_chpl12) /* ZLINE: 108 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 108 "DSIUtil.chpl"
    {
#line 108 "DSIUtil.chpl"
      call_tmp_chpl13 = (numChunks_chpl > INT64(1));
#line 108 "DSIUtil.chpl"
      tmp_chpl3 = call_tmp_chpl13;
#line 108 "DSIUtil.chpl"
    } else /* ZLINE: 108 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 108 "DSIUtil.chpl"
    {
#line 108 "DSIUtil.chpl"
      tmp_chpl3 = UINT8(false);
#line 108 "DSIUtil.chpl"
    }
#line 108 "DSIUtil.chpl"
    tmp_chpl2 = tmp_chpl3;
#line 108 "DSIUtil.chpl"
    while (tmp_chpl2) {
#line 109 "DSIUtil.chpl"
      numChunks_chpl -= INT64(1);
#line 108 "DSIUtil.chpl"
      call_tmp_chpl14 = (minSize_chpl * numChunks_chpl);
#line 108 "DSIUtil.chpl"
      call_tmp_chpl15 = ((uint64_t)(call_tmp_chpl14));
#line 108 "DSIUtil.chpl"
      call_tmp_chpl16 = (unumElems_chpl < call_tmp_chpl15);
#line 108 "DSIUtil.chpl"
      if (call_tmp_chpl16) /* ZLINE: 108 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 108 "DSIUtil.chpl"
      {
#line 108 "DSIUtil.chpl"
        call_tmp_chpl17 = (numChunks_chpl > INT64(1));
#line 108 "DSIUtil.chpl"
        tmp_chpl4 = call_tmp_chpl17;
#line 108 "DSIUtil.chpl"
      } else /* ZLINE: 108 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 108 "DSIUtil.chpl"
      {
#line 108 "DSIUtil.chpl"
        tmp_chpl4 = UINT8(false);
#line 108 "DSIUtil.chpl"
      }
#line 108 "DSIUtil.chpl"
      tmp_chpl2 = tmp_chpl4;
#line 108 "DSIUtil.chpl"
    }
#line 108 "DSIUtil.chpl"
  }
#line 112 "DSIUtil.chpl"
  call_tmp_chpl18 = ((uint64_t)(numChunks_chpl));
#line 112 "DSIUtil.chpl"
  call_tmp_chpl19 = (call_tmp_chpl18 > unumElems_chpl);
#line 112 "DSIUtil.chpl"
  if (call_tmp_chpl19) /* ZLINE: 112 /home/agobin/Documents/chapel-1.13.0/modules/dists/DSIUtil.chpl */
#line 112 "DSIUtil.chpl"
  {
#line 112 "DSIUtil.chpl"
    call_tmp_chpl20 = ((int64_t)(unumElems_chpl));
#line 112 "DSIUtil.chpl"
    numChunks_chpl = call_tmp_chpl20;
#line 112 "DSIUtil.chpl"
  }
#line 114 "DSIUtil.chpl"
  ret_chpl = numChunks_chpl;
#line 114 "DSIUtil.chpl"
  _end__computeNumChunks_chpl:;
#line 92 "DSIUtil.chpl"
  return ret_chpl;
#line 92 "DSIUtil.chpl"
}
Example #2
0
/* DSIUtil.chpl:92 */
static int64_t _computeNumChunks(int64_t maxTasks, chpl_bool ignoreRunning, int64_t minSize, uint64_t numElems, int64_t _ln, c_string _fn) {
  int64_t ret;
  chpl_bool call_tmp;
  uint64_t unumElems;
  int64_t numChunks;
  chpl_bool call_tmp2;
  int32_t call_tmp3;
  chpl_localeID_t call_tmp4;
  _ref_chpl_localeID_t ret_to_arg_ref_tmp_ = NULL;
  chpl_localeID_t call_tmp5;
  locale call_tmp6 = NULL;
  int64_t call_tmp7;
  int64_t call_tmp8;
  int64_t T;
  chpl_bool call_tmp9;
  int64_t call_tmp10;
  chpl_bool call_tmp11;
  chpl_bool T2;
  int64_t call_tmp12;
  uint64_t call_tmp13;
  chpl_bool call_tmp14;
  chpl_bool T3;
  chpl_bool call_tmp15;
  int64_t call_tmp16;
  uint64_t call_tmp17;
  chpl_bool call_tmp18;
  chpl_bool T4;
  chpl_bool call_tmp19;
  uint64_t call_tmp20;
  chpl_bool call_tmp21;
  int64_t call_tmp22;
  call_tmp = (numElems <= UINT64(0));
  if (call_tmp) {
    ret = INT64(0);
    goto _end__computeNumChunks;
  }
  unumElems = numElems;
  numChunks = maxTasks;
  call_tmp2 = (! ignoreRunning);
  if (call_tmp2) {
    call_tmp3 = chpl_task_getRequestedSubloc();
    ret_to_arg_ref_tmp_ = &call_tmp4;
    chpl_buildLocaleID(chpl_nodeID, call_tmp3, ret_to_arg_ref_tmp_, _ln, _fn);
    call_tmp5 = chpl__initCopy_chpl_rt_localeID_t(call_tmp4);
    call_tmp6 = chpl_localeID_to_locale(&call_tmp5, _ln, _fn);
    call_tmp7 = runningTasks(call_tmp6, _ln, _fn);
    call_tmp8 = (call_tmp7 - INT64(1));
    call_tmp9 = (call_tmp8 < maxTasks);
    if (call_tmp9) {
      call_tmp10 = (maxTasks - call_tmp8);
      T = call_tmp10;
    } else {
      T = INT64(1);
    }
    numChunks = T;
  }
  call_tmp11 = (minSize > INT64(0));
  if (call_tmp11) {
    call_tmp12 = (minSize * numChunks);
    call_tmp13 = ((uint64_t)(call_tmp12));
    call_tmp14 = (numElems < call_tmp13);
    if (call_tmp14) {
      call_tmp15 = (numChunks > INT64(1));
      T3 = call_tmp15;
    } else {
      T3 = false;
    }
    T2 = T3;
    while (T2) {
      numChunks -= INT64(1);
      call_tmp16 = (minSize * numChunks);
      call_tmp17 = ((uint64_t)(call_tmp16));
      call_tmp18 = (unumElems < call_tmp17);
      if (call_tmp18) {
        call_tmp19 = (numChunks > INT64(1));
        T4 = call_tmp19;
      } else {
        T4 = false;
      }
      T2 = T4;
    }
  }
  call_tmp20 = ((uint64_t)(numChunks));
  call_tmp21 = (call_tmp20 > unumElems);
  if (call_tmp21) {
    call_tmp22 = ((int64_t)(unumElems));
    numChunks = call_tmp22;
  }
  ret = numChunks;
  _end__computeNumChunks:;
  return ret;
}