diff --git a/Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp b/Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp index 9ece3e4ac0acbfe55d1143cbf1b65d2dea2736a9..fbbc2fbd0fffe0d194e411546ed039ee8dad183b 100644 --- a/Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp +++ b/Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp @@ -41,9 +41,7 @@ #include "../OpenCl/FOpenCLDeviceWrapper.hpp" #endif #define SCALFMM_SIMGRID_TASKNAMEPARAMS -#ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS #include "../StarPUUtils/FStarPUTaskNameParams.hpp" -#endif #include "Containers/FBoolArray.hpp" #include <iostream> @@ -147,8 +145,9 @@ protected: std::unique_ptr<char[]> l2pTaskNames; std::unique_ptr<char[]> p2pTaskNames; std::unique_ptr<char[]> p2pOuterTaskNames; + FStarPUTaskNameParams* taskNames; #else - FStarPUTaskNameParams taskNames; + FStarPUTaskNameParams* taskNames; #endif #endif #ifdef SCALFMM_STARPU_USE_PRIO @@ -156,7 +155,6 @@ protected: #endif int mpi_rank, nproc; std::vector<std::vector<std::vector<MortonIndex>>> nodeRepartition; - std::list<char*> taskName; public: FGroupTaskStarPUImplicitAlgorithm(OctreeClass*const inTree, KernelClass* inKernels, std::vector<MortonIndex>& distributedMortonIndex) @@ -187,6 +185,7 @@ public: FAssertLF(starpu_mpi_init ( 0, 0, 1 ) == 0); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); MPI_Comm_size(MPI_COMM_WORLD,&nproc); + taskNames = new FStarPUTaskNameParams(mpi_rank); cout << mpi_rank << "/" << nproc << endl; starpu_malloc_set_align(32); @@ -344,8 +343,6 @@ public: starpu_arbiter_destroy(arbiterGlobal); #endif - for(char* ptr : taskName) - free(ptr); starpu_mpi_shutdown(); starpu_shutdown(); } @@ -858,34 +855,6 @@ protected: } } } - 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* 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; - } int dataMappingBerenger(MortonIndex const idx, int const idxLevel) const { //return idxLevel%4; for(int i = 0; i < nproc; ++i) @@ -1118,14 +1087,15 @@ protected: STARPU_RW, cellHandles[tree->getHeight()-1][idxGroup].up, STARPU_R, particleHandles[idxGroup].symb, #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameP2M("p2m", idxGroup, starpu_mpi_data_get_rank(cellHandles[tree->getHeight()-1][idxGroup].up)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"P2M-nb_i_p" - STARPU_NAME, taskNames.print("P2M", "%d, %lld, %lld\n", + STARPU_NAME, taskNames->print("P2M", "%d, %lld, %lld, %lld, %lld, %d\n", tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getSizeOfInterval(), - tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock()), + tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[tree->getHeight()-1][idxGroup].up)), #endif #endif 0); @@ -1168,18 +1138,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly STARPU_R, cellHandles[idxLevel+1][idxSubGroup].up, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].up)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"M2M-l_nb_i_nbc_ic_s" - STARPU_NAME, taskNames.print("M2M", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("M2M", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].up)), #endif #endif 0); @@ -1204,18 +1177,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly STARPU_R, cellHandles[idxLevel+1][idxSubGroup].up, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].up)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //M2M-l_nb_i_nbc_ic_s - STARPU_NAME, taskNames.print("M2M", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("M2M", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].up)), #endif #endif 0); @@ -1249,14 +1225,17 @@ protected: STARPU_R, cellHandles[idxLevel][idxGroup].up, (STARPU_RW | STARPU_COMMUTE_IF_SUPPORTED), cellHandles[idxLevel][idxGroup].down, #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, idxGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"M2L-l_nb_i" - STARPU_NAME, taskNames.print("M2L", "%d, %d, %lld\n", + STARPU_NAME, taskNames->print("M2L", "%d, %d, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval()), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), #endif #endif 0); @@ -1286,17 +1265,20 @@ protected: STARPU_R, cellHandles[idxLevel][interactionid].symb, STARPU_R, cellHandles[idxLevel][interactionid].up, #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"M2L_out-l_nb_i_nb_i_s - STARPU_NAME, taskNames.print("M2L_out", "%d, %d, %lld, %d, %lld, %d\n", + STARPU_NAME, taskNames->print("M2L_out", "%d, %d, %lld, %d, %lld, %d, %lld, %lld, %lld, %lld, %d\n", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel,interactionid)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,interactionid)->getSizeOfInterval(), - outsideInteractions->size()), + outsideInteractions->size(), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getStartingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), #endif #endif 0); @@ -1317,17 +1299,20 @@ protected: STARPU_R, cellHandles[idxLevel][idxGroup].symb, STARPU_R, cellHandles[idxLevel][idxGroup].up, #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2l2", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][interactionid].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"M2L_out-l_nb_i_nb_i_s" - STARPU_NAME, taskNames.print("M2L_out", "%d, %d, %lld, %d, %lld, %d\n", + STARPU_NAME, taskNames->print("M2L_out", "%d, %d, %lld, %d, %lld, %d, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,interactionid)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,interactionid)->getSizeOfInterval(), tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), - outsideInteractions->size()), + tree->getCellGroup(idxLevel,interactionid)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,interactionid)->getSizeOfInterval(), + outsideInteractions->size(), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getStartingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), #endif #endif 0); @@ -1376,18 +1361,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly STARPU_RW, cellHandles[idxLevel+1][idxSubGroup].down, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"L2L-l_nb_i_nbc_ic_s" - STARPU_NAME, taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), #endif #endif 0); @@ -1406,18 +1394,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly (STARPU_RW | STARPU_COMMUTE_IF_SUPPORTED), cellHandles[idxLevel+1][idxSubGroup].down, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"L2L-l_nb_i_nbc_ic_s" - STARPU_NAME, taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), #endif #endif 0); @@ -1444,18 +1435,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly STARPU_RW, cellHandles[idxLevel+1][idxSubGroup].down, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"L2L-l_nb_i_nbc_ic_s" - STARPU_NAME, taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), #endif #endif 0); @@ -1474,18 +1468,21 @@ protected: STARPU_R, cellHandles[idxLevel+1][idxSubGroup].symb, //symbolique, readonly (STARPU_RW | STARPU_COMMUTE_IF_SUPPORTED), cellHandles[idxLevel+1][idxSubGroup].down, //level d'avant readonly #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"L2L-l_nb_i_nbc_ic_s" - STARPU_NAME, taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld\n", + STARPU_NAME, taskNames->print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", idxLevel, - tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), - tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), + tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), + tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getSizeOfInterval(), FMath::Min(tree->getCellGroup(idxLevel,idxGroup)->getEndingIndex()-1, (tree->getCellGroup(idxLevel+1,idxSubGroup)->getEndingIndex()-1)>>3)- - FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3)), + FMath::Max(tree->getCellGroup(idxLevel,idxGroup)->getStartingIndex(), tree->getCellGroup(idxLevel+1,idxSubGroup)->getStartingIndex()>>3), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(cellHandles[idxLevel+1][idxSubGroup].down)), #endif #endif 0); @@ -1531,18 +1528,21 @@ protected: STARPU_EXECUTE_ON_DATA, particleHandles[interactionid].down, #endif #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameP2P("p2p", idxGroup, interactionid, starpu_mpi_data_get_rank(particleHandles[interactionid].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"P2P_out-nb_i_p_nb_i_p_s" - STARPU_NAME, taskNames.print("P2P_out", "%d, %lld, %lld, %d, %lld, %lld, %d\n", + STARPU_NAME, taskNames->print("P2P_out", "%d, %lld, %lld, %d, %lld, %lld, %d, %lld, %lld, %lld, %lld, %d\n", tree->getParticleGroup(idxGroup)->getNumberOfLeavesInBlock(), tree->getParticleGroup(idxGroup)->getSizeOfInterval(), tree->getParticleGroup(idxGroup)->getNbParticlesInGroup(), tree->getParticleGroup(interactionid)->getNumberOfLeavesInBlock(), tree->getParticleGroup(interactionid)->getSizeOfInterval(), tree->getParticleGroup(interactionid)->getNbParticlesInGroup(), - outsideInteractions->size()), + outsideInteractions->size(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + tree->getParticleGroup(interactionid)->getStartingIndex(), + tree->getParticleGroup(interactionid)->getEndingIndex(), + starpu_mpi_data_get_rank(particleHandles[interactionid].down)), #endif #endif 0); @@ -1565,14 +1565,17 @@ protected: (STARPU_RW | STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down, #endif #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameP2P("p2p", idxGroup, idxGroup, starpu_mpi_data_get_rank(particleHandles[idxGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"P2P-nb_i_p" - STARPU_NAME, taskNames.print("P2P", "%d, %lld, %lld\n", + STARPU_NAME, taskNames->print("P2P", "%d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", tree->getParticleGroup(idxGroup)->getNumberOfLeavesInBlock(), tree->getParticleGroup(idxGroup)->getSizeOfInterval(), - tree->getParticleGroup(idxGroup)->getNbParticlesInGroup()), + tree->getParticleGroup(idxGroup)->getNbParticlesInGroup(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(particleHandles[idxGroup].down)), #endif #endif 0); @@ -1609,14 +1612,15 @@ protected: (STARPU_RW | STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down, #endif #ifdef STARPU_USE_TASK_NAME - #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS - STARPU_NAME, getTaskNameP2M("l2p", idxGroup, starpu_mpi_data_get_rank(particleHandles[idxGroup].down)), - #else + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS //"L2P-nb_i_p" - STARPU_NAME, taskNames.print("L2P", "%d, %lld, %lld\n", + STARPU_NAME, taskNames->print("L2P", "%d, %lld, %lld, %lld, %lld, %d\n", tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getSizeOfInterval(), - tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock()), + tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + starpu_mpi_data_get_rank(particleHandles[idxGroup].down)), #endif #endif 0); diff --git a/Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp b/Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp index 1de974bc730a79a17a7499ab630e9d829b246e6a..d8200754e92f575f7abc04918707b8147d3fb4e3 100644 --- a/Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp +++ b/Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp @@ -48,6 +48,7 @@ #include "../StarPUUtils/FStarPUReduxCpu.hpp" +#include "../StarPUUtils/FStarPUTaskNameParams.hpp" template <class OctreeClass, class CellContainerClass, class KernelClass, class ParticleGroupClass, class StarPUCpuWrapperClass #ifdef SCALFMM_ENABLE_CUDA_KERNEL @@ -149,14 +150,7 @@ protected: #endif #ifdef STARPU_USE_TASK_NAME - std::vector<std::unique_ptr<char[]>> m2mTaskNames; - std::vector<std::unique_ptr<char[]>> m2lTaskNames; - std::vector<std::unique_ptr<char[]>> m2lOuterTaskNames; - std::vector<std::unique_ptr<char[]>> l2lTaskNames; - std::unique_ptr<char[]> p2mTaskNames; - std::unique_ptr<char[]> l2pTaskNames; - std::unique_ptr<char[]> p2pTaskNames; - std::unique_ptr<char[]> p2pOuterTaskNames; + FStarPUTaskNameParams taskNames; #endif #ifdef SCALFMM_STARPU_USE_PRIO typedef FStarPUFmmPrioritiesV2 PrioClass;// FStarPUFmmPriorities @@ -177,6 +171,9 @@ public: #endif #ifdef SCALFMM_ENABLE_OPENCL_KERNEL openclWrapper(tree->getHeight()), + #endif + #ifdef STARPU_USE_TASK_NAME + taskNames(inComm.processId()), #endif wrapperptr(&wrappers){ FAssertLF(tree, "tree cannot be null"); @@ -229,7 +226,6 @@ public: #ifdef STARPU_SUPPORT_ARBITER arbiterGlobal = starpu_arbiter_create(); #endif - initCodelet(); initCodeletMpi(); rebuildInteractions(); @@ -251,32 +247,6 @@ public: } void buildTaskNames(){ -#ifdef STARPU_USE_TASK_NAME - const int namesLength = 128; - m2mTaskNames.resize(tree->getHeight()); - m2lTaskNames.resize(tree->getHeight()); - m2lOuterTaskNames.resize(tree->getHeight()); - l2lTaskNames.resize(tree->getHeight()); - for(int idxLevel = 0 ; idxLevel < tree->getHeight() ; ++idxLevel){ - m2mTaskNames[idxLevel].reset(new char[namesLength]); - snprintf(m2mTaskNames[idxLevel].get(), namesLength, "M2M-level-%d", idxLevel); - m2lTaskNames[idxLevel].reset(new char[namesLength]); - snprintf(m2lTaskNames[idxLevel].get(), namesLength, "M2L-level-%d", idxLevel); - m2lOuterTaskNames[idxLevel].reset(new char[namesLength]); - snprintf(m2lOuterTaskNames[idxLevel].get(), namesLength, "M2L-out-level-%d", idxLevel); - l2lTaskNames[idxLevel].reset(new char[namesLength]); - snprintf(l2lTaskNames[idxLevel].get(), namesLength, "L2L-level-%d", idxLevel); - } - - p2mTaskNames.reset(new char[namesLength]); - snprintf(p2mTaskNames.get(), namesLength, "P2M"); - l2pTaskNames.reset(new char[namesLength]); - snprintf(l2pTaskNames.get(), namesLength, "L2P"); - p2pTaskNames.reset(new char[namesLength]); - snprintf(p2pTaskNames.get(), namesLength, "P2P"); - p2pOuterTaskNames.reset(new char[namesLength]); - snprintf(p2pOuterTaskNames.get(), namesLength, "P2P-out"); -#endif } void syncData(){ @@ -459,68 +429,6 @@ 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(){ memset(&p2m_cl, 0, sizeof(p2m_cl)); @@ -1685,7 +1593,15 @@ protected: STARPU_RW, cellHandles[tree->getHeight()-1][idxGroup].up, STARPU_R, particleHandles[idxGroup].symb, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameP2M("p2m", idxGroup, comm.processId()), + #ifdef SCALFMM_SIMGRID_TASKNAMEPARAMS + STARPU_NAME, taskNames.print("P2M", "%d, %lld, %lld, %lld, %lld, %d\n", + 0, + 0, + 0, + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + comm.processId()), + #endif #endif 0); } @@ -1740,7 +1656,19 @@ protected: task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId()); + STARPU_NAME, taskNames.print("M2M", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); + #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -1775,7 +1703,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2M("m2m", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId()); + task->name = taskNames.print("M2M", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -1862,7 +1801,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosM2M(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2MUsingInfo("m2m", idxLevel, tree->getNbCellGroupAtLevel(idxLevel)-1, idxLevel+1, firstOtherBlock + nbSubCellGroups, comm.processId()); + task->name = taskNames.print("M2M", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, tree->getNbCellGroupAtLevel(idxLevel)-1)->getStartingIndex(), + tree->getCellGroup(idxLevel, tree->getNbCellGroupAtLevel(idxLevel)-1)->getEndingIndex(), + processesBlockInfos[idxLevel+1][firstOtherBlock + nbSubCellGroups].firstIndex, + processesBlockInfos[idxLevel+1][firstOtherBlock + nbSubCellGroups].lastIndex, + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -1934,7 +1884,18 @@ protected: STARPU_R, remoteCellGroups[idxLevel][interactionid].handleSymb, STARPU_R, remoteCellGroups[idxLevel][interactionid].handleUp, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameM2MUsingInfo("m2l", idxLevel, idxGroup, idxLevel, interactionid, comm.processId()), + STARPU_NAME, taskNames.print("M2L_out", "%d, %d, %lld, %d, %lld, %d, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + processesBlockInfos[idxLevel][interactionid].firstIndex, + processesBlockInfos[idxLevel][interactionid].lastIndex, + comm.processId()), #endif 0); } @@ -1965,7 +1926,16 @@ protected: STARPU_R, cellHandles[idxLevel][idxGroup].up, (STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), cellHandles[idxLevel][idxGroup].down, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, idxGroup, comm.processId()), + //"M2L-l_nb_i" + STARPU_NAME, taskNames.print("M2L", "%d, %d, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + comm.processId()), #endif 0); } @@ -1994,7 +1964,18 @@ protected: STARPU_R, cellHandles[idxLevel][interactionid].symb, STARPU_R, cellHandles[idxLevel][interactionid].up, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameM2M("m2l", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), + STARPU_NAME, taskNames.print("M2L_out", "%d, %d, %lld, %d, %lld, %d, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getStartingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getEndingIndex(), + comm.processId()), #endif 0); @@ -2013,7 +1994,18 @@ protected: STARPU_R, cellHandles[idxLevel][idxGroup].symb, STARPU_R, cellHandles[idxLevel][idxGroup].up, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameM2M("m2l2", idxLevel, idxGroup, idxLevel, interactionid, starpu_mpi_data_get_rank(cellHandles[idxLevel][idxGroup].down)), + STARPU_NAME, taskNames.print("M2L_out", "%d, %d, %lld, %d, %lld, %d, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getStartingIndex(), + tree->getCellGroup(idxLevel, interactionid)->getEndingIndex(), + comm.processId()), #endif 0); } @@ -2164,7 +2156,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2MUsingInfoRevert("l2l", idxLevel, firstOtherBlock, idxLevel+1, idxSubGroup, comm.processId()); + task->name = taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + processesBlockInfos[idxLevel][firstOtherBlock].firstIndex, + processesBlockInfos[idxLevel][firstOtherBlock].lastIndex, + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -2198,7 +2201,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2MUsingInfoRevert("l2l", idxLevel, firstOtherBlock, idxLevel+1, idxSubGroup, comm.processId()); + task->name = taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + processesBlockInfos[idxLevel][firstOtherBlock].firstIndex, + processesBlockInfos[idxLevel][firstOtherBlock].lastIndex, + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); @@ -2256,7 +2270,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId()); + task->name = taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -2295,7 +2320,18 @@ protected: task->priority = PrioClass::Controller().getInsertionPosL2L(idxLevel); #endif #ifdef STARPU_USE_TASK_NAME - task->name = getTaskNameM2M("l2l", idxLevel, idxGroup, idxLevel+1, idxSubGroup, comm.processId()); + task->name = taskNames.print("L2L", "%d, %d, %lld, %d, %lld, %lld, %lld, %lld, %lld, %lld, %d\n", + idxLevel, + 0, + 0, + 0, + 0, + 0, + tree->getCellGroup(idxLevel, idxGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel, idxGroup)->getEndingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getStartingIndex(), + tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex(), + comm.processId()); #endif FAssertLF(starpu_task_submit(task) == 0); } @@ -2325,7 +2361,20 @@ protected: (STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down, STARPU_R, remoteParticleGroupss[interactionid].handleSymb, #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameP2PUsingInfo("p2p", idxGroup, interactionid, comm.processId()), + //"P2P_out-nb_i_p_nb_i_p_s" + STARPU_NAME, taskNames.print("P2P_out", "%d, %lld, %lld, %d, %lld, %lld, %d, %lld, %lld, %lld, %lld, %d\n", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + processesBlockInfos[tree->getHeight()-1][interactionid].firstIndex, + processesBlockInfos[tree->getHeight()-1][interactionid].lastIndex, + comm.processId()), #endif 0); } @@ -2367,7 +2416,19 @@ protected: (STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[interactionid].down, #endif #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameP2P("p2p", idxGroup, interactionid, comm.processId()), + STARPU_NAME, taskNames.print("P2P_out", "%d, %lld, %lld, %d, %lld, %lld, %d, %lld, %lld, %lld, %lld, %d\n", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + tree->getParticleGroup(interactionid)->getStartingIndex(), + tree->getParticleGroup(interactionid)->getEndingIndex(), + comm.processId()), #endif 0); } @@ -2388,7 +2449,12 @@ protected: (STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down, #endif #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameP2P("p2p", idxGroup, idxGroup, comm.processId()), + STARPU_NAME, taskNames.print("P2P", "0, 0, 0, %lld, %lld, %lld, %lld, %d\n", + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + comm.processId()), #endif 0); } @@ -2423,7 +2489,13 @@ protected: (STARPU_RW|STARPU_COMMUTE_IF_SUPPORTED), particleHandles[idxGroup].down, #endif #ifdef STARPU_USE_TASK_NAME - STARPU_NAME, getTaskNameP2M("l2p", idxGroup, comm.processId()), + STARPU_NAME, taskNames.print("L2P", "%d, %lld, %lld, %lld, %lld, %d\n", + 0, + 0, + 0, + tree->getParticleGroup(idxGroup)->getStartingIndex(), + tree->getParticleGroup(idxGroup)->getEndingIndex(), + comm.processId()), #endif 0); } diff --git a/Tests/GroupTree/compareDAGmapping.cpp b/Tests/GroupTree/compareDAGmapping.cpp index 91278201bccc9d81b0fb557e2bd00194c479b521..a7b63f6d816c3193fef2a4bfdc4f15eecf9883a9 100644 --- a/Tests/GroupTree/compareDAGmapping.cpp +++ b/Tests/GroupTree/compareDAGmapping.cpp @@ -5,79 +5,180 @@ #include <vector> #include <regex> #include <thread> +#include <deque> +#include <unordered_set> using namespace std; #include "../../Src/Utils/FGlobal.hpp" #include "../../Src/Utils/FMath.hpp" #include "../../Src/Utils/FParameters.hpp" #include "../../Src/Utils/FParameterNames.hpp" +enum TaskType {P2M = 0, M2M, M2L, M2L_OUT, L2L, L2P, P2P, P2P_OUT}; +string taskNames[] = {"P2M", "M2M", "M2L", "M2L_out", "L2L", "L2P", "P2P", "P2P_out"}; +struct Task +{ + TaskType type; + long long int uniqueId; + vector<long long int> id; + int mpiNode; + int level; + bool operator==(const Task & other) const + { + if(type != other.type || id.size() != other.id.size()) + return false; + for(size_t i = 0; i < id.size(); ++i) + if(id[i] != other.id[i]) + return false; + return true; + } + bool operator!=(const Task & other) const + { + return !((*this)==other); + } + void print(void) + { + cout << taskNames[type]; + for(size_t i = 0; i < id.size(); ++i) + cout << ", " << id[i]; + cout << endl; + } +}; +//Spécialisation de hash pour le type Task +namespace std { + template <> struct hash<Task> + { + size_t operator()(const Task & x) const + { + return x.uniqueId; + } + }; +} struct DagData { - + unordered_set<Task> allTask; }; -void parseLine(DagData & dagData, string& line) + +bool parseLine(DagData & dagData, deque<string> & lineElements) { - std::regex regexAct("^([a-z0-9]+)_"); - std::regex regexArgP2M("^[a-z0-9]+_([0-9]+)_([0-9]+)_([0-9])$"); - std::regex regexArgM2M("^[a-z0-9]+_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$"); - std::regex regexArgP2P("^[a-z0-9]+_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$"); - std::smatch matches; - if(std::regex_search (line,matches,regexAct)) - { - if(matches[1] == "p2m") - { - std::regex_search (line,matches,regexArgP2M); - int startMorton = stoi(matches[1], nullptr,10); - int endMorton = stoi(matches[2], nullptr,10); - int node = stoi(matches[3], nullptr,10); - } - else if(matches[1] == "m2m") - { - std::regex_search (line,matches,regexArgM2M); - int level = stoi(matches[1], nullptr,10); - int startMorton = stoi(matches[2], nullptr,10); - int endMorton = stoi(matches[3], nullptr,10); - int startMorton2 = stoi(matches[4], nullptr,10); - int endMorton2 = stoi(matches[5], nullptr,10); - int node = stoi(matches[6], nullptr,10); - } - else if(matches[1] == "m2l") - { - std::regex_search (line,matches,regexArgM2M); - int level = stoi(matches[1], nullptr,10); - int startMorton = stoi(matches[2], nullptr,10); - int endMorton = stoi(matches[3], nullptr,10); - int startMorton2 = stoi(matches[4], nullptr,10); - int endMorton2 = stoi(matches[5], nullptr,10); - int node = stoi(matches[6], nullptr,10); - } - else if(matches[1] == "l2l") - { - std::regex_search (line,matches,regexArgM2M); - int level = stoi(matches[1], nullptr,10); - int startMorton = stoi(matches[2], nullptr,10); - int endMorton = stoi(matches[3], nullptr,10); - int startMorton2 = stoi(matches[4], nullptr,10); - int endMorton2 = stoi(matches[5], nullptr,10); - int node = stoi(matches[6], nullptr,10); - } - else if(matches[1] == "l2p") - { - std::regex_search (line,matches,regexArgP2M); - int startMorton = stoi(matches[1], nullptr,10); - int endMorton = stoi(matches[2], nullptr,10); - int node = stoi(matches[3], nullptr,10); - } - else if(matches[1] == "p2p") - { - std::regex_search (line,matches,regexArgP2P); - int startMorton = stoi(matches[1], nullptr,10); - int endMorton = stoi(matches[2], nullptr,10); - int startMorton2 = stoi(matches[3], nullptr,10); - int endMorton2 = stoi(matches[4], nullptr,10); - int node = stoi(matches[5], nullptr,10); - } + if(lineElements.size() < 1) + return false; + Task task; + if(lineElements.size() >= 14 && lineElements[0] == "P2P_out") + { + task.type = P2P_OUT; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(4); + task.id[0] = stoll(lineElements[9]); + task.id[1] = stoll(lineElements[10]); + task.id[2] = stoll(lineElements[11]); + task.id[3] = stoll(lineElements[12]); + task.mpiNode = stoi(lineElements[13]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 10 && lineElements[0] == "P2P") + { + task.type = P2P; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(4); + task.id[0] = stoll(lineElements[5]); + task.id[1] = stoll(lineElements[6]); + task.id[2] = stoll(lineElements[7]); + task.id[3] = stoll(lineElements[8]); + if(task.id[0] == 0 && task.id[1] == 0 && task.id[2] == 0 && task.id[3] == 0) + cout << "Suricate" << endl; + task.mpiNode = stoi(lineElements[9]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 10 && lineElements[0] == "M2L" ) + { + task.type = M2L; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(5); + task.id[0] = stoll(lineElements[2]); + task.id[1] = stoll(lineElements[5]); + task.id[2] = stoll(lineElements[6]); + task.id[3] = stoll(lineElements[7]); + task.id[4] = stoll(lineElements[8]); + task.mpiNode = stoi(lineElements[9]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 13 && lineElements[0] == "M2L_out") + { + task.type = M2L_OUT; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(5); + task.id[0] = stoll(lineElements[2]); + task.id[1] = stoll(lineElements[8]); + task.id[2] = stoll(lineElements[9]); + task.id[3] = stoll(lineElements[10]); + task.id[4] = stoll(lineElements[11]); + task.mpiNode = stoi(lineElements[12]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 13 && lineElements[0] == "M2M") + { + task.type = M2M; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(5); + task.id[0] = stoll(lineElements[2]); + task.id[1] = stoll(lineElements[8]); + task.id[2] = stoll(lineElements[9]); + task.id[3] = stoll(lineElements[10]); + task.id[4] = stoll(lineElements[11]); + task.mpiNode = stoi(lineElements[12]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 13 && lineElements[0] == "L2L") + { + task.type = L2L; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(5); + task.id[0] = stoll(lineElements[2]); + task.id[1] = stoll(lineElements[8]); + task.id[2] = stoll(lineElements[9]); + task.id[3] = stoll(lineElements[10]); + task.id[4] = stoll(lineElements[11]); + task.mpiNode = stoi(lineElements[12]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 8 && lineElements[0] == "L2P") + { + task.type = L2P; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(2); + task.id[0] = stoll(lineElements[5]); + task.id[1] = stoll(lineElements[6]); + task.mpiNode = stoi(lineElements[7]); + dagData.allTask.insert(task); + } + else if(lineElements.size() >= 8 && lineElements[0] == "P2M") + { + task.type = L2P; + task.uniqueId = stoll(lineElements[1]); + task.id.resize(2); + task.id[0] = stoll(lineElements[5]); + task.id[1] = stoll(lineElements[6]); + task.mpiNode = stoi(lineElements[7]); + dagData.allTask.insert(task); + } + else + { + cout << "No match for " << lineElements[0] << " - " << lineElements.size() << endl; + return false; + } + return true; +} +void split(string& line, string const& delim, deque<string> &result) +{ + size_t prevPos = 0; + size_t pos = 0; + while((pos = line.find(delim, prevPos)) != string::npos) + { + result.push_back(line.substr(prevPos, pos-prevPos)); + prevPos = pos+delim.size(); } + if(prevPos < line.size()) + result.push_back(line.substr(prevPos)); } bool fillDagData(const char* const filename, DagData & dagData) { @@ -89,21 +190,53 @@ bool fillDagData(const char* const filename, DagData & dagData) return false; } string line; + string delim(", "); + deque<string> splitLine; + int count = 0; while(!fichier.eof()) { + ++count; getline(fichier, line); - if(line.size() > 3 && line[0] == 'N') - { - line = line.substr(3); - parseLine(dagData, line); - } + splitLine.clear(); + split(line, delim, splitLine); + parseLine(dagData, splitLine); } + cout << (count-1) << " lines in " << filename << endl; // instructions fichier.close(); // on ferme le fichier return true; } -void compareDag(DagData& dag1, DagData& dag2) +void compareDag(DagData& dag1, DagData& dag2, int treeHeight) { + long long int notFoundCount[treeHeight] = {0}; + bool notFound[treeHeight] = {false}; + for(Task task : dag1.allTask) + { + bool found = false; + if(task.type == P2P || task.type == P2P_OUT || task.type == P2M || task.type == L2P) + notFound[treeHeight-1] = true; + else if(task.id[0] < treeHeight) + ++notFound[task.id[0]] = true; + for(Task task2 : dag2.allTask) + { + if(task == task2) + { + found = true; + break; + } + } + if(found == false) + { + task.print(); + if(task.type == P2P || task.type == P2P_OUT || task.type == P2M || task.type == L2P) + ++notFoundCount[treeHeight-1]; + else + ++notFoundCount[task.id[0]]; + } + } + for(int i = 0; i < treeHeight; ++i) + if(notFound[i] == true) + cout << "Diff lvl " << i << " -> " << notFoundCount[i] << endl; } int main(int argc, char* argv[]){ const FParameterNames Explicit { @@ -114,23 +247,32 @@ int main(int argc, char* argv[]){ {"-i"} , "Trace from implicit mpi" }; - FHelpDescribeAndExit(argc, argv, "Compare DAG mapping", Explicit, Implicit); + const FParameterNames TreeHeight { + {"-h"}, + "Height of the tree" + }; + FHelpDescribeAndExit(argc, argv, "Compare DAG mapping", Explicit, Implicit, TreeHeight); // Get params const char* const explicitFilename = FParameters::getStr(argc,argv,Explicit.options, "explicit.rec"); const char* const implicitFilename = FParameters::getStr(argc,argv,Implicit.options, "implicit.rec"); + const int treeHeight = FParameters::getValue(argc,argv,TreeHeight.options, 5); DagData implicitData, explicitData; bool implicitGood, explicitGood; - std::thread implicitThread([&](){ + std::thread explicitThread([&](){ explicitGood = fillDagData(explicitFilename, explicitData); }); - std::thread explicitThread([&](){ + explicitThread.join(); + std::thread implicitThread([&](){ implicitGood = fillDagData(implicitFilename, implicitData); }); implicitThread.join(); - explicitThread.join(); if(implicitGood && explicitGood) - compareDag(implicitData, explicitData); + { + cout << explicitData.allTask.size() << " tasks in explicit." << endl; + cout << implicitData.allTask.size() << " tasks in implicit." << endl; + compareDag(explicitData, implicitData, treeHeight); + } return 0; } diff --git a/Tests/GroupTree/testBlockedImplicitAlgorithm.cpp b/Tests/GroupTree/testBlockedImplicitAlgorithm.cpp index 12d83cd95720a41e752ffad3e4fd06d6a94ce18e..a6c70f034b09fb4158f8080c721261cf2bb4b82a 100644 --- a/Tests/GroupTree/testBlockedImplicitAlgorithm.cpp +++ b/Tests/GroupTree/testBlockedImplicitAlgorithm.cpp @@ -139,7 +139,7 @@ int main(int argc, char* argv[]){ int rank = groupalgo.getRank(); for(int i = 0; i < groupedTree.getHeight(); ++i) { - if(groupedTree.getNbCellGroupAtLevel(i) < groupalgo.getNProc()) + if(groupedTree.getNbCellGroupAtLevel(i) < groupalgo.getNProc() && rank == 0) std::cout << "Error at level " << i << std::endl; } return 0; diff --git a/Tests/GroupTree/testBlockedMpiAlgorithm.cpp b/Tests/GroupTree/testBlockedMpiAlgorithm.cpp index 321912d81119f90bec5124a41307dc387a97627e..509c9c600731716cbbdbe3c697c5de566861fdd0 100644 --- a/Tests/GroupTree/testBlockedMpiAlgorithm.cpp +++ b/Tests/GroupTree/testBlockedMpiAlgorithm.cpp @@ -72,7 +72,7 @@ int main(int argc, char* argv[]){ // Get params const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5); const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20)); - const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 250); + const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 8); const FSize totalNbParticles = (NbParticles*mpiComm.global().processCount()); // Load the particles @@ -90,7 +90,8 @@ int main(int argc, char* argv[]){ std::unique_ptr<TestParticle[]> particles(new TestParticle[loader.getNumberOfParticles()]); memset(particles.get(), 0, sizeof(TestParticle) * loader.getNumberOfParticles()); for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ - loader.fillParticle(&particles[idxPart].position); + loader.fillParticleAtMortonIndex(&(particles[idxPart].position), mpiComm.global().processId()*NbParticles + idxPart,NbLevels); + //loader.fillParticle(&(particles[idxPart].position)); } // Sort in parallel FVector<TestParticle> myParticles; @@ -129,10 +130,16 @@ int main(int argc, char* argv[]){ } 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"; - + for(int i = 0; i < mpiComm.global().processCount(); ++i) + { + if(i == mpiComm.global().processId()) + { + 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"; + } + mpiComm.global().barrier(); + } // Put the data into the tree GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, @@ -142,7 +149,7 @@ int main(int argc, char* argv[]){ // Run the algorithm GroupKernelClass groupkernel; GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel); - groupalgo.execute(FFmmP2P | FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P); + groupalgo.execute(); std::cout << "Wait Others... " << std::endl; mpiComm.global().barrier(); @@ -173,7 +180,8 @@ int main(int argc, char* argv[]){ FRandomLoader<FReal> loaderAll(NbParticles, 1.0, FPoint<FReal>(0,0,0), idxProc); for(FSize idxPart = 0 ; idxPart < loaderAll.getNumberOfParticles() ; ++idxPart){ FPoint<FReal> pos; - loaderAll.fillParticle(&pos); + //loaderAll.fillParticle(&pos); + loaderAll.fillParticleAtMortonIndex(&pos, idxProc*NbParticles + idxPart,NbLevels); tree.insert(pos); } } diff --git a/compile_dag_result.sh b/compile_dag_result.sh new file mode 100755 index 0000000000000000000000000000000000000000..81df751fb82eec775175e1880ee92825011bcb57 --- /dev/null +++ b/compile_dag_result.sh @@ -0,0 +1,27 @@ +#!/bin/sh +export SCALFMM_SIMGRIDOUT='scalfmm.out' +make testBlockedImplicitAlgorithm generateMapping testBlockedMpiAlgorithm compareDAGmapping -j16 +if [ $? -ne 0 ]; then + exit +fi +mpiexec -n 8 ./Tests/Release/testBlockedMpiAlgorithm -nb 8 -bs 8 -h 3 +if [ $? -ne 0 ]; then + exit +fi + +a=`ls $SCALFMM_SIMGRIDOUT\_*` +rm -f $SCALFMM_SIMGRIDOUT +echo $a +for i in $a; do + echo $i + cat $i >> $SCALFMM_SIMGRIDOUT +done + +cp -f $SCALFMM_SIMGRIDOUT scalfmm_explicit.out +mpiexec -n 8 ./Tests/Release/generateMapping -nb 8 -bs 8 -h 3 +mpiexec -n 8 ./Tests/Release/testBlockedImplicitAlgorithm -map mapping -f canard.fma -bs 8 -h 3 +if [ $? -ne 0 ]; then + exit +fi +cp -f scalfmm.out_0 scalfmm_implicit.out +./Tests/Release/compareDAGmapping -e scalfmm_explicit.out -i scalfmm_implicit.out -h 3 > output