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

Add comments and fix some warning.

parent f0414aa7
......@@ -1667,7 +1667,7 @@ protected:
#endif
0);
std::vector<OutOfBlockInteraction>* outsideInteractionsOpposite = new std::vector<OutOfBlockInteraction>(externalInteractionsLeafLevel[idxGroup][idxInteraction].interactions);
for(int i = 0; i < outsideInteractionsOpposite->size(); ++i)
for(unsigned int i = 0; i < outsideInteractionsOpposite->size(); ++i)
{
MortonIndex tmp = outsideInteractionsOpposite->at(i).outIndex;
outsideInteractionsOpposite->at(i).outIndex = outsideInteractionsOpposite->at(i).insideIndex;
......
......@@ -109,7 +109,7 @@ bool parseLine(DagData & dagData, deque<string> & lineElements)
task.id[3] = stoll(lineElements[7]);
task.id[4] = stoll(lineElements[8]);
task.mpiNode = stoi(lineElements[9]);
task.level = task.id[0];
task.level = (int)task.id[0];
dagData.allTask.insert(task);
}
else if(lineElements.size() >= 13 && lineElements[0] == "M2L_out")
......@@ -124,7 +124,7 @@ bool parseLine(DagData & dagData, deque<string> & lineElements)
task.id[3] = stoll(lineElements[10]);
task.id[4] = stoll(lineElements[11]);
task.mpiNode = stoi(lineElements[12]);
task.level = task.id[0];
task.level = (int)task.id[0];
dagData.allTask.insert(task);
}
else if(lineElements.size() >= 13 && lineElements[0] == "M2M")
......@@ -139,7 +139,7 @@ bool parseLine(DagData & dagData, deque<string> & lineElements)
task.id[3] = stoll(lineElements[10]);
task.id[4] = stoll(lineElements[11]);
task.mpiNode = stoi(lineElements[12]);
task.level = task.id[0];
task.level = (int)task.id[0];
dagData.allTask.insert(task);
}
else if(lineElements.size() >= 13 && lineElements[0] == "L2L")
......@@ -154,7 +154,7 @@ bool parseLine(DagData & dagData, deque<string> & lineElements)
task.id[3] = stoll(lineElements[10]);
task.id[4] = stoll(lineElements[11]);
task.mpiNode = stoi(lineElements[12]);
task.level = task.id[0];
task.level = (int)task.id[0];
dagData.allTask.insert(task);
}
else if(lineElements.size() >= 8 && lineElements[0] == "L2P")
......@@ -295,8 +295,11 @@ void compareDag(DagData const& dag1, DagData const& dag2, int const treeHeight)
bool found = false;
Task sameTask[2];
int sameTaskId = 0;
//Count task per level
if(task.level < treeHeight)
++taskCount[omp_get_thread_num()][task.level];
//Look into the second dag to find task in it
//We look for two task because it may be symetrized
for(auto it = dag2.allTask.begin(); it != dag2.allTask.end(); ++it)
{
if(task == *it)
......@@ -307,6 +310,7 @@ void compareDag(DagData const& dag1, DagData const& dag2, int const treeHeight)
break;
}
}
//If the task it not found, print it and count it
if(found == false)
{
#pragma omp critical
......@@ -314,31 +318,21 @@ void compareDag(DagData const& dag1, DagData const& dag2, int const treeHeight)
if(task.level < treeHeight)
++notFoundCount[omp_get_thread_num()][task.level];
}
else
else //else check the mapping
{
bool sameNode = false;
for(int i = 0; i < sameTaskId; ++i)
if(sameTask[i].mpiNode == task.mpiNode)
sameNode = true;
//The tasks are not mapped on the same node
if(!sameNode)
{
#pragma omp critical
{
//task.print();
//sameTask[0].print();//Il y a au moins une tâche identique trouvée
//if(sameTaskId == 2)
//sameTask[1].print();//Il y a au moins une tâche identique trouvée
//cout << sameTaskId << endl;
//cout << endl;
}
if(task.level < treeHeight)
++differenceMapping[omp_get_thread_num()][task.level];
}
}
}
}
#pragma omp taskwait
//Sum results by level and print it
for(int i = 0; i < treeHeight; ++i)
{
long long int sum = 0;
......@@ -351,6 +345,7 @@ void compareDag(DagData const& dag1, DagData const& dag2, int const treeHeight)
sumDiffMapping += differenceMapping[j][i];
sumTaskCount += taskCount[j][i];
}
//Print only if there is error repported on the level
if(sum > 0 || sumDiffMapping > 0)
std::cout << "Diff lvl " << i << " -> " << sum << " (Mapping error : " << sumDiffMapping << "/" << sumTaskCount << ")" << std::endl;
}
......@@ -384,12 +379,11 @@ int main(int argc, char* argv[])
// Get params
const char* const explicitFilename = FParameters::getStr(argc,argv,Explicit.options, "scalfmm_explicit.out");
const char* const implicitFilename = FParameters::getStr(argc,argv,Implicit.options, "scalfmm_implicit.out");
const char* const explicitTraceFilename = FParameters::getStr(argc,argv,Explicit.options, "explicit.rec");
const char* const implicitTraceFilename = FParameters::getStr(argc,argv,Implicit.options, "implicit.rec");
const int treeHeight = FParameters::getValue(argc,argv,TreeHeight.options, 5);
DagData implicitData, explicitData;
bool implicitGood, explicitGood;
//Read data from files and put it into the DAG data structure
std::thread explicitThread([&](){
explicitData.treeHeight = treeHeight;
explicitGood = fillDagData(explicitFilename, explicitData);
......@@ -400,6 +394,7 @@ int main(int argc, char* argv[])
});
implicitThread.join();
explicitThread.join();
//If every thing went good, start comparing
if(implicitGood && explicitGood)
{
cout << explicitData.allTask.size() << " tasks in explicit." << endl;
......
......@@ -103,7 +103,7 @@ int main(int argc, char* argv[]){
const char* const filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/test20k.fma");
LoaderClass loader(filename);
#endif
int mpi_rank, nproc = 8, provided;
int mpi_rank, nproc;
FMpi mpiComm(argc,argv);
mpi_rank = mpiComm.global().processId();
nproc = mpiComm.global().processCount();
......@@ -285,7 +285,7 @@ void sortParticle(FPoint<FReal> * allParticles, int treeHeight, int groupSize, v
for(int i = 0; i < countGroup; ++i)
sizeForEachGroup[treeHeight-1].push_back(groupSize);
if(size_last > 0)
sizeForEachGroup[treeHeight-1].push_back(size_last);
sizeForEachGroup[treeHeight-1].push_back((int)size_last);
}
//Calcul du working interval au niveau des feuilles
......
......@@ -94,7 +94,7 @@ int main(int argc, char* argv[]){
const char* const filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/test20k.fma");
LoaderClass loader(filename);
#endif
int mpi_rank, nproc, provided;
int mpi_rank, nproc;
FMpi mpiComm(argc,argv);
mpi_rank = mpiComm.global().processId();
nproc = mpiComm.global().processCount();
......@@ -147,8 +147,8 @@ int main(int argc, char* argv[]){
treeCheck.insert(allParticlesToSort[idxPart], 0.1);
}
MatrixKernelClass MatrixKernel;
KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), &MatrixKernel);
MatrixKernelClass MatrixKernelValidation;
KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), &MatrixKernelValidation);
FmmClass algorithm(&treeCheck, &kernels);
algorithm.execute(operationsToProceed);
......@@ -314,7 +314,7 @@ void sortParticle(FPoint<FReal> * allParticles, int treeHeight, int groupSize, v
for(int i = 0; i < countGroup; ++i)
sizeForEachGroup[treeHeight-1].push_back(groupSize);
if(size_last > 0)
sizeForEachGroup[treeHeight-1].push_back(size_last);
sizeForEachGroup[treeHeight-1].push_back((int)size_last);
}
//Calcul du working interval au niveau des feuilles
......
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