Ejemplo n.º 1
0
ComboCentLB::ComboCentLB(const CkLBOptions &opt): CentralLB(opt)
{
  lbname = "ComboCentLB";
  const char *lbs = theLbdb->loadbalancer(opt.getSeqNo());
  if (CkMyPe() == 0)
    CkPrintf("[%d] ComboCentLB created with %s\n",CkMyPe(), lbs);
  
  char *lbcopy = strdup(lbs);
  char *p = strchr(lbcopy, ':');
  if (p==NULL) return;
  p = strtok(p+1, ",");
  while (p) {
    LBAllocFn fn = getLBAllocFn(p);
    if (fn == NULL) {
      CkPrintf("LB> Invalid load balancer: %s.\n", p);
      CmiAbort("");
    }
    BaseLB *alb = fn();
    clbs.push_back((CentralLB*)alb);
    p = strtok(NULL, ",");
  }
}
Ejemplo n.º 2
0
NodeLevelLB::NodeLevelLB(const CkLBOptions &opt): CBase_NodeLevelLB(opt) {
  lbname = "NodeLevelLB";
  const char *lbs = theLbdb->loadbalancer(opt.getSeqNo());
  if (CkMyPe() == 0)
    CkPrintf("[%d] NodeLevelLB created with %s\n",CkMyPe(), lbs);

  char *lbcopy = strdup(lbs);
  char *p = strchr(lbcopy, ':');
  char *ptr = NULL;
  char *lbname;
  if (p==NULL) {
    CmiAbort("LB> Nodelevel load balancer not specified\n");
  }
  lbname = strtok_r(p+1, ",", &ptr);
  while (lbname) {
    LBAllocFn fn = getLBAllocFn(lbname);
    if (fn == NULL) {
      CkPrintf("LB> Invalid load balancer: %s.\n", lbname);
      CmiAbort("");
    }
    BaseLB *alb = fn();
    clbs.push_back((CentralLB*)alb);
    lbname = strtok_r(NULL, ",", &ptr);
  }

  // HybridBaseLB constructs a default tree
  if (tree) {
    delete tree;
  }

  // Construct a tree with three levels where the lowest level is at the node
  // level
  tree = new ThreeLevelTree(CmiMyNodeSize());
  num_levels = tree->numLevels();
  initTree();
}