Commit c002a10d authored by Quentin Khan's avatar Quentin Khan

Fix FFmmAlgorithmThreadProcTsm to use FBuffer{Reader,Writer}

The previous FMpiBuffer{Reader,Writer} versions were previously removed because
they did not add any functionality.
parent 48395d23
......@@ -52,8 +52,6 @@
#include "../Containers/FBufferWriter.hpp"
#include "../Containers/FBufferReader.hpp"
#include "../Containers/FMpiBufferWriter.hpp"
#include "../Containers/FMpiBufferReader.hpp"
#include "../Utils/FMpi.hpp"
#include <sys/time.h>
......@@ -468,8 +466,8 @@ protected:
MPI_Status statusSize[8];
FSize bufferSize;
FMpiBufferWriter sendBuffer(1);// Max = 1 + sizeof(cell)*7
std::unique_ptr<FMpiBufferReader[]> recvBuffer(new FMpiBufferReader[7]);
FBufferWriter sendBuffer(1);// Max = 1 + sizeof(cell)*7
std::unique_ptr<FBufferReader[]> recvBuffer(new FBufferReader[7]);
FSize recvBufferSize[7];
CellClass recvBufferCells[7];
......@@ -817,11 +815,11 @@ protected:
long long int*const globalReceiveMap = new long long int[nbProcess * nbProcess * OctreeHeight];
memset(globalReceiveMap, 0, sizeof(long long int) * nbProcess * nbProcess * OctreeHeight);
FMpiBufferWriter**const sendBuffer = new FMpiBufferWriter*[nbProcess * OctreeHeight];
memset(sendBuffer, 0, sizeof(FMpiBufferWriter*) * nbProcess * OctreeHeight);
FBufferWriter**const sendBuffer = new FBufferWriter*[nbProcess * OctreeHeight];
memset(sendBuffer, 0, sizeof(FBufferWriter*) * nbProcess * OctreeHeight);
FMpiBufferReader**const recvBuffer = new FMpiBufferReader*[nbProcess * OctreeHeight];
memset(recvBuffer, 0, sizeof(FMpiBufferReader*) * nbProcess * OctreeHeight);
FBufferReader**const recvBuffer = new FBufferReader*[nbProcess * OctreeHeight];
memset(recvBuffer, 0, sizeof(FBufferReader*) * nbProcess * OctreeHeight);
#pragma omp parallel num_threads(MaxThreads)
{
......@@ -951,7 +949,7 @@ protected:
for(int idxProc = 0 ; idxProc < nbProcess ; ++idxProc){
const long long int toSendAtProcAtLevel = indexToSend[idxLevel * nbProcess + idxProc];
if(toSendAtProcAtLevel != 0){
sendBuffer[idxLevel * nbProcess + idxProc] = new FMpiBufferWriter(toSendAtProcAtLevel);
sendBuffer[idxLevel * nbProcess + idxProc] = new FBufferWriter(toSendAtProcAtLevel);
sendBuffer[idxLevel * nbProcess + idxProc]->write(int(toSend[idxLevel * nbProcess + idxProc].getSize()));
......@@ -972,7 +970,7 @@ protected:
const long long int toReceiveFromProcAtLevel = globalReceiveMap[(idxProc * nbProcess * OctreeHeight) + idxLevel * nbProcess + idProcess];
if(toReceiveFromProcAtLevel){
recvBuffer[idxLevel * nbProcess + idxProc] = new FMpiBufferReader(toReceiveFromProcAtLevel);
recvBuffer[idxLevel * nbProcess + idxProc] = new FBufferReader(toReceiveFromProcAtLevel);
FMpi::IRecvSplit(recvBuffer[idxLevel * nbProcess + idxProc]->data(),
recvBuffer[idxLevel * nbProcess + idxProc]->getCapacity(), idxProc,
......@@ -1290,8 +1288,8 @@ protected:
const int heightMinusOne = FAbstractAlgorithm::lowerWorkingLevel - 1;
FMpiBufferWriter sendBuffer;
FMpiBufferReader recvBuffer;
FBufferWriter sendBuffer;
FBufferReader recvBuffer;
int righestProcToSendTo = nbProcess - 1;
......@@ -1658,11 +1656,11 @@ protected:
globalReceiveMap, nbProcess, FMpi::GetType(*partsToSend), fcomCompute.getComm()), __LINE__ );
FLOG(gatherCounter.tac());
FMpiBufferReader**const recvBuffer = new FMpiBufferReader*[nbProcess];
memset(recvBuffer, 0, sizeof(FMpiBufferReader*) * nbProcess);
FBufferReader**const recvBuffer = new FBufferReader*[nbProcess];
memset(recvBuffer, 0, sizeof(FBufferReader*) * nbProcess);
FMpiBufferWriter**const sendBuffer = new FMpiBufferWriter*[nbProcess];
memset(sendBuffer, 0, sizeof(FMpiBufferWriter*) * nbProcess);
FBufferWriter**const sendBuffer = new FBufferWriter*[nbProcess];
memset(sendBuffer, 0, sizeof(FBufferWriter*) * nbProcess);
// To send in asynchrone way
std::vector<MPI_Request> requests;
......@@ -1671,7 +1669,7 @@ protected:
for(int idxProc = 0 ; idxProc < nbProcess ; ++idxProc){
if(globalReceiveMap[idxProc * nbProcess + idProcess]){ //if idxProc has sth for me.
//allocate buffer of right size
recvBuffer[idxProc] = new FMpiBufferReader(globalReceiveMap[idxProc * nbProcess + idProcess]);
recvBuffer[idxProc] = new FBufferReader(globalReceiveMap[idxProc * nbProcess + idProcess]);
FMpi::IRecvSplit(recvBuffer[idxProc]->data(), recvBuffer[idxProc]->getCapacity(),
idxProc, FMpi::TagFmmP2P, fcomCompute, &requests);
......@@ -1681,7 +1679,7 @@ protected:
// Prepare send
for(int idxProc = 0 ; idxProc < nbProcess ; ++idxProc){
if(toSend[idxProc].getSize() != 0){
sendBuffer[idxProc] = new FMpiBufferWriter(globalReceiveMap[idProcess*nbProcess+idxProc]);
sendBuffer[idxProc] = new FBufferWriter(globalReceiveMap[idProcess*nbProcess+idxProc]);
// << is equivalent to write().
(*sendBuffer[idxProc]) << toSend[idxProc].getSize();
for(int idxLeaf = 0 ; idxLeaf < toSend[idxProc].getSize() ; ++idxLeaf){
......@@ -1713,7 +1711,7 @@ protected:
for(int idxProc = 0 ; idxProc < nbProcess ; ++idxProc){
if(globalReceiveMap[idxProc * nbProcess + idProcess]){ //if idxProc has sth for me.
FAssertLF(recvBuffer[idxProc]);
FMpiBufferReader& currentBuffer = (*recvBuffer[idxProc]);
FBufferReader& currentBuffer = (*recvBuffer[idxProc]);
FSize nbLeaves;
currentBuffer >> nbLeaves;
for(FSize idxLeaf = 0 ; idxLeaf < nbLeaves ; ++idxLeaf){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment