Commit b6a88229 authored by Berenger Bramas's avatar Berenger Bramas

duplicate memory block to remove unknown bug

parent caf36092
...@@ -203,6 +203,9 @@ protected: ...@@ -203,6 +203,9 @@ protected:
starpu_data_handle_t other; starpu_data_handle_t other;
size_t sizeOther; size_t sizeOther;
unsigned char* dataOther; // Never delete it, we reuse already allocate memory here unsigned char* dataOther; // Never delete it, we reuse already allocate memory here
std::unique_ptr<unsigned char[]> dataSymbPtr;
std::unique_ptr<unsigned char[]> dataOtherPtr;
}; };
std::list<DuplicatedCellHandle> duplicatedCellBuffer; std::list<DuplicatedCellHandle> duplicatedCellBuffer;
...@@ -240,7 +243,7 @@ public: ...@@ -240,7 +243,7 @@ public:
MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD,&nproc); MPI_Comm_size(MPI_COMM_WORLD,&nproc);
#ifdef STARPU_USE_TASK_NAME #ifdef STARPU_USE_TASK_NAME
#ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS
taskNames = new FStarPUTaskNameParams(mpi_rank, nproc); taskNames = new FStarPUTaskNameParams(mpi_rank, nproc);
#endif #endif
#endif #endif
...@@ -1632,7 +1635,7 @@ protected: ...@@ -1632,7 +1635,7 @@ protected:
DuplicatedCellHandle& duplicateB = duplicatedCellBuffer.back(); DuplicatedCellHandle& duplicateB = duplicatedCellBuffer.back();
duplicateB.sizeSymb = tree->getCellGroup(idxLevel,interactionid)->getBufferSizeInByte(); duplicateB.sizeSymb = tree->getCellGroup(idxLevel,interactionid)->getBufferSizeInByte();
duplicateB.sizeOther = tree->getCellGroup(idxLevel,interactionid)->getMultipoleBufferSizeInByte(); duplicateB.sizeOther = tree->getCellGroup(idxLevel,interactionid)->getMultipoleBufferSizeInByte();
if(starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down) == mpi_rank){ if(starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].symb) == mpi_rank){
// Reuse block but just to perform the send // Reuse block but just to perform the send
duplicateB.dataSymb = const_cast<unsigned char*>(tree->getCellGroup(idxLevel,interactionid)->getRawBuffer()); duplicateB.dataSymb = const_cast<unsigned char*>(tree->getCellGroup(idxLevel,interactionid)->getRawBuffer());
duplicateB.dataOther = reinterpret_cast<unsigned char*>(tree->getCellGroup(idxLevel,interactionid)->getRawMultipoleBuffer()); duplicateB.dataOther = reinterpret_cast<unsigned char*>(tree->getCellGroup(idxLevel,interactionid)->getRawMultipoleBuffer());
...@@ -1641,7 +1644,7 @@ protected: ...@@ -1641,7 +1644,7 @@ protected:
duplicateB.dataSymb = nullptr; duplicateB.dataSymb = nullptr;
duplicateB.dataOther = nullptr; duplicateB.dataOther = nullptr;
} }
registeringNode = starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down); registeringNode = starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].symb);
where = (registeringNode == mpi_rank) ? STARPU_MAIN_RAM : -1; where = (registeringNode == mpi_rank) ? STARPU_MAIN_RAM : -1;
starpu_variable_data_register(&duplicateB.symb, where, starpu_variable_data_register(&duplicateB.symb, where,
(uintptr_t)duplicateB.dataSymb, duplicateB.sizeSymb); (uintptr_t)duplicateB.dataSymb, duplicateB.sizeSymb);
...@@ -1734,22 +1737,23 @@ protected: ...@@ -1734,22 +1737,23 @@ protected:
DuplicatedCellHandle& duplicateB = duplicatedCellBuffer.back(); DuplicatedCellHandle& duplicateB = duplicatedCellBuffer.back();
duplicateB.sizeSymb = tree->getCellGroup(idxLevel,idxGroup)->getBufferSizeInByte(); duplicateB.sizeSymb = tree->getCellGroup(idxLevel,idxGroup)->getBufferSizeInByte();
duplicateB.sizeOther = tree->getCellGroup(idxLevel,idxGroup)->getMultipoleBufferSizeInByte(); duplicateB.sizeOther = tree->getCellGroup(idxLevel,idxGroup)->getMultipoleBufferSizeInByte();
if(starpu_mpi_data_get_rank(cellHandles[idxLevel][interactionid].down) == mpi_rank){ if(starpu_mpi_data_get_rank(cellHandles[idxLevel][interactionid].symb) == mpi_rank){
// Reuse block but just to perform the send // Reuse block but just to perform the send
duplicateB.dataSymb = const_cast<unsigned char*>(tree->getCellGroup(idxLevel,idxGroup)->getRawBuffer()); duplicateB.dataSymbPtr.reset(new unsigned char[duplicateB.sizeSymb]);//const_cast<unsigned char*>(tree->getCellGroup(idxLevel,idxGroup)->getRawBuffer());
duplicateB.dataOther = reinterpret_cast<unsigned char*>(tree->getCellGroup(idxLevel,idxGroup)->getRawMultipoleBuffer()); memcpy(duplicateB.dataSymbPtr.get(), tree->getCellGroup(idxLevel,idxGroup)->getRawBuffer(), duplicateB.sizeSymb);
duplicateB.dataOtherPtr.reset(new unsigned char[duplicateB.sizeOther]);//reinterpret_cast<unsigned char*>(tree->getCellGroup(idxLevel,idxGroup)->getRawMultipoleBuffer());
memcpy(duplicateB.dataOtherPtr.get(), tree->getCellGroup(idxLevel,idxGroup)->getRawMultipoleBuffer(), duplicateB.sizeOther);
} }
else{ duplicateB.dataSymb = nullptr;
duplicateB.dataSymb = nullptr; duplicateB.dataOther = nullptr;
duplicateB.dataOther = nullptr;
} registeringNode = starpu_mpi_data_get_rank(cellHandles[idxLevel][interactionid].symb);
registeringNode = starpu_mpi_data_get_rank(cellHandles[idxLevel][interactionid].down);
where = (registeringNode == mpi_rank) ? STARPU_MAIN_RAM : -1; where = (registeringNode == mpi_rank) ? STARPU_MAIN_RAM : -1;
starpu_variable_data_register(&duplicateB.symb, where, starpu_variable_data_register(&duplicateB.symb, where,
(uintptr_t)duplicateB.dataSymb, duplicateB.sizeSymb); (uintptr_t)duplicateB.dataSymbPtr.get(), duplicateB.sizeSymb);
starpu_mpi_data_register(duplicateB.symb, tag++, registeringNode); starpu_mpi_data_register(duplicateB.symb, tag++, registeringNode);
starpu_variable_data_register(&duplicateB.other, where, starpu_variable_data_register(&duplicateB.other, where,
(uintptr_t)duplicateB.dataOther, duplicateB.sizeOther); (uintptr_t)duplicateB.dataOtherPtr.get(), duplicateB.sizeOther);
starpu_mpi_data_register(duplicateB.other, tag++, registeringNode); starpu_mpi_data_register(duplicateB.other, tag++, registeringNode);
starpu_mpi_insert_task(MPI_COMM_WORLD, starpu_mpi_insert_task(MPI_COMM_WORLD,
......
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