Commit 0e30f4d3 authored by COULAUD Olivier's avatar COULAUD Olivier

Fix some problems

parent fec0225f
......@@ -24,8 +24,6 @@
#include "Utils/FLeafBalance.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp"
#include "Kernels/Chebyshev/FChebCell.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
......@@ -80,9 +78,12 @@ int main(int argc, char* argv[])
FParameterDefinitions::NbThreads,
FParameterDefinitions::PeriodicityNbLevels,
localIncreaseBox
)
;
) ;
// Initialize values for MPI
FMpi app(argc,argv);
const bool masterIO = ( app.global().processId() == 0 );
//
const std::string defaultFile("../Data/test20k.fma");
const std::string filename = FParameters::getStr(argc,argv, FParameterDefinitions::InputFile.options, defaultFile.c_str());
const unsigned int TreeHeight = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 5);
......@@ -95,6 +96,7 @@ int main(int argc, char* argv[])
const unsigned int aboveTree = FParameters::getValue(argc, argv, FParameterDefinitions::PeriodicityNbLevels.options, 5);
omp_set_num_threads(NbThreads);
if(masterIO){
std::cout << "\n>> Using " << omp_get_max_threads() << " threads.\n" << std::endl;
//
......@@ -108,14 +110,11 @@ int main(int argc, char* argv[])
std::cout << " Input file name: " << filename << std::endl
<< " Thread count : " << NbThreads << std::endl
<< std::endl;
}
///////// VAR INIT /////////////////////////////////////////////////
// Initialize values for MPI
FMpi app(argc,argv);
const bool masterIO = ( app.global().processId() == 0 );
//
// Initialize timer
FTic time;
......@@ -221,21 +220,19 @@ int main(int argc, char* argv[])
}
// -----------------------------------------------------
std::vector<MortonIndex> mortonLeafDistribution(2*app.global().processCount());
FAbstractAlgorithm * algorithm = nullptr;
FAlgorithmTimers * timer = nullptr;
{ // -----------------------------------------------------
// -----------------------------------------------------
if(masterIO) {
std::cout << "\n"<<interpolationType<<" FMM Proc (ORDER="<< ORDER << ") ... " << std::endl;
}
time.tic();
// Kernels to use (pointer because of the limited size of the stack)
// non periodic FMM algorithm
std::unique_ptr<KernelClass> kernelsNoPer(new KernelClass(TreeHeight, boxWidth,
loader.getCenterOfBox(),&MatrixKernel));
loader.getCenterOfBox(),
&MatrixKernel));
FmmClassProc algoNoPer(app.global(),&tree, kernelsNoPer.get());
//
// periodic FMM algorithm
......@@ -256,20 +253,20 @@ int main(int argc, char* argv[])
}
//
// FMM exectution FFmmFarField FFmmNearField FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L
time.tic();
algorithm->execute();
time.tac();
//
algorithm->getMortonLeafDistribution(mortonLeafDistribution);
if(masterIO)
{
std::cout << app.global().processId() <<" Morton distribution "<< std::endl ;
for(auto v : mortonLeafDistribution)
std::cout << v << " ";
// if(masterIO)
// {
// std::cout << app.global().processId() <<" Morton distribution "<< std::endl ;
// for(auto v : mortonLeafDistribution)
// std::cout << v << " ";
std::cout << std::endl;
}
app.global().barrier();
time.tac();
// std::cout << std::endl;
// }
// app.global().barrier();
timeUsed = time.elapsed();
MPI_Reduce(&timeUsed,&minTime,1,MPI_DOUBLE,MPI_MIN,0,app.global().getComm());
MPI_Reduce(&timeUsed,&maxTime,1,MPI_DOUBLE,MPI_MAX,0,app.global().getComm());
......@@ -287,7 +284,7 @@ int main(int argc, char* argv[])
<< std::endl;
}
}
// -----------------------------------------------------
//
......@@ -344,9 +341,12 @@ int main(int argc, char* argv[])
// -----------------------------------------------------
if(FParameters::existParameter(argc, argv, FParameterDefinitions::OutputFile.options)){
std::vector<MortonIndex> mortonLeafDistribution(2*app.global().processCount());
algorithm->getMortonLeafDistribution(mortonLeafDistribution);
std::string name(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "output.fma"));
FMpiFmaGenericWriter<FReal> paraWriter(name,app);
paraWriter.writeDistributionOfParticlesFromOctree(tree,loader.getNumberOfParticles(),localParticlesNumber,mortonLeafDistribution);
paraWriter.writeDistributionOfParticlesFromOctree(tree,loader.getNumberOfParticles(),localParticlesNumber,
mortonLeafDistribution);
}
return 0;
......
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