/* ----------------------------------------- * This is the node state BEFORE the search is initiated. * 1. initialize node_state_ with adjList all uncolored * 2. Does pre-coloring * ---------------------------------------*/ Node::Node(bool isRoot, int n, CProxy_Node parent) : nodeID_("0"), parent_(parent), uncolored_num_(n), is_root_(isRoot), child_num_(0), child_finished_(0), child_succeed_(0), is_and_node_(false), parentBits(1), parentPtr(NULL) { __sdag_init(); programStart = CkTimer(); CkAssert(isRoot); vertex v = vertex(chromaticNum_); node_state_ = std::vector<vertex>(vertices_, v); //preColor(); #ifdef DEBUG CkPrintf("After Precolor\n"); printGraph(); #endif int count = uncolored_num_; uncolored_num_ -= vertexRemoval(); CkPrintf("Vertices removed by vertex removal in [MainChare] = %d\n", count-uncolored_num_); #ifdef DEBUG CkPrintf("Vertex Removal\n"); printGraph(); #endif CProxy_counter(counterGroup).ckLocalBranch()->registerMe(nodeID_); run(); }
/* -------------------------------------------- * Node constructor with two parameters * used to fire child node by state configured * ---------------------------------------------*/ Node::Node( std::vector<vertex> state, bool isRoot, int uncol, CProxy_Node parent, std::string nodeID, UShort pBits, UInt* pPtr, int size) : nodeID_(nodeID), parent_(parent), uncolored_num_(uncol), node_state_(state), is_root_(isRoot), child_num_(0), child_finished_(0), child_succeed_(0), is_and_node_(false), parentBits(pBits), parentPtr(pPtr) { __sdag_init(); uncolored_num_ -= vertexRemoval(); bool canISpawn = CProxy_counter(counterGroup).ckLocalBranch()->registerMe(nodeID_); // group chare denied permission to spawn if(!canISpawn) return; run(); }
Chunk::Chunk(int t, int x, int y){ int xdim,ydim; __sdag_init(); xdim = x; ydim = y; total = t; iterations =0; myMax = 99999.999; // CkPrintf("[%d] x is %d, y is %d, t is %d %f\n",CkMyPe(),x,y,t,BgGetTime()); myxdim = int(xdim/total); counter=0; if(thisIndex == total-1) myxdim = xdim - myxdim*(total-1); myydim = ydim; if((thisIndex != 0)&&(thisIndex != total-1)){ A = new double[(myxdim+2)*myydim]; B = new double[(myxdim+2)*myydim]; //Initialize everything to zero for (int i=0; i<myxdim+2; i++) for (int j=0; j<myydim; j++) A[indexof(i,j,ydim)] = B[indexof(i,j,ydim)] = 0.0; } else { A = new double[(myxdim+1)*myydim]; B = new double[(myxdim+1)*myydim]; //Initialize everything to zero for (int i=0; i<myxdim+1; i++) for (int j=0; j<myydim; j++) A[indexof(i,j,ydim)] = B[indexof(i,j,ydim)] = 0.0; } usesAtSync = false; //LBDatabase *lbdb = getLBDB(); //lbdb->SetLBPeriod(50); temp = (double*) malloc(sizeof(double)*myydim); }
Worker() { __sdag_init(); srand(thisIndex); val = ((double) rand()/RAND_MAX) * 100; CkPrintf("Initial: [%d]: val : %d\n", thisIndex, val); }