diff --git a/Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp b/Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp index 3a6aea495158679fd8d1b2dc3b5a625e471a87b8..97271fcbb59eb3e1d0eab2a9ffa5eb7875e5050b 100644 --- a/Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp +++ b/Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp @@ -1018,7 +1018,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, p2mTaskNames.get(), #else - STARPU_NAME, taskNames.print("P2M_nb%d_i%lld_p%lld", + STARPU_NAME, taskNames.print("P2M", "nb%d_i%lld_p%lld", tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getSizeOfInterval(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNbParticlesInGroup()), @@ -1080,7 +1080,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS task->name = m2mTaskNames[idxLevel].get(); #else - task->name = taskNames.print("M2M_l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", + task->name = taskNames.print("M2M", "l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), @@ -1127,7 +1127,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS task->name = m2mTaskNames[idxLevel].get(); #else - task->name = taskNames.print("M2M_l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", + task->name = taskNames.print("M2M", "l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), @@ -1170,7 +1170,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, m2lTaskNames[idxLevel].get(), #else - STARPU_NAME, taskNames.print("M2L_l%d_nb%d_i%lld", + STARPU_NAME, taskNames.print("M2L", "l%d_nb%d_i%lld", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval()), @@ -1205,7 +1205,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, m2lOuterTaskNames[idxLevel].get(), #else - STARPU_NAME, taskNames.print("M2L_out_l%d_nb%d_i%lld_nb%d_i%lld_s%d", + STARPU_NAME, taskNames.print("M2L_out", "l%d_nb%d_i%lld_nb%d_i%lld_s%d", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), @@ -1234,7 +1234,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, m2lOuterTaskNames[idxLevel].get(), #else - STARPU_NAME, taskNames.print("M2L_out_l%d_nb%d_i%lld_nb%d_i%lld_s%d", + STARPU_NAME, taskNames.print("M2L_out", "l%d_nb%d_i%lld_nb%d_i%lld_s%d", idxLevel, tree->getCellGroup(idxLevel,interactionid)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,interactionid)->getSizeOfInterval(), @@ -1307,7 +1307,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS task->name = l2lTaskNames[idxLevel].get(); #else - task->name = taskNames.print("L2L_l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", + task->name = taskNames.print("L2L", "l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), @@ -1357,7 +1357,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS task->name = l2lTaskNames[idxLevel].get(); #else - task->name = taskNames.print("L2L_l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", + task->name = taskNames.print("L2L", "l%d_nb%d_i%lld_nbc%d_ic%lld_s%lld", idxLevel, tree->getCellGroup(idxLevel,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(idxLevel,idxGroup)->getSizeOfInterval(), @@ -1410,7 +1410,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, p2pOuterTaskNames.get(), #else - STARPU_NAME, taskNames.print("P2P_out_nb%d_i%lld_p%lld_nb%d_i%lld_p%lld_s%d", + STARPU_NAME, taskNames.print("P2P_out", "nb%d_i%lld_p%lld_nb%d_i%lld_p%lld_s%d", tree->getParticleGroup(idxGroup)->getNumberOfLeavesInBlock(), tree->getParticleGroup(idxGroup)->getSizeOfInterval(), tree->getParticleGroup(idxGroup)->getNbParticlesInGroup(), @@ -1442,7 +1442,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, p2pTaskNames.get(), #else - STARPU_NAME, taskNames.print("P2P_nb%d_i%lld_p%lld", + STARPU_NAME, taskNames.print("P2P", "nb%d_i%lld_p%lld", tree->getParticleGroup(idxGroup)->getNumberOfLeavesInBlock(), tree->getParticleGroup(idxGroup)->getSizeOfInterval(), tree->getParticleGroup(idxGroup)->getNbParticlesInGroup()), @@ -1484,7 +1484,7 @@ protected: #ifndef SCALFMM_SIMGRID_TASKNAMEPARAMS STARPU_NAME, l2pTaskNames.get(), #else - STARPU_NAME, taskNames.print("L2P_nb%d_i%lld_p%lld", + STARPU_NAME, taskNames.print("L2P", "nb%d_i%lld_p%lld", tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNumberOfCellsInBlock(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getSizeOfInterval(), tree->getCellGroup(tree->getHeight()-1,idxGroup)->getNbParticlesInGroup()), diff --git a/Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp b/Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp index 1afee029e6e34415a55784f820ff72470bb88285..67e09390e5904d9f146cf09d3472378c5ea7fd2f 100644 --- a/Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp +++ b/Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp @@ -14,12 +14,18 @@ class FStarPUTaskNameParams{ protected: std::list names; + FILE* fout; + int taskid; public: - FStarPUTaskNameParams(){ + FStarPUTaskNameParams() : fout(nullptr), taskid(0){ + const char* fname = getenv("SCALFMM_SIMGRIDOUT")?getenv("SCALFMM_SIMGRIDOUT"):"/tmp/scalfmm.out"; + fout = fopen(fname, "w"); + std::cout << "output task name in " << fname << "\n"; } ~FStarPUTaskNameParams(){ + fclose(fout); clear(); } @@ -31,22 +37,30 @@ public: } template - const char* print(const char format[], Params... args ){ + const char* print(const char key[], const char format[], Params... args ){ const size_t length = 512; char* name = new char[length+1]; - snprintf(name, length, format, args...); + snprintf(name, length, "%s_%d", key, taskid++); name[length] = '\0'; names.push_back(name); + + fprintf(fout, "%s=", name); + fprintf(fout, format, args...); + return name; } - const char* add(const char* strToCpy){ - const size_t length = strlen(strToCpy); - char* cpy = new char[length+1]; - memcpy(cpy, length, strToCpy, length); - cpy[length] = '\0'; - names.push_back(cpy); - return cpy; + const char* add(const char key[], const char* strToCpy){ + const size_t length = 512; + char* name = new char[length+1]; + snprintf(name, length, "%s_%d", key, taskid++); + name[length] = '\0'; + names.push_back(name); + + fprintf(fout, "%s=", name); + fprintf(fout, strToCpy); + + return name; } };