コード例 #1
0
	void DepthBuilderP2PNoBlock::synchAction()
	{
		Status status;

		if (isRecvActive && recvRequest.Test(status)) {
			assert(0 <= requestedVertex && requestedVertex <= graph->numLocalVertex);
			//printf("%d: write depth [ %ld] to %d\n", rank, depth[requestedVertex], status.Get_source());
			sendVertex(depth[requestedVertex], status.Get_source(), DEPTH_SEND_TAG);
			isRecvActive = false;
		}

		startRecv();
	}
コード例 #2
0
ファイル: BFSTaskP2P.cpp プロジェクト: kilel/DGraphMark
void BFSTaskP2P::performBFSSynch()
{
    Status status;
    Vertex memory[2] = {0};

    while (true) {
        if (waitSynch(BFS_SYNCH_TAG, status)) {
            comm->Recv(&memory[0], 2, VERTEX_TYPE, status.Get_source(), BFS_DATA_TAG);
            const Vertex currLocal = memory[0];
            const Vertex parentGlobal = memory[1];
            BFSdgmark::processLocalChild(parentGlobal, currLocal);
        } else {
            //synchronization is not neaded mode
            break;
        }
    }
}
コード例 #3
0
ファイル: main.cpp プロジェクト: abitduck/Study
 void task5() {
     barrier("Task 5");
     if (id != size - 1) {
         int data = rand();
         int to = size - 1;
         comm.Send(&data, 1, INTEGER, to, 0);
         printf("Process %d sent data [%d] to %d\n", id, data, to);
     } else {
         Status s;
         comm.Probe(ANY_SOURCE, ANY_TAG, s);
         int count = s.Get_count(INTEGER);
         int* buffer = new int[count];
         int from = s.Get_source();
         comm.Recv(buffer, count, INTEGER, from, 0);
         for (int i = 0; i < count; ++i) {
             printf("Process %d recieved data [%d] from %d\n", id, *(buffer + i), from);
         }
         delete buffer;
     }
 }