void ghostsFromRight(int width, double ghost_values[]) { for(int i=0;i<width;++i){ temperature[i+1][block_width+1] = ghost_values[i]; } messages_due--; check_and_compute(); }
// Perform one iteration of work // The first step is to send the local state to the neighbors void begin_iteration(void) { itercnt++; //ckout << "iter=" << itercnt << ":(" << thisIndex.x << "," << thisIndex.y << ") is on " << CkMyPe() << endl; // Copy left column and right column into temporary arrays double *left_edge = new double[block_height]; double *right_edge = new double[block_height]; for(int i=0;i<block_height;++i){ left_edge[i] = temperature[i+1][1]; right_edge[i] = temperature[i+1][block_width]; } // Send my left edge thisProxy(wrap_x(thisIndex.x-1), thisIndex.y).ghostsFromRight(block_height, left_edge); // Send my right edge thisProxy(wrap_x(thisIndex.x+1), thisIndex.y).ghostsFromLeft(block_height, right_edge); // Send my top edge thisProxy(thisIndex.x, wrap_y(thisIndex.y-1)).ghostsFromBottom(block_width, &temperature[1][1]); // Send my bottom edge thisProxy(thisIndex.x, wrap_y(thisIndex.y+1)).ghostsFromTop(block_width, &temperature[block_height][1]); hasSent=true; check_and_compute(); delete [] right_edge; delete [] left_edge; }
// Perform one iteration of work // The first step is to send the local state to the neighbors void begin_iteration (int i) { //printf("XXXXXXXXX Minor[%d] coming in begin_itertaion at time=%f\n",thisIndex,CkWallTimer()); useLB = 1; iterations++; check_and_compute (); }
// Perform one iteration of work // The first step is to send the local state to the neighbors void begin_iteration (int i) { //printf("PROC#%d coming for Jacobi[%d] iteration=%d majElements=%d\n",CkMyPe(),thisIndex,iterations,majElements); /* if ( iterations %10 ==0 && useLB) { printf("calling sync\n"); useLB = 0; AtSync(); } else */ { //printf("PROC#%din elsssssssssssssssssssssss\n",CkMyPe()); useLB = 1; iterations++; check_and_compute (); } }