Example #1
0
void ProxyPatch::boxClosed(int box) {
 
  if (box == 1) { // force Box
    // Note: delay the deletion of proxyDataMsg (of the 
    // current step) until the next step. This is done 
    // for the sake of atom migration (ProxyDataMsg) 
    // as the ProxyPatch has to  unregister the atoms 
    // of the previous step in the AtomMap data structure 
    // also denotes end of gbis phase 3
    sendResults();
  } else if ( box == 5) {//end phase 1
  } else if ( box == 8) {//end phase 2
  } else if (box == 9) {
    //nothing
  } else if (box == 10) {
    // LCPO do nothing
  }


  if ( ! --boxesOpen ) {
    DebugM(2,patchID << ": " << "Checking message buffer.\n");    
    
    if(proxyMsgBufferStatus == PROXYALLMSGBUFFERED) {
          CmiAssert(curProxyMsg != NULL);
          DebugM(3,"Patch " << patchID << " processing buffered proxy ALL data.\n");
          receiveAll(curProxyMsg);          
    }else if(proxyMsgBufferStatus == PROXYDATAMSGBUFFERED) {
          CmiAssert(curProxyMsg != NULL);
          DebugM(3,"Patch " << patchID << " processing buffered proxy data.\n");
          receiveData(curProxyMsg);
    }
  } else {
       DebugM(3,"ProxyPatch " << patchID << ": " << boxesOpen << " boxes left to close.\n");
  }
}
Example #2
0
void ProxyPatch::boxClosed(int box) {
	ProxyGBISP1ResultMsg *msg1;
	ProxyGBISP2ResultMsg *msg2;

	if (box == 1) { // force Box
		// Note: delay the deletion of proxyDataMsg (of the
		// current step) until the next step. This is done
		// for the sake of atom migration (ProxyDataMsg)
		// as the ProxyPatch has to  unregister the atoms
		// of the previous step in the AtomMap data structure
		// also denotes end of gbis phase 3
		sendResults();
	} else if (box == 5) {    //end phase 1
		//this msg should only have nonzero atoms if flags.doNonbonded
		int msgAtoms = (flags.doNonbonded) ? numAtoms : 0;
		msg1 = new (msgAtoms, PRIORITY_SIZE) ProxyGBISP1ResultMsg;
		for (int i = 0; i < msgAtoms; i++) {
			msg1->psiSum[i] = psiSum[i];
		}
		msg1->patch = patchID;
		msg1->psiSumLen = msgAtoms;
		msg1->origPe = CkMyPe();
		SET_PRIORITY(msg1, flags.sequence, GB1_PROXY_RESULTS_PRIORITY + PATCH_PRIORITY(patchID));
		ProxyMgr::Object()->sendResult(msg1);
	} else if (box == 8) {    //end phase 2
		//this msg should only have nonzero atoms if flags.doFullElectrostatics
		int msgAtoms = (flags.doFullElectrostatics) ? numAtoms : 0;
		msg2 = new (msgAtoms, PRIORITY_SIZE) ProxyGBISP2ResultMsg;
		for (int i = 0; i < msgAtoms; i++) {
			msg2->dEdaSum[i] = dEdaSum[i];
		}
		msg2->patch = patchID;
		msg2->dEdaSumLen = msgAtoms;
		msg2->origPe = CkMyPe();
		SET_PRIORITY(msg2, flags.sequence, GB2_PROXY_RESULTS_PRIORITY + PATCH_PRIORITY(patchID));
		ProxyMgr::Object()->sendResult(msg2);
	} else if (box == 9) {
		//nothing
	} else if (box == 10) {
		// LCPO do nothing
	}

	if (!--boxesOpen) {
		DebugM(2, patchID << ": " << "Checking message buffer.\n");

		if (proxyMsgBufferStatus == PROXYALLMSGBUFFERED) {
			CmiAssert(curProxyMsg != NULL);
			DebugM(3, "Patch " << patchID << " processing buffered proxy ALL data.\n");
			receiveAll(curProxyMsg);
		} else if (proxyMsgBufferStatus == PROXYDATAMSGBUFFERED) {
			CmiAssert(curProxyMsg != NULL);
			DebugM(3, "Patch " << patchID << " processing buffered proxy data.\n");
			receiveData(curProxyMsg);
		}
	} else {
		DebugM(3, "ProxyPatch " << patchID << ": " << boxesOpen << " boxes left to close.\n");
	}
}
Example #3
0
void parentProcess( Process* const proc ) {

	closeUnusedPipes( proc );

	// Receive STARTED
	receiveAll( proc, STARTED, proc -> total );
	sprintf( LogBuf, log_received_all_started_fmt, get_lamport_time(), proc -> localId );
	makeIPCLog( LogBuf );

	// Receive DONE
	receiveAll( proc, DONE, proc -> total );
	sprintf( LogBuf, log_received_all_done_fmt, get_lamport_time(), proc -> localId );
	makeIPCLog( LogBuf );

	waitForChildren();

	closeTheOtherPipes( proc );
}
Example #4
0
struct gameData receiveDataFromServer(int sock)
{
	char buf[msgSize];
	struct gameData game;
	int rec = receiveAll(sock, buf, &msgSize);

	if (rec == -1)
	{
		fprintf(stderr, "failed to receive initial data\n");
		close(sock);
    	exit(2);
	}

	game = parseDataFromServer(buf);

	/*printf("Data Received from server: %s\n",buf);*/

	return game;
}