Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit afb13093 authored by Martin Khannouz's avatar Martin Khannouz Committed by Berenger Bramas

Add new taskname into the explicit algorithm and several other things I

can't remember.
parent e51424af
......@@ -161,6 +161,7 @@ protected:
#ifdef SCALFMM_STARPU_USE_PRIO
typedef FStarPUFmmPrioritiesV2 PrioClass;// FStarPUFmmPriorities
#endif
std::list<char*> taskName;
public:
FGroupTaskStarPUMpiAlgorithm(const FMpi::FComm& inComm, OctreeClass*const inTree, KernelClass* inKernels)
......@@ -338,6 +339,8 @@ public:
#ifdef STARPU_SUPPORT_ARBITER
starpu_arbiter_destroy(arbiterGlobal);
#endif
for(char* ptr : taskName)
free(ptr);
starpu_mpi_shutdown();
starpu_shutdown();
}
......@@ -456,6 +459,67 @@ protected:
FTIME_TASKS(cpuWrapper.taskTimeRecorder.saveToDisk("/tmp/taskstime-FGroupTaskStarPUAlgorithm.txt"));
#endif
}
char* getTaskNameP2M(char const* const task_type, int idxGroup, int rank) {
char* name = nullptr;
asprintf(&name, "%s_%lld_%lld_%d", task_type, tree->getParticleGroup(idxGroup)->getStartingIndex(), tree->getParticleGroup(idxGroup)->getEndingIndex(), rank);
taskName.push_front(name);
return name;
}
char* getTaskNameM2M(char const* const task_type, int idxLevel, int idxGroup, int idxLevel2, int idxGroup2, int rank) {
char* name = nullptr;
MortonIndex start, end, start2, end2;
start = tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex();
end = tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex();
start2 = tree->getCellGroup(idxLevel2, idxGroup2)->getStartingIndex();
end2 = tree->getCellGroup(idxLevel2, idxGroup2)->getEndingIndex();
asprintf(&name, "%s_%d_%lld_%lld_%lld_%lld_%d", task_type, idxLevel, start, end, start2, end2, rank);
taskName.push_front(name);
return name;
}
char* getTaskNameM2MUsingInfo(char const* const task_type, int idxLevel, int idxGroup, int idxLevel2, int idxGroup2, int rank) {
char* name = nullptr;
MortonIndex start, end, start2, end2;
start = tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex();
end = tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex();
start2 = processesBlockInfos[idxLevel2][idxGroup2].firstIndex;
end2 = processesBlockInfos[idxLevel2][idxGroup2].lastIndex;
asprintf(&name, "%s_%d_%lld_%lld_%lld_%lld_%d", task_type, idxLevel, start, end, start2, end2, rank);
taskName.push_front(name);
return name;
}
char* getTaskNameM2MUsingInfoRevert(char const* const task_type, int idxLevel, int idxGroup, int idxLevel2, int idxGroup2, int rank) {
char* name = nullptr;
MortonIndex start, end, start2, end2;
start = processesBlockInfos[idxLevel][idxGroup].firstIndex;
end = processesBlockInfos[idxLevel][idxGroup].lastIndex;
start2 = tree->getCellGroup(idxLevel2, idxGroup2)->getStartingIndex();
end2 = tree->getCellGroup(idxLevel2, idxGroup2)->getEndingIndex();
asprintf(&name, "%s_%d_%lld_%lld_%lld_%lld_%d", task_type, idxLevel, start, end, start2, end2, rank);
taskName.push_front(name);
return name;
}
char* getTaskNameP2P(char const* const task_type, int idxGroup, int idxGroup2, int rank) {
char* name = nullptr;
MortonIndex start, end, start2, end2;
start = tree->getParticleGroup(idxGroup)->getStartingIndex();
end = tree->getParticleGroup(idxGroup)->getEndingIndex();
start2 = tree->getParticleGroup(idxGroup2)->getStartingIndex();
end2 = tree->getParticleGroup(idxGroup2)->getEndingIndex();
asprintf(&name, "%s_%lld_%lld_%lld_%lld_%d", task_type, start, end, start2, end2, rank);
taskName.push_front(name);
return name;
}
char* getTaskNameP2PUsingInfo(char const* const task_type, int idxGroup, int idxGroup2, int rank) {
char* name = nullptr;
MortonIndex start, end, start2, end2;
start = tree->getParticleGroup(idxGroup)->getStartingIndex();
end = tree->getParticleGroup(idxGroup)->getEndingIndex();
start2 = processesBlockInfos[tree->getHeight()-1][idxGroup2].firstIndex;
end2 = processesBlockInfos[tree->getHeight()-1][idxGroup2].lastIndex;
asprintf(&name, "%s_%lld_%lld_%lld_%lld_%d", task_type, start, end, start2, end2, rank);
taskName.push_front(name);
return name;
}
void initCodelet(){
......@@ -1621,7 +1685,7 @@ protected:
STARPU_RW, cellHandles[tree->getHeight()-1][idxGroup].up,
STARPU_R, particleHandles[idxGroup].symb,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, p2mTaskNames.get(),
STARPU_NAME, getTaskNameP2M("p2m", idxGroup, comm.processId()),
#endif
0);
}
......@@ -1676,7 +1740,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = m2mTaskNames[idxLevel].get();
task->name = getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -1711,7 +1775,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = m2mTaskNames[idxLevel].get();
task->name = getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -1798,7 +1862,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = task->cl->name;
task->name = getTaskNameM2MUsingInfo("m2m", idxLevel, tree->getNbCellGroupAtLevel(idxLevel)-1, idxLevel+1, firstOtherBlock + nbSubCellGroups, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -1870,7 +1934,7 @@ protected:
STARPU_R, remoteCellGroups[idxLevel][interactionid].handleSymb,
STARPU_R, remoteCellGroups[idxLevel][interactionid].handleUp,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, m2l_cl_inout_mpi.name,
STARPU_NAME, getTaskNameM2MUsingInfo("m2l", idxLevel, idxGroup, idxLevel, interactionid, comm.processId()),
#endif
0);
}
......@@ -1901,7 +1965,7 @@ protected:
STARPU_R, cellHandles[idxLevel][idxGroup].up,
(STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), cellHandles[idxLevel][idxGroup].down,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, m2lTaskNames[idxLevel].get(),
STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, idxGroup, comm.processId()),
#endif
0);
}
......@@ -1930,7 +1994,7 @@ protected:
STARPU_R, cellHandles[idxLevel][interactionid].symb,
STARPU_R, cellHandles[idxLevel][interactionid].up,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, m2lOuterTaskNames[idxLevel].get(),
STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)),
#endif
0);
......@@ -1949,7 +2013,7 @@ protected:
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
STARPU_R, cellHandles[idxLevel][idxGroup].up,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, m2lOuterTaskNames[idxLevel].get(),
STARPU_NAME, getTaskNameM2M("m2l2", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)),
#endif
0);
}
......@@ -2100,7 +2164,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = task->cl->name;
task->name = getTaskNameM2MUsingInfoRevert("l2l", idxLevel, firstOtherBlock, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -2129,12 +2193,12 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->cl_arg_free = 1;
task->cl_arg_free = 1;
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = task->cl->name;
task->name = getTaskNameM2MUsingInfoRevert("l2l", idxLevel, firstOtherBlock, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
......@@ -2192,7 +2256,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = l2lTaskNames[idxLevel].get();
task->name = getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -2231,7 +2295,7 @@ protected:
task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
task->name = l2lTaskNames[idxLevel].get();
task->name = getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId());
#endif
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -2261,7 +2325,7 @@ protected:
(STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down,
STARPU_R, remoteParticleGroupss[interactionid].handleSymb,
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, p2p_cl_inout_mpi.name,
STARPU_NAME, getTaskNameP2PUsingInfo("p2p", idxGroup, interactionid, comm.processId()),
#endif
0);
}
......@@ -2303,7 +2367,7 @@ protected:
(STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[interactionid].down,
#endif
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, p2pOuterTaskNames.get(),
STARPU_NAME, getTaskNameP2P("p2p", idxGroup, interactionid, comm.processId()),
#endif
0);
}
......@@ -2324,7 +2388,7 @@ protected:
(STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down,
#endif
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, p2pTaskNames.get(),
STARPU_NAME, getTaskNameP2P("p2p", idxGroup, idxGroup, comm.processId()),
#endif
0);
}
......@@ -2359,7 +2423,7 @@ protected:
(STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down,
#endif
#ifdef STARPU_USE_TASK_NAME
STARPU_NAME, l2pTaskNames.get(),
STARPU_NAME, getTaskNameP2M("l2p", idxGroup, comm.processId()),
#endif
0);
}
......
......@@ -59,6 +59,7 @@ typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass,
GroupContainerClass, 0, 1, long long int> GroupOctreeClass;
typedef FStarPUAllCpuCapacities<FTestKernels< GroupCellClass, GroupContainerClass >> GroupKernelClass;
typedef FStarPUCpuWrapper<typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass> GroupCpuWrapper;
typedef FGroupTaskStarPUMpiAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper> GroupAlgorithm;
void dumpTreeInfo(GroupOctreeClass& groupedTree, int rank);
......@@ -158,7 +159,7 @@ int main(int argc, char* argv[]){
mpiComm.global().processId()+1, 0,
mpiComm.global().getComm()), __LINE__);
}
if(mpiComm.global().processId() == 0){
if(mpiComm.global().processId() == 0){
std::vector<TestParticle*> particlesGathered;
std::vector<int> sizeGathered;
std::vector<MortonIndex> mortonIndex;
......@@ -198,6 +199,8 @@ int main(int argc, char* argv[]){
fichier << mortonIndex.size()/2 << std::endl;
for(unsigned int i = 0; i < mortonIndex.size(); i+=2)
fichier << mortonIndex[i] << " " << mortonIndex[i+1] << std::endl;
for(TestParticle* ptr : particlesGathered)
delete ptr;
}
else{
int sizeofParticle = sizeof(TestParticle)*myParticles.getSize();
......@@ -206,40 +209,96 @@ int main(int argc, char* argv[]){
MPI_Send(const_cast<MortonIndex*>(&leftLimite), sizeof(leftLimite), MPI_BYTE, 0, 0, mpiComm.global().getComm());
MPI_Send(const_cast<MortonIndex*>(&myLeftLimite), sizeof(myLeftLimite), MPI_BYTE, 0, 0, mpiComm.global().getComm());
}
std::cout << "Loutre " << sizeof(starpu_tag_t) << std::endl;
// Put the data into the tree
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize,
&allParticles, true, leftLimite);
for(int i = 0; i < mpiComm.global().processCount(); ++i)
{
if(i == mpiComm.global().processId())
{
FLOG(std::cout << "My last index is " << leftLimite << "\n");
FLOG(std::cout << "My left limite is " << myLeftLimite << "\n");
std::cout << "My last index is (" << mpiComm.global().processId() << ") " << leftLimite << "\n";
std::cout << "My left limite is (" << mpiComm.global().processId() << ") " << myLeftLimite << "\n";
std::cout << "Size (" << mpiComm.global().processId() << ") " << allParticles.getNbParticles() << "\n";
}
MPI_Barrier(MPI_COMM_WORLD);
}
if(mpiComm.global().processId() == 0)
{
std::cout << "NbLevel " << NbLevels << std::endl;
remove("mapping_morton");
}
for(int i = 0; i < mpiComm.global().processCount(); ++i)
{
if(i == mpiComm.global().processId())
dumpTreeInfo(groupedTree, i);
MPI_Barrier(MPI_COMM_WORLD);
}
//Print morton index for each node
//for(int i = 0; i < mpiComm.global().processCount(); ++i)
//{
//if(i == mpiComm.global().processId())
//{
//FLOG(std::cout << "My last index is " << leftLimite << "\n");
//FLOG(std::cout << "My left limite is " << myLeftLimite << "\n");
//std::cout << "My last index is (" << mpiComm.global().processId() << ") " << leftLimite << "\n";
//std::cout << "My left limite is (" << mpiComm.global().processId() << ") " << myLeftLimite << "\n";
//std::cout << "Size (" << mpiComm.global().processId() << ") " << allParticles.getNbParticles() << "\n";
//}
//MPI_Barrier(MPI_COMM_WORLD);
//}
//if(mpiComm.global().processId() == 0)
//{
//std::cout << "NbLevel " << NbLevels << std::endl;
//remove("mapping_morton");
//}
//for(int i = 0; i < mpiComm.global().processCount(); ++i)
//{
//if(mpiComm.global().processId() == 0)
//groupedTree.printInfoBlocks();
//if(i == mpiComm.global().processId())
//dumpTreeInfo(groupedTree, i);
//MPI_Barrier(MPI_COMM_WORLD);
//}
// Run the algorithm
GroupKernelClass groupkernel;
GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel);
groupalgo.execute();
std::cout << "Wait Others... " << std::endl;
mpiComm.global().barrier();
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){
const FSize nbPartsInLeaf = leaf->getNbParticles();
const long long int* dataDown = leaf->getDataDown();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeaf ; ++idxPart){
if(dataDown[idxPart] != totalNbParticles-1){
std::cout << "[Full] Error a particle has " << dataDown[idxPart] << " (it should be " << (totalNbParticles-1) << ") at index " << cell.getMortonIndex() << "\n";
}
}
});
//Check if the algorithm was good
typedef FTestCell CellClass;
typedef FTestParticleContainer<FReal> ContainerClass;
typedef FSimpleLeaf<FReal, ContainerClass > LeafClass;
typedef FOctree<FReal, CellClass, ContainerClass , LeafClass > OctreeClass;
typedef FTestKernels< CellClass, ContainerClass > KernelClass;
typedef FFmmAlgorithm<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
{
// Usual octree
OctreeClass tree(NbLevels, 2, loader.getBoxWidth(), loader.getCenterOfBox());
for(int idxProc = 0 ; idxProc < mpiComm.global().processCount() ; ++idxProc){
FRandomLoader<FReal> loaderAll(NbParticles, 1.0, FPoint<FReal>(0,0,0), idxProc);
for(FSize idxPart = 0 ; idxPart < loaderAll.getNumberOfParticles() ; ++idxPart){
FPoint<FReal> pos;
MortonIndex id = idxProc*loader.getNumberOfParticles() + idxPart;
loaderAll.fillParticleAtMortonIndex(&pos, id, NbLevels);
tree.insert(pos);
}
}
// Usual algorithm
KernelClass kernels; // FTestKernels FBasicKernels
FmmClass algo(&tree,&kernels); //FFmmAlgorithm FFmmAlgorithmThread
algo.execute();
// Compare the results
groupedTree.forEachCellWithLevel([&](GroupCellClass gcell, const int level){
const CellClass* cell = tree.getCell(gcell.getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should not exist " << gcell.getMortonIndex() << "\n";
}
else {
if(gcell.getDataUp() != cell->getDataUp()){
std::cout << "[Up] Up is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataUp() << " should be " << cell->getDataUp() << "\n";
}
if(gcell.getDataDown() != cell->getDataDown()){
std::cout << "[Down] Down is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataDown() << " should be " << cell->getDataDown() << "\n";
}
}
});
}
return 0;
}
void dumpTreeInfo(GroupOctreeClass& groupedTree, int rank)
......
......@@ -53,7 +53,7 @@ int main(int argc, char* argv[]){
FHelpDescribeAndExit(argc, argv, "Test the blocked tree by counting the particles.",
FParameterDefinitions::OctreeHeight, FParameterDefinitions::NbParticles,
FParameterDefinitions::OctreeSubHeight, FParameterDefinitions::InputFile, LocalOptionBlocSize, Mapping);
int provided = 0;
//int provided = 0;
//MPI_Init_thread(&argc,&argv, MPI_THREAD_SERIALIZED, &provided);
typedef double FReal;
......@@ -114,9 +114,7 @@ int main(int argc, char* argv[]){
// Put the data into the tree
//GroupOctreeClass groupedTree(NbLevels, groupSize, &tree);
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, distributedMortonIndex);
//GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, true);
//GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, true, 0.2);
groupedTree.printInfoBlocks();
// Check tree structure at leaf level
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass gcell, GroupContainerClass* gleaf){
const ContainerClass* src = tree.getLeafSrc(gcell.getMortonIndex());
......@@ -144,6 +142,7 @@ int main(int argc, char* argv[]){
if(groupedTree.getNbCellGroupAtLevel(i) < groupalgo.getNProc())
std::cout << "Error at level " << i << std::endl;
}
return 0;
// Validate the result
for(int idxLevel = 2 ; idxLevel < groupedTree.getHeight() ; ++idxLevel){
for(int idxGroup = 0 ; idxGroup < groupedTree.getNbCellGroupAtLevel(idxLevel) ; ++idxGroup){
......
......@@ -142,7 +142,7 @@ int main(int argc, char* argv[]){
// Run the algorithm
GroupKernelClass groupkernel;
GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel);
groupalgo.execute();
groupalgo.execute(FFmmP2P | FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P);
std::cout << "Wait Others... " << std::endl;
mpiComm.global().barrier();
......
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