virtual void init() { __startAtomicTransaction(); this->request = EnvironmentController::getInstance() .getCommunicator().startReceive( exchange->getExchangeType(), (char*) exchange->getHostBuffer().getBasePointer(), exchange->getHostBuffer().getDataSpace().getElementCount() * sizeof (TYPE), exchange->getCommunicationTag()); __endTransaction(); }
EventTask asyncReceive(EventTask serialEvent, uint32_t recvEx) { if (hasReceiveExchange(recvEx)) { __startAtomicTransaction(serialEvent + receiveEvents[recvEx]); receiveEvents[recvEx] = receiveExchanges[recvEx]->startReceive(); __endTransaction(); return receiveEvents[recvEx]; } return EventTask(); }
EventTask asyncSend(EventTask serialEvent, uint32_t sendEx, EventTask &gpuFree) { if (hasSendExchange(sendEx)) { __startAtomicTransaction(serialEvent + sendEvents[sendEx]); sendEvents[sendEx] = sendExchanges[sendEx]->startSend(gpuFree); __endTransaction(); /* add only the copy event, because all work on gpu can run after data is copyed */ return gpuFree; } return EventTask(); }
virtual void init() { state = Init; EventTask serialEvent = __getTransactionEvent(); for (int i = 1; i < Exchanges; ++i) { if (buffer.getGridBuffer().hasSendExchange(i)) { __startAtomicTransaction(serialEvent); FieldFactory::getInstance().createTaskFieldSendExchange(buffer, i); tmpEvent += __endTransaction(); } } state = WaitForSend; }
bool executeIntern() { switch (state) { case WaitForReceived: break; case RunCopy: state = WaitForFinish; __startAtomicTransaction(); exchange->getHostBuffer().setCurrentSize(newBufferSize); if (exchange->hasDeviceDoubleBuffer()) { Factory::getInstance().createTaskCopyHostToDevice(exchange->getHostBuffer(), exchange->getDeviceDoubleBuffer()); Factory::getInstance().createTaskCopyDeviceToDevice(exchange->getDeviceDoubleBuffer(), exchange->getDeviceBuffer(), this); } else { Factory::getInstance().createTaskCopyHostToDevice(exchange->getHostBuffer(), exchange->getDeviceBuffer(), this); } __endTransaction(); break; case WaitForFinish: break; case Finish: return true; default: return false; } return false; }