Commit 98d24a41 authored by Berenger Bramas's avatar Berenger Bramas

update mpi_implcit to rebase against master

parent b57cf433
...@@ -122,6 +122,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ ...@@ -122,6 +122,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "SCALFMM_USE_STARPU" OFF)
endif() endif()
message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" ) message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" )
# #
...@@ -460,63 +461,14 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ ...@@ -460,63 +461,14 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
find_package(FFTW COMPONENTS SIMPLE) find_package(FFTW COMPONENTS SIMPLE)
endif() endif()
message(STATUS " SCALFMM USE MKL ") if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
if( SCALFMM_USE_MKL_AS_BLAS ) endif()
if (FFTW_LIBRARIES_DEP)
unset(FFT_LIBRARIES CACHE) foreach (fft_lib ${FFTW_LIBRARIES_DEP})
message(STATUS " SCALFMM USE MKL already defined") set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
set(FFT_INCLUDES "$ENV{MKLROOT}/include/fftw" CACHE STRING "Set your MKL flags") endforeach()
if (BLAS_FOUND) endif()
set(FFTW_FOUND ON)
endif()
else(SCALFMM_USE_MKL_AS_BLAS)
# The package can be used with the following COMPONENTS:
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW COMPONENTS MKL) # not REQUIRED
if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
endif()
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
endforeach()
endif()
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}")
endif()
endif(SCALFMM_USE_MKL_AS_BLAS)
else(SCALFMM_USE_MKL_AS_FFTW)
message(STATUS " SCALFMM USE FFTW ")
# The package can be used with the following COMPONENTS:
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW COMPONENTS SIMPLE) # not REQUIRED
#message(FATAL_ERROR ${FFTW_FOUND} ${FFTW_LIBRARY_DIRS_DEP} ${FFTW_LIBRARIES_DEP})
if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your FFTW path")
endif()
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
endforeach()
endif()
#message(FATAL_ERROR ${FFTW_INCLUDE_DIRS_DEP})
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}")
endif()
if(FFTW_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${FFTW_LIBRARY_DIRS}")
endif()
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" ) set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES) if (FFT_LIBRARIES)
......
...@@ -230,7 +230,7 @@ private: ...@@ -230,7 +230,7 @@ private:
std::cerr << "File "<< filename<<" not opened! Error: " << strerror(errno) <<std::endl; std::cerr << "File "<< filename<<" not opened! Error: " << strerror(errno) <<std::endl;
std::exit( EXIT_FAILURE); std::exit( EXIT_FAILURE);
} }
FLOG(FLog::Controller << "Opened file "<< filename << "\n"); std::cout << "Opened file "<< filename << std::endl;
} }
public: public:
...@@ -271,8 +271,8 @@ public: ...@@ -271,8 +271,8 @@ public:
} else if( filename.find(".fma")!=std::string::npos ) { } else if( filename.find(".fma")!=std::string::npos ) {
binaryFile = false; binaryFile = false;
} else { } else {
std::cerr << "FFmaGenericLoader: " std::cout << "FFmaGenericLoader: "
<< "Only .fma or .bfma input file are allowed. Got " << "Only .fma or .bfma input file are allowed. Got "
<< filename << "." << filename << "."
<< std::endl; << std::endl;
std::exit ( EXIT_FAILURE) ; std::exit ( EXIT_FAILURE) ;
...@@ -350,31 +350,6 @@ public: ...@@ -350,31 +350,6 @@ public:
unsigned int getDataType(){ unsigned int getDataType(){
return typeData[0]; } return typeData[0]; }
/**
* Fills a particle from the current position in the file.
*
* @param outParticlePositions the position of particle to fill (FPoint<FReal> class)
* @param outPhysicalValue the physical value of particle to fill (FReal)
*/
void fillParticle(FPoint<FReal>*const outParticlePositions){
if(binaryFile){
file->read((char*)(outParticlePositions), sizeof(FReal)*3);
if(otherDataToRead> 0){
file->read((char*)(this->tmpVal), sizeof(FReal)*otherDataToRead);
}
} else {
FReal x,y,z;
(*this->file) >> x >> y >> z;
outParticlePositions->setPosition(x,y,z);
if(otherDataToRead> 0){
for (FSize i = 0 ; i <otherDataToRead; ++i){
(*this->file) >> x ;
}
}
}
}
/** /**
* Fills a particle from the current position in the file. * Fills a particle from the current position in the file.
* *
...@@ -506,25 +481,25 @@ private: ...@@ -506,25 +481,25 @@ private:
this->readAscciHeader(); this->readAscciHeader();
} }
FLOG(FLog::Controller << " nbParticles: " <<this->nbParticles << std::endl std::cout << " nbParticles: " <<this->nbParticles << std::endl
<< " Box width: " <<this->boxWidth << "\n" << " Box width: " <<this->boxWidth << std::endl
<< " Center: " << this->centerOfBox << "\n"); << " Center: " << this->centerOfBox << std::endl;
} }
void readAscciHeader() { void readAscciHeader() {
FLOG(FLog::Controller << " File open in ASCII mode\n"); std::cout << " File open in ASCII mode "<< std::endl ;
FReal x,y,z; FReal x,y,z;
(*this->file) >> typeData[0]>> typeData[1]; (*this->file) >> typeData[0]>> typeData[1];
FLOG(FLog::Controller << " Datatype "<< typeData[0] << " "<< typeData[1] << "\n"); std::cout << " Datatype "<< typeData[0] << " "<< typeData[1] << std::endl;
(*this->file) >> this->nbParticles >> this->boxWidth >> x >> y >> z; (*this->file) >> this->nbParticles >> this->boxWidth >> x >> y >> z;
this->centerOfBox.setPosition(x,y,z); this->centerOfBox.setPosition(x,y,z);
this->boxWidth *= 2; this->boxWidth *= 2;
otherDataToRead = typeData[1] - (unsigned int)(4); otherDataToRead = typeData[1] - (unsigned int)(4);
}; };
void readBinaryHeader(){ void readBinaryHeader(){
FLOG(FLog::Controller << " File open in binary mode\n"); std::cout << " File open in binary mode "<< std::endl;
file->seekg (std::ios::beg); file->seekg (std::ios::beg);
file->read((char*)&typeData,2*sizeof(unsigned int)); file->read((char*)&typeData,2*sizeof(unsigned int));
FLOG(FLog::Controller << " Datatype "<< typeData[0] << " "<< typeData[1] << "\n"); std::cout << " Datatype "<< typeData[0] << " "<< typeData[1] << std::endl;
if(typeData[0] != sizeof(FReal)){ if(typeData[0] != sizeof(FReal)){
std::cerr << "Size of elements in part file " << typeData[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl; std::cerr << "Size of elements in part file " << typeData[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl;
std::exit( EXIT_FAILURE); std::exit( EXIT_FAILURE);
...@@ -610,7 +585,7 @@ public: ...@@ -610,7 +585,7 @@ public:
this->file->precision(10); this->file->precision(10);
} }
else { else {
std::cerr << "Input file not allowed only .fma or .bfma extensions" <<std::endl; std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl;
std::exit ( EXIT_FAILURE) ; std::exit ( EXIT_FAILURE) ;
} }
// test if open // test if open
...@@ -671,7 +646,7 @@ public: ...@@ -671,7 +646,7 @@ public:
void writeHeader(const FPoint<FReal> &centerOfBox,const FReal &boxWidth, const FSize &nbParticles, const typePart data) { void writeHeader(const FPoint<FReal> &centerOfBox,const FReal &boxWidth, const FSize &nbParticles, const typePart data) {
unsigned int typeFReal[2] = {sizeof(FReal) , sizeof(typePart) / sizeof(FReal) }; unsigned int typeFReal[2] = {sizeof(FReal) , sizeof(typePart) / sizeof(FReal) };
const unsigned int ndata = data.getWriteDataNumber(); const unsigned int ndata = data.getWriteDataNumber();
FLOG(FLog::Controller <<" WriteHeader: typeFReal: " << typeFReal[0] << " nb Elts: " << typeFReal[1] <<" NData to write "<< ndata<< "\n"); std::cout <<" WriteHeader: typeFReal: " << typeFReal[0] << " nb Elts: " << typeFReal[1] <<" NData to write "<< ndata<< "\n";
if (ndata != typeFReal[1]){ if (ndata != typeFReal[1]){
typeFReal[1] = ndata; typeFReal[1] = ndata;
} }
...@@ -882,16 +857,18 @@ private: ...@@ -882,16 +857,18 @@ private:
file->seekg (std::ios::beg); file->seekg (std::ios::beg);
file->write((const char*)typeFReal,2*sizeof(unsigned int)); file->write((const char*)typeFReal,2*sizeof(unsigned int));
if(typeFReal[0] != sizeof(FReal)){ if(typeFReal[0] != sizeof(FReal)){
std::cerr << "Size of elements in part file " << typeFReal[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl; std::cout << "Size of elements in part file " << typeFReal[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl;
std::exit( EXIT_FAILURE); std::exit( EXIT_FAILURE);
} }
else{ else{
file->write( (const char*)&(nbParticles), sizeof(FSize) ); file->write( (const char*)&(nbParticles), sizeof(FSize) );
// std::cout << "nbParticles "<< nbParticles<<std::endl;
file->write( (const char*)&(boxWidth) ,sizeof(boxWidth) ); file->write( (const char*)&(boxWidth) ,sizeof(boxWidth) );
file->write( (const char*)(centerOfBox.getDataValue()),sizeof(FReal)*3); file->write( (const char*)(centerOfBox.getDataValue()),sizeof(FReal)*3);
} }
} }
}; };
#endif //FFmaGenericLoader_HPP
#endif //FFmaGenericLoader_HPP
...@@ -106,53 +106,6 @@ public: ...@@ -106,53 +106,6 @@ public:
(getRandom() * boxWidth) + centerOfBox.getY() - boxWidth/2, (getRandom() * boxWidth) + centerOfBox.getY() - boxWidth/2,
(getRandom() * boxWidth) + centerOfBox.getZ() - boxWidth/2); (getRandom() * boxWidth) + centerOfBox.getZ() - boxWidth/2);
} }
void fillParticleAtMortonIndex(FPoint<FReal>*const inParticlePositions, MortonIndex idx, unsigned int treeHeight){
MortonIndex mask = 0x1LL;
//Largeur de la boite au niveau des feuilles
FReal leafWidth = boxWidth / FReal(1<<(treeHeight-1));
//Décalage par rapport au centre de la moitié de la largeur de la boîte
FReal currentOffset = leafWidth / 2.0;
//Initialise x, y, z au centre de la boîte globale
FReal x, y, z;
x = centerOfBox.getX();
y = centerOfBox.getY();
z = centerOfBox.getZ();
//On va décaler le centre du père vers le centre du fils autant de fois qu'il y a de fils
//Comme ce sont des décalage succesif et plutôt indépendant, on peut commencer par les décalages au niveau des feuilles, ce qui est plus simple
for(unsigned int i = 0; i < treeHeight-1; ++i)
{
bool x_offset, y_offset, z_offset;
//Check le 1er bit qui correspond au z
z_offset = (idx & mask);
idx >>= 1;
//Check le 2nd bit qui correspond au y
y_offset = (idx & mask);
idx >>= 1;
//Check le 3ème bit qui correspond au x
x_offset = (idx & mask);
idx >>= 1;
//Décalage du x
if(x_offset)
x += currentOffset;
else
x -= currentOffset;
//Décalage du y
if(y_offset)
y += currentOffset;
else
y -= currentOffset;
//Décalage du z
if(z_offset)
z += currentOffset;
else
z -= currentOffset;
//On augmente les décallages au fur et à mesure que l'on remonte les étages
currentOffset *= 2;
}
inParticlePositions->setPosition( x, y, z);
}
/** Get a random number between 0 & 1 */ /** Get a random number between 0 & 1 */
FReal getRandom() const{ FReal getRandom() const{
......
...@@ -907,7 +907,7 @@ protected: ...@@ -907,7 +907,7 @@ protected:
MortonIndex interactionsIndexes[26]; MortonIndex interactionsIndexes[26];
int interactionsPosition[26]; int interactionsPosition[26];
FTreeCoordinate coord(mindex); FTreeCoordinate coord(mindex, tree->getHeight()-1);
int counter = coord.getNeighborsIndexes(tree->getHeight(),interactionsIndexes,interactionsPosition); int counter = coord.getNeighborsIndexes(tree->getHeight(),interactionsIndexes,interactionsPosition);
for(int idxInter = 0 ; idxInter < counter ; ++idxInter){ for(int idxInter = 0 ; idxInter < counter ; ++idxInter){
...@@ -995,7 +995,7 @@ protected: ...@@ -995,7 +995,7 @@ protected:
MortonIndex interactionsIndexes[189]; MortonIndex interactionsIndexes[189];
int interactionsPosition[189]; int interactionsPosition[189];
const FTreeCoordinate coord(mindex); const FTreeCoordinate coord(mindex, idxLevel);
int counter = coord.getInteractionNeighbors(idxLevel,interactionsIndexes,interactionsPosition); int counter = coord.getInteractionNeighbors(idxLevel,interactionsIndexes,interactionsPosition);
for(int idxInter = 0 ; idxInter < counter ; ++idxInter){ for(int idxInter = 0 ; idxInter < counter ; ++idxInter){
......
This diff is collapsed.
...@@ -161,6 +161,7 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@"); ...@@ -161,6 +161,7 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
#cmakedefine SCALFMM_STARPU_USE_REDUX #cmakedefine SCALFMM_STARPU_USE_REDUX
#cmakedefine SCALFMM_STARPU_USE_PRIO #cmakedefine SCALFMM_STARPU_USE_PRIO
#cmakedefine SCALFMM_STARPU_FORCE_NO_SCHEDULER #cmakedefine SCALFMM_STARPU_FORCE_NO_SCHEDULER
#cmakedefine SCALFMM_USE_STARPU_EXTRACT
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// To control simgrid config // To control simgrid config
......
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
#include "Utils/FMpi.hpp" #include "Utils/FMpi.hpp"
int FMpi::instanceCount = 0;
...@@ -533,7 +533,6 @@ private: ...@@ -533,7 +533,6 @@ private:
/// Counter to avoid several instanciations /// Counter to avoid several instanciations
static int instanceCount; static int instanceCount;
}; };
int FMpi::instanceCount = 0;
#endif //FMPI_HPP #endif //FMPI_HPP
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "../../Src/Files/FRandomLoader.hpp" #include "../../Src/Files/FRandomLoader.hpp"
#include "../../Src/Files/FFmaGenericLoader.hpp" #include "../../Src/Files/FFmaGenericLoader.hpp"
#include "../../Src/Files/FGenerateDistribution.hpp"
#include "../../Src/GroupTree/Core/FGroupSeqAlgorithm.hpp" #include "../../Src/GroupTree/Core/FGroupSeqAlgorithm.hpp"
#include "../../Src/GroupTree/Core/FGroupTaskAlgorithm.hpp" #include "../../Src/GroupTree/Core/FGroupTaskAlgorithm.hpp"
...@@ -42,14 +41,11 @@ ...@@ -42,14 +41,11 @@
#include <memory> #include <memory>
#define RANDOM_PARTICLES //#define RANDOM_PARTICLES
int main(int argc, char* argv[]){ int main(int argc, char* argv[]){
const FParameterNames LocalOptionBlocSize { {"-bs"}, "The size of the block of the blocked tree"}; const FParameterNames LocalOptionBlocSize { {"-bs"}, "The size of the block of the blocked tree"};
const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"}; const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"};
const FParameterNames LocalOptionEllipsoid = {{"-ellipsoid"} , " non uniform distribution on an ellipsoid of aspect ratio given by a=0.5 b=0.25 c=0.125"};
const FParameterNames LocalOptionPlummer = {{"-plummer"} , " (Highly non uniform) plummer distribution (astrophysics)"};
const FParameterNames LocalOptionCube = {{"-cube"} , " uniform distribution on cube (default)"};
FHelpDescribeAndExit(argc, argv, "Test the blocked tree by counting the particles.", FHelpDescribeAndExit(argc, argv, "Test the blocked tree by counting the particles.",
FParameterDefinitions::OctreeHeight, FParameterDefinitions::OctreeHeight,
#ifdef RANDOM_PARTICLES #ifdef RANDOM_PARTICLES
...@@ -57,7 +53,7 @@ int main(int argc, char* argv[]){ ...@@ -57,7 +53,7 @@ int main(int argc, char* argv[]){
#else #else
FParameterDefinitions::InputFile, FParameterDefinitions::InputFile,
#endif #endif
LocalOptionBlocSize, LocalOptionNoValidate, LocalOptionEllipsoid, LocalOptionPlummer, LocalOptionCube); LocalOptionBlocSize, LocalOptionNoValidate);
// Initialize the types // Initialize the types
typedef double FReal; typedef double FReal;
...@@ -69,6 +65,7 @@ int main(int argc, char* argv[]){ ...@@ -69,6 +65,7 @@ int main(int argc, char* argv[]){
typedef FChebCellPODLocal<FReal,ORDER> GroupCellDownClass; typedef FChebCellPODLocal<FReal,ORDER> GroupCellDownClass;
typedef FChebCellPOD<FReal,ORDER> GroupCellClass; typedef FChebCellPOD<FReal,ORDER> GroupCellClass;
typedef FP2PGroupParticleContainer<FReal> GroupContainerClass; typedef FP2PGroupParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass; typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
#ifdef SCALFMM_USE_STARPU #ifdef SCALFMM_USE_STARPU
...@@ -98,42 +95,24 @@ int main(int argc, char* argv[]){ ...@@ -98,42 +95,24 @@ int main(int argc, char* argv[]){
FAssertLF(loader.isOpen()); FAssertLF(loader.isOpen());
FTic timer; FTic timer;
#ifdef RANDOM_PARTICLES
setSeed(1);
FReal * tmpParticles = new FReal[4*loader.getNumberOfParticles()];
if(FParameters::existParameter(argc, argv, "-ellipsoid")) {
nonunifRandomPointsOnElipsoid(loader.getNumberOfParticles(), loader.getBoxWidth()/2, loader.getBoxWidth()/4, tmpParticles);
}
else if(FParameters::existParameter(argc, argv, "-plummer")) {
//The M argument is not used in the algorithm of the plummer distribution
unifRandomPlummer(loader.getNumberOfParticles(), loader.getBoxWidth()/2, tmpParticles) ;
}
else { //Uniform cube
unifRandomPointsInCube(loader.getNumberOfParticles(), loader.getBoxWidth()/2, loader.getBoxWidth()/2, loader.getBoxWidth()/2, tmpParticles);
}
#endif
FP2PParticleContainer<FReal> allParticles; FP2PParticleContainer<FReal> allParticles;
for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
FPoint<FReal> particlePosition; FPoint<FReal> particlePosition;
FReal physicalValue; FReal physicalValue;
#ifdef RANDOM_PARTICLES #ifdef RANDOM_PARTICLES
physicalValue = 0.10; physicalValue = 0.10;
particlePosition.setPosition(tmpParticles[idxPart*4], tmpParticles[idxPart*4+1], tmpParticles[idxPart*4+2]); loader.fillParticle(&particlePosition);
#else #else
loader.fillParticle(&particlePosition, &physicalValue); loader.fillParticle(&particlePosition, &physicalValue);
#endif #endif
allParticles.push(particlePosition, physicalValue); allParticles.push(particlePosition, physicalValue);
} }
#ifdef RANDOM_PARTICLES
delete[] tmpParticles;
#endif
std::cout << "Particles loaded in " << timer.tacAndElapsed() << "s\n"; std::cout << "Particles loaded in " << timer.tacAndElapsed() << "s\n";
// Put the data into the tree // Put the data into the tree
timer.tic(); timer.tic();
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles); GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles);
//groupedTree.printInfoBlocks(); groupedTree.printInfoBlocks();
std::cout << "Tree created in " << timer.tacAndElapsed() << "s\n"; std::cout << "Tree created in " << timer.tacAndElapsed() << "s\n";
// Run the algorithm // Run the algorithm
...@@ -142,11 +121,8 @@ int main(int argc, char* argv[]){ ...@@ -142,11 +121,8 @@ int main(int argc, char* argv[]){
GroupAlgorithm groupalgo(&groupedTree,&groupkernel); GroupAlgorithm groupalgo(&groupedTree,&groupkernel);
timer.tic(); timer.tic();
starpu_fxt_start_profiling();
groupalgo.execute(); groupalgo.execute();
starpu_fxt_stop_profiling(); std::cout << "Kernel executed in in " << timer.tacAndElapsed() << "s\n";
timer.tac();
std::cout << "Average executed in in " << timer.elapsed() << "s\n";
// Validate the result // Validate the result
if(FParameters::existParameter(argc, argv, LocalOptionNoValidate.options) == false){ if(FParameters::existParameter(argc, argv, LocalOptionNoValidate.options) == false){
......
This diff is collapsed.
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "../../Src/Utils/FParameters.hpp" #include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Files/FRandomLoader.hpp" #include "../../Src/Files/FRandomLoader.hpp"
#include "../../Src/Files/FFmaGenericLoader.hpp"
#include "../../Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp" #include "../../Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp"
...@@ -42,12 +41,8 @@ ...@@ -42,12 +41,8 @@
#include "../../Src/GroupTree/StarPUUtils/FStarPUKernelCapacities.hpp" #include "../../Src/GroupTree/StarPUUtils/FStarPUKernelCapacities.hpp"
#include "../../Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp" #include "../../Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp"
#include <vector>
#include <iostream>
#include <fstream>
void timeAverage(int mpi_rank, int nproc, double elapsedTime);
FSize getNbParticlesPerNode(FSize mpi_count, FSize mpi_rank, FSize total);
int main(int argc, char* argv[]){ int main(int argc, char* argv[]){
const FParameterNames LocalOptionBlocSize { const FParameterNames LocalOptionBlocSize {
...@@ -76,9 +71,10 @@ int main(int argc, char* argv[]){ ...@@ -76,9 +71,10 @@ int main(int argc, char* argv[]){
FMpi mpiComm(argc, argv); FMpi mpiComm(argc, argv);
// Get params // Get params
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5); const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 8); const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
const FSize totalNbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20)); const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 250);
const FSize NbParticles = getNbParticlesPerNode(mpiComm.global().processCount(), mpiComm.global().processId(), totalNbParticles); const FSize totalNbParticles = (NbParticles*mpiComm.global().processCount());
// Load the particles // Load the particles
FRandomLoader<FReal> loader(NbParticles, 1.0, FPoint<FReal>(0,0,0), mpiComm.global().processId()); FRandomLoader<FReal> loader(NbParticles, 1.0, FPoint<FReal>(0,0,0), mpiComm.global().processId());
FAssertLF(loader.isOpen()); FAssertLF(loader.isOpen());
...@@ -89,21 +85,12 @@ int main(int argc, char* argv[]){ ...@@ -89,21 +85,12 @@ int main(int argc, char* argv[]){
const FPoint<FReal>& getPosition(){ const FPoint<FReal>& getPosition(){
return position; return position;
} }
const unsigned int getWriteDataSize(void) const {
return sizeof(FReal);
}
const unsigned int getWriteDataNumber(void) const {
return 3;
}
const FReal* getPtrFirstData(void) const {
return position.data();
}
}; };
std::unique_ptr<TestParticle[]> particles(new TestParticle[loader.getNumberOfParticles()]); std::unique_ptr<TestParticle[]> particles(new TestParticle[loader.getNumberOfParticles()]);
memset(particles.get(), 0, sizeof(TestParticle) * loader.getNumberOfParticles()); memset(particles.get(), 0, sizeof(TestParticle) * loader.getNumberOfParticles());
for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
//loader.fillParticleAtMortonIndex(&(particles[idxPart].position), mpiComm.global().processId()*NbParticles + idxPart,NbLevels); loader.fillParticle(&particles[idxPart].position);
loader.fillParticle(&(particles[idxPart].position));
} }
// Sort in parallel // Sort in parallel
FVector<TestParticle> myParticles; FVector<TestParticle> myParticles;
...@@ -140,20 +127,22 @@ int main(int argc, char* argv[]){ ...@@ -140,20 +127,22 @@ int main(int argc, char* argv[]){
mpiComm.<