Commit 4540806e authored by COULAUD Olivier's avatar COULAUD Olivier

Now Let and duplicated are merged

parent c3e0c4a8
......@@ -386,7 +386,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
endif()
message (STATUS "check BLAS Fortran mangling")
# add options to let the user be able to force a behavior
option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" OFF )
option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" ON )
option( SCALFMM_BLAS_UPCASE "Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)" OFF )
option( SCALFMM_BLAS_NOCHANGE "Set to ON to force calls to BLAS Fortran symbols with no change (ex: dgemm)" OFF )
# if options not changed by user then auto-detection
......
......@@ -44,7 +44,7 @@
//
//
// Order of the Interpolation approximation
static const unsigned ORDER = 7;
static const unsigned ORDER = 6 ;
using FReal = double;
// 1/r kernel
//
......
......@@ -220,7 +220,7 @@ public:
// Construct the local number of particles on my process
FSize nbLocalParticles =0 ,maxPartLeaf =0;
MortonIndex starIndex = mortonLeafDistribution[2*myRank], endIndex = mortonLeafDistribution[2*myRank+1];
myOctree.template forEachCellMyLeaf<typename OCTREECLASS::LeafClass_T >(
myOctree.template forEachCellLeaf<typename OCTREECLASS::LeafClass_T >(
[&](typename OCTREECLASS::GroupSymbolCellClass_T* gsymb ,
typename OCTREECLASS::GroupCellUpClass_T* /* gmul */,
typename OCTREECLASS::GroupCellDownClass_T* /* gloc */,
......@@ -242,7 +242,7 @@ public:
MPI_Offset offset = _headerSize + sizeType*_nbDataTowritePerRecord*before;
//
// Write particles in file
myOctree.template forEachCellMyLeaf<typename OCTREECLASS::LeafClass_T >(
myOctree.template forEachCellLeaf<typename OCTREECLASS::LeafClass_T >(
[&](typename OCTREECLASS::GroupSymbolCellClass_T* gsymb ,
typename OCTREECLASS::GroupCellUpClass_T* /* gmul */,
typename OCTREECLASS::GroupCellDownClass_T* /* gloc */,
......@@ -333,7 +333,5 @@ public:
} ;
#ifdef __EXPRIMENTAL_DOESNT_WORK
#endif
#endif //FMPIFMAGENERICLOADER_HPP
......@@ -52,7 +52,6 @@ namespace groupTree {
){
//
const std::size_t max_level = sizeof(MortonIndex) * 8 / 3;
const FSize totalNumberOfParticles = loader.getNumberOfParticles() ;
const FSize localNumberOfParticles = loader.getMyNumberOfParticles() ;
myParticles.resize(localNumberOfParticles) ;
......@@ -74,11 +73,12 @@ namespace groupTree {
inria::sort(mpi_comm,myParticles, [](const auto& p1, const auto& p2) {
return p1.morton_index < p2.morton_index;
});
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
const FSize totalNumberOfParticles = loader.getNumberOfParticles() ;
std::cout << " I have " << myParticles.size() << " particles ..." << std::endl;
std::cout << "For a total of "
<< totalNumberOfParticles << " particles ..." << std::endl;
#endif
// create the linear tree
// a linear tree is a tree, with only the leaf
int level = TreeHeight -1 ;
......@@ -120,7 +120,9 @@ namespace groupTree {
width, width/FReal(1<<(TreeHeight-1)));
// Now i can fill the localGroupTree
localGroupTree->create_tree(group_linear_tree,myParticles);
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
localGroupTree->printInfoBlocks();
#endif
// get the index particle distribution (needed by the algorithm)
m_idx_distribution = group_linear_tree.get_index_particle_distribution_implicit();
......@@ -151,10 +153,12 @@ namespace groupTree {
//
// Build the groupe size of all groups in the Tree (sequential one)
//
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
std::cout << "Morton distribution inside BuilddMortonDistributionForCGroupCellInTree " <<std::endl;
for (auto v : MortonIndexDistribution)
std::cout << " " << v ;
std::cout << std::endl;
#endif
int processId ;
for( processId = 0; processId < nproc; ++processId)
{
......@@ -176,7 +180,7 @@ namespace groupTree {
int countCellsInTheGroup = 0;
MortonIndex previousMortonCell = -1;
std::cout << "Compute Level " << idxLevel << std::endl;
// std::cout << "Compute Level " << idxLevel << std::endl;
for(std::size_t idxLeaf = 0; idxLeaf < mortonLeaves.size(); ++idxLeaf)
{
MortonIndex mortonCell = (mortonLeaves[idxLeaf]) >> (3*(TreeHeight - 1 - idxLevel));
......@@ -205,10 +209,12 @@ namespace groupTree {
if(countCellsInTheGroup > 0)
sizeForEachGroup[idxLevel].push_back(countCellsInTheGroup);
//
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
// Print sizeForEachGroup at the current level
for( auto v : sizeForEachGroup[idxLevel])
std::cout << " "<< v ;
std::cout << std::endl;
#endif
}
......@@ -257,10 +263,10 @@ namespace groupTree {
//
//loader
std::cout << "Opening : " << filename << " ...";
// std::cout << "Opening : " << filename << " ...";
FFmaGenericLoader<FReal> loader(filename);
FAssertLF(loader.isOpen());
std::cout << " done." << std::endl;
// std::cout << " done." << std::endl;
const FSize totalNbParticles = loader.getNumberOfParticles();
//
const std::size_t max_level = sizeof(PARTICLE_T::morton_index) * 8 / 3;
......@@ -302,7 +308,7 @@ namespace groupTree {
++nbLeaves ;
}
}
std::cout<< "Number of leaves" << nbLeaves <<std::endl ;
// std::cout<< "Number of leaves" << nbLeaves <<std::endl ;
std::vector<MortonIndex> mortonLeaves(nbLeaves,-1) ;
previousMorton = myParticles[0].morton_index;
......@@ -351,14 +357,17 @@ namespace groupTree {
//
}
// otherwise we use the given Morton distribution
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
std::cout << " Morton distribution to build the duplicated tree " <<MortonIndexDistribution.size() << " "<<std::endl<<std::flush;
for (auto v : MortonIndexDistribution)
std::cout << " " << v ;
std::cout << std::endl;
#endif
//////////////////////////////////////////////////////////////////////////
std::vector< std::vector<std::vector<MortonIndex>>> nodeRepartition;
std::vector< std::vector<int>> sizeForEachGroup(TreeHeight);
createNodeRepartition(MortonIndexDistribution, nodeRepartition, nproc, TreeHeight) ;
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
for ( std::size_t idLevel=0; idLevel< nodeRepartition.size() ; ++idLevel){
std::cout << " nodeRepartition at level " << idLevel << std::endl ;
for ( std::size_t procID=0 ; procID< nodeRepartition[idLevel].size(); ++procID){
......@@ -367,10 +376,11 @@ namespace groupTree {
<< nodeRepartition[idLevel][procID][1] <<" ]" <<std::endl ;
}
}
#endif
BuilddMortonDistributionForCGroupCellInTree(parallelManager,mortonLeaves,TreeHeight,groupSize,
MortonIndexDistribution,nodeRepartition,sizeForEachGroup ) ;
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
//
// Print group size per level
std::cout << std::endl<< " Group size at the leaf level " << std::endl ;
......@@ -384,13 +394,12 @@ namespace groupTree {
}
std::cout << std::endl ;std::cout << " Total number of leaves: " <<totalLeaves << std::endl;
}
#endif
//
GroupTree = new OCTREEGRPOUPCLASS (TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(),
groupSize, &allParticles, sizeForEachGroup, true);
//
//
}
}
......
......@@ -79,9 +79,9 @@ void checkWithDuplicatedTree( const int& myrank, const PARTICLE &arrayParticles,
// Compute a sequential FMM
algorithm.execute(operationsToProceed);
//
std::string fileName("output-Let-") ;
fileName += std::to_string(myrank) + ".fma" ;
groupTree::saveSolutionInFile(fileName, arrayParticles.size() ,treeCheck) ;
// std::string fileName("output-Let-") ;
// fileName += std::to_string(myrank) + ".fma" ;
// groupTree::saveSolutionInFile(fileName, arrayParticles.size() ,treeCheck) ;
groupTree::checkCellTree(grouptree, groupalgo, treeCheck, epsilon) ;
groupTree::checkLeaves(grouptree, groupalgo, treeCheck, epsilon) ;
......
......@@ -3,9 +3,9 @@
#ifndef FGROUPOFCELLS_HPP
#define FGROUPOFCELLS_HPP
#include "../../Utils/FAssert.hpp"
#include "../../Utils/FAlignedMemory.hpp"
#include "../../Containers/FTreeCoordinate.hpp"
#include "Utils/FAssert.hpp"
#include "Utils/FAlignedMemory.hpp"
#include "Containers/FTreeCoordinate.hpp"
#include "../StarPUUtils/FStarPUDefaultAlign.hpp"
#include <list>
......@@ -20,9 +20,9 @@ class FGroupOfCells {
struct alignas(FStarPUDefaultAlign::StructAlign) BlockHeader{
MortonIndex startingIndex;
MortonIndex endingIndex;
int numberOfCellsInBlock;
int idxGlobal;
bool isMine;
int numberOfCellsInBlock;
int idxGlobal; ///< Global index of the group in the Octree
bool isMine; ///< true if I own the group
};
protected:
......@@ -155,11 +155,11 @@ public:
FAssertLF(size_t(ptrBuff-memoryBuffer) == allocatedMemoryInByte);
// Init header
blockHeader->startingIndex = inStartingIndex;
blockHeader->endingIndex = inEndingIndex;
blockHeader->startingIndex = inStartingIndex;
blockHeader->endingIndex = inEndingIndex;
blockHeader->numberOfCellsInBlock = inNumberOfCells;
blockHeader->idxGlobal = -1;
blockHeader->isMine = false;
blockHeader->idxGlobal = -1;
blockHeader->isMine = false;
#ifndef SCALFMM_SIMGRID_NODATA
cellMultipoles = (PoleCellClass*)FAlignedMemory::AllocateBytes<32>(inNumberOfCells*sizeof(PoleCellClass));
cellLocals = (LocalCellClass*)FAlignedMemory::AllocateBytes<32>(inNumberOfCells*sizeof(LocalCellClass));
......
#ifndef FGROUPTOOLS_HPP
#define FGROUPTOOLS_HPP
#include <vector>
#include "ScalFmmConfig.h"
#include "Utils/FGlobal.hpp"
#include "Utils/FPoint.hpp"
......@@ -26,12 +28,10 @@ namespace groupTree {
const FPoint<FReal>& getPosition() const{
return pos;
}
const auto& physicalValue() const{
const FReal& physicalValue() const{
return phi;
}
const auto& getPositions() const {
return pos;
}
void fill(const position_t &inPos, const FReal &inPhyVal, MortonIndex & inMortonIndex){
pos = inPos ; phi = inPhyVal ; morton_index = inMortonIndex ;
}
......@@ -138,8 +138,8 @@ namespace groupTree {
//
std::vector<bool> OK(groupedTree.getHeight(),true) ;
groupedTree.forEachCellWithLevel(
[&](typename GROUPTREE_T::GroupSymbolCellClass_T* gsymb ,
groupedTree.forEachMyCellWithLevel(
[&](typename GROUPTREE_T::GroupSymbolCellClass_T* gsymb ,
typename GROUPTREE_T::GroupCellUpClass_T* gmul ,
typename GROUPTREE_T::GroupCellDownClass_T* gloc ,
const int level)
......@@ -155,6 +155,11 @@ namespace groupTree {
FMath::FAccurater<FReal> diffUp;
diffUp.add(cell->getMultipoleData().get(0), gmul->get(0), gmul->getVectorSize());
if(diffUp.getRelativeInfNorm() > epsilon || diffUp.getRelativeL2Norm() > epsilon){
auto * data1 = gmul->get(0);
auto * data2 = cell->getMultipoleData().get(0);
for (int i = 0; i < gmul->getVectorSize(); ++i) {
std::cout << i << " "<< data1[i] << " seq "<< data2[i] <<std::endl;
}
std::cout << "[Up] Up is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << diffUp << "\n";
OK[level] = false ;
......@@ -179,9 +184,9 @@ namespace groupTree {
void checkLeaves(GROUPTREE_T &groupedTree, GROUPALGO_T & groupalgo, OCTTREE_T &treeCheck, const FReal &epsilon){
//
FMath::FAccurater<FReal> potentialGlobalDiff;
const int NbLevels = groupedTree.getHeight();
const int leafLevel = groupedTree.getHeight() - 1;
bool OK = true ;
groupedTree.template forEachCellMyLeaf<typename GROUPTREE_T::LeafClass_T >(
groupedTree.template forEachCellLeaf<typename GROUPTREE_T::LeafClass_T >(
[&](typename GROUPTREE_T::GroupSymbolCellClass_T* gsymb ,
typename GROUPTREE_T::GroupCellUpClass_T* /* gmul */,
typename GROUPTREE_T::GroupCellDownClass_T* /* gloc */,
......@@ -189,7 +194,7 @@ namespace groupTree {
)
{
if(groupalgo.isDataOwnedBerenger(gsymb->getMortonIndex(), NbLevels-1))
if(groupalgo.isDataOwnedBerenger(gsymb->getMortonIndex(), leafLevel) )// just needed if we have duplicated tree
{
const auto * targets = treeCheck.getLeafSrc(gsymb->getMortonIndex());
if(targets == nullptr){
......@@ -225,7 +230,7 @@ namespace groupTree {
FMath::FAccurater<FReal> fx, fy, fz;
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
if(gposX[idxPart] != posX[idxPart] || gposY[idxPart] != posY[idxPart] || gposZ[idxPart] != posZ[idxPart]){
std::cout << "[Empty] Not the same particlea at " << gsymb->getMortonIndex() << " idx " << idxPart << " "
std::cout << "[Empty] Not the same particle at " << gsymb->getMortonIndex() << " idx " << idxPart << " "
<< gposX[idxPart] << " " << posX[idxPart] << " " << gposY[idxPart] << " " << posY[idxPart]
<< " " << gposZ[idxPart] << " " << posZ[idxPart] << "\n";
OK = false ;
......
......@@ -16,7 +16,7 @@
#include "FGroupOfCells.hpp"
#include "FGroupOfParticles.hpp"
#include "FGroupAttachedLeaf.hpp"
#include "../../Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#ifdef SCALFMM_USE_MPI
#include "FDistributedGroupTreeBuilder.hpp"
#endif
......@@ -681,12 +681,13 @@ public:
const FTreeCoordinate host = FCoordinateComputer::GetCoordinateFromPositionAndCorner<FReal>(this->boxCorner, this->boxWidth,
_treeHeight,
FPoint<FReal>(xpos[idxPart], ypos[idxPart], zpos[idxPart]) );
const MortonIndex particleIndex = host.getMortonIndex();
particlesToSort[idxPart].mindex = particleIndex;
// const MortonIndex particleIndex = host.getMortonIndex();
particlesToSort[idxPart].mindex = host.getMortonIndex();
particlesToSort[idxPart].originalIndex = idxPart;
}
}
// Sort if needed
if(particlesAreSorted == false){
FQuickSort<ParticleSortingStruct, FSize>::QsOmp(particlesToSort, nbParticles, [](const ParticleSortingStruct& v1, const ParticleSortingStruct& v2){
......@@ -729,10 +730,10 @@ public:
sizeOfBlock, lastParticle-firstParticle);
///////////////////////// TO REMOVE ?? //////////////
#include <iostream>
using namespace std;
if(currentBlockIndexes[sizeOfBlock-1]+1 == 511)
cout << "Suricate" << endl;
// #include <iostream>
// using namespace std;
// if(currentBlockIndexes[sizeOfBlock-1]+1 == 511)
// cout << "Suricate" << endl;
/////////////////////////////////////////////////////
// Init cells
......@@ -761,6 +762,7 @@ public:
}
// Keep the block
newBlock->declare_mine();
_cellBlocksPerLevel[idxLevel].push_back(newBlock);
_particleBlocks.push_back(newParticleBlock);
......@@ -1019,62 +1021,47 @@ public:
}
/**
* @brief forEachLeaf iterate on the cell and apply the function
* @param function
* @brief forEachLeaf iterate on the cells that i own and apply the function on the leaves
*
* We iterate on the owned group and for for each group we iterate on its cells.
* We obtain the leaf through the morton index of the cell and we apply the function on it.
*
* @param function function to apply on each leaf
*
*/
template<class ParticlesAttachedClass>
void forEachCellLeaf(std::function<void(SymbolCellClass*,PoleCellClass*,LocalCellClass*,ParticlesAttachedClass*)> function){
CellGroupIterator iterCells = _cellBlocksPerLevel[_treeHeight-1].begin();
CellGroupIterator iterCells = _cellBlocksPerLevel[_treeHeight-1].begin();
const CellGroupIterator iterEndCells = _cellBlocksPerLevel[_treeHeight-1].end();
ParticleGroupIterator iterLeaves = _particleBlocks.begin();
ParticleGroupIterator iterLeaves = _particleBlocks.begin();
const ParticleGroupIterator iterEndLeaves = _particleBlocks.end();
while(iterCells != iterEndCells && iterLeaves != iterEndLeaves){
// int count = 0 ;
// Iterate on Cell group and Leaf group
while(iterCells != iterEndCells && iterLeaves != iterEndLeaves){
//
// Iterate all Cells inside the group
(*iterCells)->forEachCell(
[&](SymbolCellClass* symb,
PoleCellClass* mult,
LocalCellClass* loc)
{
const int leafIdx = (*iterLeaves)->getLeafIndex(symb->getMortonIndex());
FAssertLF(leafIdx != -1);
ParticlesAttachedClass aLeaf = (*iterLeaves)->template getLeaf <ParticlesAttachedClass>(leafIdx);
FAssertLF(aLeaf.isAttachedToSomething());
function(symb, mult, loc, &aLeaf);
});
++iterCells;
++iterLeaves;
}
FAssertLF(iterCells == iterEndCells && iterLeaves == iterEndLeaves);
}
template<class ParticlesAttachedClass>
void forEachCellMyLeaf(std::function<void(SymbolCellClass*,PoleCellClass*,LocalCellClass*,ParticlesAttachedClass*)> function){
CellGroupIterator iterCells = _cellBlocksPerLevel[_treeHeight-1].begin();
const CellGroupIterator iterEndCells = _cellBlocksPerLevel[_treeHeight-1].end();
ParticleGroupIterator iterLeaves = _particleBlocks.begin();
const ParticleGroupIterator iterEndLeaves = _particleBlocks.end();
// The group of cells is mine --> Leaf exist
// std::cout << " forEachCellLeaf " << (*iterCells)->isMine() << " morton " << symb->getMortonIndex()
// << " leafIdx " << (*iterLeaves)->getLeafIndex(symb->getMortonIndex())
// << " count " <<count <<std::endl;
if ((*iterCells)->isMine() ) {
while(iterCells != iterEndCells && iterLeaves != iterEndLeaves){
if((*iterCells)->isMine()){
(*iterCells)->forEachCell(
[&](SymbolCellClass* symb,
PoleCellClass* mult,
LocalCellClass* loc)
{
// get leafindex (position in the group) from the Morton index
const int leafIdx = (*iterLeaves)->getLeafIndex(symb->getMortonIndex());
// Leaf exists and we apply function on it
FAssertLF(leafIdx != -1);
ParticlesAttachedClass aLeaf = (*iterLeaves)->template getLeaf <ParticlesAttachedClass>(leafIdx);
FAssertLF(aLeaf.isAttachedToSomething());
function(symb, mult, loc, &aLeaf);
});
}
}
// ++count;
});
++iterCells;
++iterLeaves;
}
......@@ -1083,6 +1070,37 @@ public:
}
// template<class ParticlesAttachedClass>
// void forEachCellMyLeaf(std::function<void(SymbolCellClass*,PoleCellClass*,LocalCellClass*,ParticlesAttachedClass*)> function){
// CellGroupIterator iterCells = _cellBlocksPerLevel[_treeHeight-1].begin();
// const CellGroupIterator iterEndCells = _cellBlocksPerLevel[_treeHeight-1].end();
// ParticleGroupIterator iterLeaves = _particleBlocks.begin();
// const ParticleGroupIterator iterEndLeaves = _particleBlocks.end();
// while(iterCells != iterEndCells && iterLeaves != iterEndLeaves){
// if((*iterCells)->isMine()){
// (*iterCells)->forEachCell(
// [&](SymbolCellClass* symb,
// PoleCellClass* mult,
// LocalCellClass* loc)
// {
// const int leafIdx = (*iterLeaves)->getLeafIndex(symb->getMortonIndex());
// FAssertLF(leafIdx != -1);
// ParticlesAttachedClass aLeaf = (*iterLeaves)->template getLeaf <ParticlesAttachedClass>(leafIdx);
// FAssertLF(aLeaf.isAttachedToSomething());
// function(symb, mult, loc, &aLeaf);
// });
// }
// ++iterCells;
// ++iterLeaves;
// }
// FAssertLF(iterCells == iterEndCells && iterLeaves == iterEndLeaves);
// }
/** @brief, for statistic purpose, display each block with number of
* cell, size of header, starting index, and ending index
*/
......
......@@ -531,10 +531,10 @@ struct FMath{
/** Add value to the current list */
void add(const FReal inGood, const FReal inBad){
l2Diff += (inBad - inGood) * (inBad - inGood);
l2Dot += inGood * inGood;
max = Max(max , Abs(inGood));
maxDiff = Max(maxDiff, Abs(inGood-inBad));
l2Diff += (inBad - inGood) * (inBad - inGood);
l2Dot += inGood * inGood;
max = Max(max , Abs(inGood));
maxDiff = Max(maxDiff, Abs(inGood-inBad));
nbElements += 1 ;
}
/** Add array of values */
......
#ifndef _VALIDATION_METHOD_
#define _VALIDATION_METHOD_
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Kernels/Chebyshev/FChebCell.hpp"
#include "../../Src/Kernels/Chebyshev/FChebSymKernel.hpp"
#include "../../Src/Core/FFmmAlgorithmThreadProc.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "Src/Components/FSimpleLeaf.hpp"
#include "Src/Containers/FOctree.hpp"
#include ".Src/Core/FFmmAlgorithmThreadProc.hpp"
#include "GroupTree/Core/FP2PGroupParticleContainer.hpp"
#include "../../Src/Utils/FMpi.hpp"
#include "../../Src/Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "../../Src/GroupTree/Core/FP2PGroupParticleContainer.hpp"
#include "../../Src/Kernels/Uniform/FUnifCell.hpp"
#include "../../Src/Kernels/Uniform/FUnifKernel.hpp"
#include "../../Src/Kernels/Chebyshev/FChebCell.hpp"
#include "../../Src/Kernels/Chebyshev/FChebSymKernel.hpp"
namespace validation_methods
{
......
......@@ -23,7 +23,7 @@
#include "GroupTree/Core/FP2PGroupParticleContainer.hpp"
// file loader
#include "Files/FMpiFmaGenericLoader.hpp"
//#include "Files/FmaGenericLoader.hpp"
#include "Files/FTreeMpiCsvSaver.hpp"
// FBox
#include "Adaptive/FBox.hpp"
// Group linear tree
......@@ -60,13 +60,12 @@ using GroupCellUpClass = typename CellClass::multipole_t;
using GroupCellDownClass = typename CellClass::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
using GroupContainerClass = FP2PGroupParticleContainer<FReal>;
using GroupOctreeClass = FGroupTree<FReal,GroupCellSymbClass,
GroupCellUpClass,
GroupCellDownClass, GroupContainerClass, 1, 4, FReal>;
using GroupOctreeClass = FGroupTree<FReal,GroupCellSymbClass,GroupCellUpClass,
GroupCellDownClass, GroupContainerClass, 1, 4, FReal>;
// definition of algorithm structure
using GroupKernelClass = FStarPUAllCpuCapacities<FInterpolationKernel
<FReal, CellClass,GroupContainerClass,MatrixKernelClass,ORDER>>;
using GroupKernelClass = FStarPUAllCpuCapacities<FInterpolationKernel<FReal, CellClass,
GroupContainerClass,MatrixKernelClass,ORDER>>;
using GroupCpuWrapper = FStarPUCpuWrapper<
typename GroupOctreeClass::CellGroupClass, CellClass, GroupKernelClass,
......@@ -89,6 +88,7 @@ int main(int argc, char *argv[]) {
"Test the blocked tree created with linear tree." ,
FParameterDefinitions::OctreeHeight,
FParameterDefinitions::InputFile,
FParameterDefinitions::OutputFile,
LocalOptionBlocSize,
LocalOptionValidate, LocalOptionBuildTree);
......@@ -165,7 +165,9 @@ int main(int argc, char *argv[]) {
nb_block =0;
}
time.tac();
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
computeOnGroupTree->printInfoBlocks();
#endif
std::cout << title << mortonCellDistribution.size() << std::endl;
for ( auto v : mortonCellDistribution)
std::cout << " " << v ;
......@@ -178,26 +180,22 @@ int main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////////
//
// define the operation to proceed
// FFmmNearField only Near field
// FFmmFarField only Far field
// FFmmNearAndFarFields full FMM
// By operator FFmmP2P| FFmmP2M | | FFmmM2M FFmmM2L | FFmmL2L | FFmmL2P
const unsigned int operationsToProceed = FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P ;
// FFmmNearField only Near field
// FFmmFarField only Far field
// FFmmNearAndFarFields full FMM
// By operator FFmmP2P| FFmmP2M | | FFmmM2M FFmmM2L | FFmmL2L | FFmmL2P
const unsigned int operationsToProceed = FFmmP2P | FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P ;
const MatrixKernelClass MatrixKernel;
GroupKernelClass groupkernel(TreeHeight, width, box.center() , &MatrixKernel);
std::cout << " end GroupKernelClass " << std::endl ;
GroupAlgorithm groupalgo(computeOnGroupTree,&groupkernel, mortonCellDistribution,nb_block);
std::cout << " end GroupAlgorithm " << std::endl ;
// wait all proc
FTic timerExecute;
FMpiComm.global().barrier(); // Synchronization for timer
// start new timer
timerExecute.tic();
// starpu_fxt_start_profiling();
std::cout << " start groupalgo.execute " << std::endl ;
groupalgo.execute(operationsToProceed);
std::cout << " end groupalgo.execute " << std::endl ;
computeOnGroupTree->printInfoBlocks();
FMpiComm.global().barrier();
......@@ -207,7 +205,7 @@ int main(int argc, char *argv[]) {
// print times
double minTime,maxTime,meanTime ;
groupTree::timeAverage(FMpiComm, timeElapsed, minTime, maxTime, meanTime) ;
std::cout << " time (in sec.) on node: " << timeElapsed
std::cout << " FMM time (in sec.) on node: " << timeElapsed
<< " min " << minTime << " max " << maxTime
<< " mean " << meanTime << std::endl;
//
......@@ -239,32 +237,28 @@ int main(int argc, char *argv[]) {
if(FParameters::existParameter(argc, argv, LocalOptionValidate.options) == true){
// Check the result with a previous computation
// The resuls are stored in the files
using CellClass1 = FInterpolationCell<FReal, ORDER>;
typedef FP2PParticleContainer<FReal> ContainerClass;
typedef FSimpleLeaf<FReal, ContainerClass > LeafClass;
using OctreeClass = FOctree<FReal, CellClass1,ContainerClass,LeafClass> ;
using KernelClass = FInterpolationKernel<FReal,CellClass1,ContainerClass,MatrixKernelClass,ORDER> ;
using FmmClass = FFmmAlgorithm<OctreeClass,CellClass1,ContainerClass,KernelClass,LeafClass> ;
using OctreeClass = FOctree<FReal, CellClass,ContainerClass,LeafClass> ;
using KernelClass = FInterpolationKernel<FReal,CellClass,ContainerClass,MatrixKernelClass,ORDER> ;
using FmmClass = FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> ;
const int SubTreeHeight=3;
OctreeClass treeCheck(TreeHeight, SubTreeHeight,width,box.center());
const FReal epsilon = 1E-10;
KernelClass kernels(TreeHeight, width, box.center(), &MatrixKernel);
//
if(optionBuildTree > 0 ){
for(std::size_t idxPart = 0 ; idxPart < myParticles.size() ; ++idxPart){
// put in tree
treeCheck.insert(myParticles[idxPart].getPosition(),
myParticles[idxPart].physicalValue());
// std::cout << idxPart<< " " << myParticles[idxPart].getPosition() << " " << myParticles[idxPart].physicalValue() <<std::endl;
}
FmmClass algorithm(&treeCheck, &kernels);
checkWithDuplicatedTree(FMpiComm.global().processId(), myParticles,treeCheck, algorithm,
*computeOnGroupTree,groupalgo,operationsToProceed,epsilon );
}
else {
std::cerr << " check Not yet implemented " << std::endl ;
// We introduce a sequetial loader to read the particles from the file
// the particles are sort as in the Let tree construction
// then we insert the particles in an FOctree (not a grouped one)
FFmaGenericLoader<FReal> seqLoader(filename);
readAndSortAllParticle(seqLoader, box, myParticles, TreeHeight ) ;
for(std::size_t idxPart = 0 ; idxPart < myParticles.size() ; ++idxPart){
......@@ -272,13 +266,21 @@ int main(int argc, char *argv[]) {
treeCheck.insert(myParticles[idxPart].getPosition(),
myParticles[idxPart].physicalValue());
}
FmmClass algorithm(&treeCheck, &kernels);
}
FmmClass algorithm(&treeCheck, &kernels);
checkWithDuplicatedTree(FMpiComm.global().processId(), myParticles,treeCheck, algorithm,
*computeOnGroupTree,groupalgo,operationsToProceed,epsilon );
checkWithDuplicatedTree(FMpiComm.global().processId(), myParticles,treeCheck, algorithm,
*computeOnGroupTree,groupalgo,operationsToProceed,epsilon );
}
}
//
// Store the output position,rho, Potential, Force in file
// Only binary write is available
if(FParameters::existParameter(argc, argv, FParameterDefinitions::OutputFile.options)){
std::string outputFile(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "outputMPIFMA"));
FMpiFmaGenericWriter<FReal> paraWriter(outputFile,FMpiComm);
paraWriter.writeDistributionOfParticlesFromOctree(*computeOnGroupTree,loader.getNumberOfParticles(),mortonCellDistribution);
}
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