Commit 460a198c authored by COULAUD Olivier's avatar COULAUD Olivier

Improvement

parent 6a10f6c2
......@@ -87,7 +87,7 @@ if( ScalFMM_BUILD_DEBUG )
SET(CMAKE_BUILD_TYPE Debug)
ADD_DEFINITIONS(-O0)
IF( APPLE )
SET(SCALFMM_FLAGS_OPTI_DEBUG "-m64 -funroll-loops" CACHE STRING "Set your optimization flags for debug mode.")
SET(SCALFMM_FLAGS_OPTI_DEBUG "-m64 -march=native -funroll-loops" CACHE STRING "Set your optimization flags for debug mode.")
ELSE(APPLE)
SET(SCALFMM_FLAGS_OPTI_DEBUG "${FLAGS_64bits} -fp-model strict -march=native -funroll-loops" CACHE STRING "Set your optimization flags for debug mode.")
ENDIF(APPLE)
......
......@@ -23,10 +23,7 @@
#include <cstdio>
#include <cstdlib>
#include "../../Src/Files/FFmaScanfLoader.hpp"
//#include "../../Src/Files/FFmaBinLoader.hpp"
#include "../../Src/Files/FFmaGenericLoader.hpp"
#include "../../Src/Kernels/Rotation/FRotationKernel.hpp"
#include "../../Src/Kernels/Rotation/FRotationCell.hpp"
......@@ -56,6 +53,7 @@
//! \param -t The number of threads
//!
//! \param -f name Name of the particles file. The file have to be in our FMA format
//! \param -bin if the file is in binary mode
//!
//
......@@ -66,6 +64,7 @@ void usage() {
<< " -depth the depth of the octree "<< std::endl
<< " -subdepth specifies the size of the sub octree " << std::endl
<< " -f name name specifies the name of the particle distribution" << std::endl
<< " -bin if the file is in binary mode" << std::endl
<< " -t n specifies the number of threads used in the computations" << std::endl;
}
......@@ -98,8 +97,14 @@ int main(int argc, char* argv[])
FTic time;
// open particle file
FFmaScanfLoader loader(filename);
if(!loader.isOpen()) throw std::runtime_error("Particle file couldn't be opened!") ;
FFmaGenericLoader *loader = nullptr ;
if(FParameters::existParameter(argc, argv, "-bin")){
loader = new FFmaGenericLoader(filename,true);
}
else {
loader = new FFmaGenericLoader(filename);
}
if(!loader->isOpen()) throw std::runtime_error("Particle file couldn't be opened!") ;
////////////////////////////////////////////////////////////////////
......@@ -107,7 +112,7 @@ int main(int argc, char* argv[])
// begin spherical kernel
// accuracy
const unsigned int P = 25;
const unsigned int P = 22;
// typedefs
typedef FP2PParticleContainerIndexed<> ContainerClass;
typedef FSimpleLeaf< ContainerClass > LeafClass;
......@@ -119,11 +124,11 @@ int main(int argc, char* argv[])
typedef FFmmAlgorithmThread<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
// init oct-tree
OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
OctreeClass tree(TreeHeight, SubTreeHeight, loader->getBoxWidth(), loader->getCenterOfBox());
{ // -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles()
std::cout << "Creating & Inserting " << loader->getNumberOfParticles()
<< " particles ..." << std::endl;
std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl;
time.tic();
......@@ -131,9 +136,9 @@ int main(int argc, char* argv[])
FPoint position;
FReal physicalValue = 0.0;
//
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
for(int idxPart = 0 ; idxPart < loader->getNumberOfParticles() ; ++idxPart){
// Read particles from file
loader.fillParticle(&position,&physicalValue);
loader->fillParticle(&position,&physicalValue);
// put particles in octree
tree.insert(position, idxPart, physicalValue);
......@@ -151,7 +156,7 @@ int main(int argc, char* argv[])
//
// Here we use a pointer due to the limited size of the stack
//
KernelClass *kernels = new KernelClass(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
KernelClass *kernels = new KernelClass(TreeHeight, loader->getBoxWidth(), loader->getCenterOfBox());
//
FmmClass algorithm(&tree, kernels);
//
......@@ -166,7 +171,7 @@ int main(int argc, char* argv[])
//
//
{ // -----------------------------------------------------
long int N1=0, N2= loader.getNumberOfParticles()/2, N3= loader.getNumberOfParticles() -1; ;
long int N1=0, N2= loader->getNumberOfParticles()/2, N3= loader->getNumberOfParticles() -1; ;
FReal energy =0.0 ;
//
// Loop over all leaves
......
......@@ -153,7 +153,7 @@ int main(int argc, char ** argv){
//
// Set Global id
//
long int idCell = setGlobalID(tree);
// long int idCell = setGlobalID(tree);
//
// Build CA and FA lists
std::cout << " start building CA and FA lists " <<std::endl;
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
......@@ -29,12 +29,12 @@ class FPoint;
*
* A loader is the component that fills an octree.
*
* If you want to use a specific file format you then need to inherite from this loader
* and implemente several methods.
* If you want to use a specific file format you then need to inherit from this loader
* and implement several methods.
*
* Please look at FBasicLoader or FFmaLoader to see an example.
*
* @warning Inherite from this class when defining a loader class
* @warning Inherit from this class when defining a loader class
*/
class FAbstractLoader {
public:
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
......@@ -47,13 +47,13 @@ public:
void fillParticle(FPoint*const inParticlePosition, FReal*const physicalValue, FReal* forceX, FReal* forceY, FReal* forceZ, FReal * const potential){
FReal x,y,z,data,fx,fy,fz,pot;
//Same datas as particle files
//Same data as particle files
removeWarning += fread(&x, sizeof(FReal), 1, file);
removeWarning += fread(&y, sizeof(FReal), 1, file);
removeWarning += fread(&z, sizeof(FReal), 1, file);
removeWarning += fread(&data, sizeof(FReal), 1, file);
//results datas
//results data
removeWarning += fread(&fx, sizeof(FReal), 1, file);
removeWarning += fread(&fy, sizeof(FReal), 1, file);
removeWarning += fread(&fz, sizeof(FReal), 1, file);
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
......@@ -53,10 +53,10 @@
*/
class FFmaLoader : public FAbstractLoader {
protected:
std::ifstream file; //< The file to read
FPoint centerOfBox; //< The center of box read from file
FReal boxWidth; //< the box width read from file
int nbParticles; //< the number of particles read from file
std::ifstream file; //< The file to read
FPoint centerOfBox; //< The center of box read from file
FReal boxWidth; //< the box width read from file
int nbParticles; //< the number of particles read from file
public:
/**
......
// ===================================================================================
// Logiciel initial: ScalFmm Version 0.5
// Co-auteurs : Olivier Coulaud, Bérenger Bramas.
// Propriétaires : INRIA.
// Copyright © 2011-2012, diffusé sous les termes et conditions d’une licence propriétaire.
// Initial software: ScalFmm Version 0.5
// Co-authors: Olivier Coulaud, Bérenger Bramas.
// Owners: INRIA.
// Copyright © 2011-2012, spread under the terms and conditions of a proprietary license.
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
#ifndef SSCALFMMCONFIG_H
#define SSCALFMMCONFIG_H
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
......@@ -16,6 +16,8 @@
#ifndef FALIGNEDMEMORY_HPP
#define FALIGNEDMEMORY_HPP
#include <cstdint>
/**
* This should be used to allocate and deallocate aligned memory.
*/
......@@ -42,7 +44,7 @@ inline void* Allocate16BAligned(const size_t inSize){
*/
inline void* Allocate32BAligned(const size_t inSize){
unsigned char* memoryBlock;
int resMemAl = posix_memalign((void**)&memoryBlock,32,inSize);
/*int resMemAl = */posix_memalign((void**)&memoryBlock,32,inSize);
return memoryBlock;
}
......@@ -71,7 +73,7 @@ inline void Dealloc16BAligned(const void*const memoryBlock){
*/
inline void Dealloc32BAligned(const void*const memoryBlock){
const void * toBeFreed = memoryBlock;
free((void *)toBeFreed);
free(const_cast<void *>(toBeFreed));
}
}
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
......
// ===================================================================================
// Logiciel initial: ScalFmm Version 0.5
// Co-auteurs : Olivier Coulaud, B��renger Bramas.
// Propri��taires : INRIA.
// Copyright �� 2011-2012, diffus�� sous les termes et conditions d���une licence propri��taire.
// Initial software: ScalFmm Version 0.5
// Co-authors: Olivier Coulaud, B��renger Bramas.
// Owners: INRIA.
// Copyright �� 2011-2012, spread under the terms and conditions of a proprietardata[1] license.
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
//
#ifndef FPOINT_HPP
#define FPOINT_HPP
......
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