Commit 6c476d46 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Remove Starpu from master branch

parent 521e7f85
......@@ -29,8 +29,6 @@ OPTION( SCALFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
OPTION( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
OPTION( SCALFMM_USE_DOUBLE_PRECISION "Set to ON to compile in double precision" OFF )
OPTION( SCALFMM_ATTACHE_SOURCE "Set to ON to compile with -g" OFF )
OPTION( SCALFMM_USE_STARPU "Set to ON to use starpu" OFF )
OPTION( SCALFMM_USE_CUDA "Set to ON to use cuda (with starpu for example)" OFF )
# Test if openmp is here
......@@ -54,25 +52,6 @@ else()
ENDIF()
endif()
# cuda
if( SCALFMM_USE_CUDA )
FIND_PACKAGE(CUDA)
endif()
# starpu
if( SCALFMM_USE_STARPU )
# starpu
set( STARPU_LIBRARIES "-lstarpu-1.0" )
set( STARPU_INCLUDE_DIRS "/usr/local/include/starpu/1.0" CACHE STRING "Set your StarPU include directory")
set( STARPU_LIBRARY_DIRS "/usr/local/lib/" CACHE STRING "Set your StarPU library directory")
# Adding the project sources dir as an include dir
include_directories(${STARPU_INCLUDE_DIRS})
link_directories(${STARPU_LIBRARY_DIRS})
else()
unset(STARPU_INCLUDE_DIRS CACHE)
unset(STARPU_LIBRARY_DIRS CACHE)
endif()
# Attach source code to exec
if( SCALFMM_ATTACHE_SOURCE )
MESSAGE( STATUS "Use -g in compiler flags" )
......
......@@ -28,7 +28,6 @@ target_link_libraries(
scalfmm
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${STARPU_LIBRARIES}
)
# Adding the entire project dir as an include dir
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -58,36 +58,18 @@ foreach(exec ${source_tests_files})
endif()
endif()
# Test starpu dependency
file(STRINGS "${exec}" lines_starpu REGEX "@FUSE_STARPU")
if(lines_starpu)
if( NOT SCALFMM_USE_STARPU )
MESSAGE( STATUS "This needs Starpu = ${exec}" )
set(compile_exec "FALSE")
endif()
endif()
# Dependency are OK
if( compile_exec )
if( SCALFMM_USE_CUDA )
CUDA_ADD_EXECUTABLE(
add_executable(
${execname}
${exec}
${source_cuda_files}
)
else()
add_executable(
${execname}
${exec}
)
endif()
target_link_libraries(
${execname}
${scalfmm_lib}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${STARPU_LIBRARIES}
)
endif()
endforeach(exec)
// ===================================================================================
// 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.
// ===================================================================================
// ==== CMAKE =====
// @FUSE_STARPU
// ================
#include <starpu.h>
#include "../../Src/Utils/FTic.hpp"
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Components/FTestKernels.hpp"
#include "../../Src/Components/FTestParticle.hpp"
#include "../../Src/Components/FTestCell.hpp"
#include "../../Src/Core/FFmmAlgorithmStarpu.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FFmaParticle.hpp"
#include "../../Src/Extensions/FExtendForces.hpp"
#include "../../Src/Extensions/FExtendPotential.hpp"
#include "../../Src/Components/FBasicCell.hpp"
#include "../../Src/Files/FFmaLoader.hpp"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
////////////////////////////////////////////////////////////////
// Define classes
////////////////////////////////////////////////////////////////
// just to be able to load a fma file
class TestParticle : public FTestParticle, public FExtendPhysicalValue{
};
////////////////////////////////////////////////////////////////
// Typedefs
////////////////////////////////////////////////////////////////
typedef TestParticle ParticleClass;
typedef StarVector<ParticleClass> ContainerClass;
typedef DataVector<ParticleClass> RealContainerClass;
typedef FTestCell RealCellClass;
typedef FStarCell<RealCellClass> CellClass;
typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass;
typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass;
typedef FTestKernels<ParticleClass, RealCellClass, RealContainerClass > KernelClass;
typedef FFmmAlgorithmStarpu<OctreeClass, ParticleClass, CellClass, RealCellClass, ContainerClass,KernelClass,LeafClass> AlgorithmClass;
////////////////////////////////////////////////////////////////
// Main
////////////////////////////////////////////////////////////////
// Simply create particles and try the kernels
int main(int argc, char ** argv){
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter;
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
std::cout << "Opening : " << filename << "\n";
FFmaLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
// -----------------------------------------------------
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
// -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
counter.tic();
loader.fillTree(tree);
counter.tac();
std::cout << "Done " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
// -----------------------------------------------------
KernelClass kernel;
AlgorithmClass algo( &tree, &kernel);
algo.initStarpu();
counter.tic();
algo.execute();
counter.tac();
std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << "s)." << std::endl;
algo.releaseStarpu();
// Check result
ValidateFMMAlgo<OctreeClass, ParticleClass, CellClass, ContainerClass, LeafClass>(&tree);
return 0;
}
// ===================================================================================
// 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.
// ===================================================================================
// ==== CMAKE =====
// @FUSE_STARPU
// ================
#include <starpu.h>
#include "../../Src/Utils/FTic.hpp"
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Components/FTestKernels.hpp"
#include "../../Src/Components/FTestParticle.hpp"
#include "../../Src/Components/FTestCell.hpp"
#include "../../Src/Core/FFmmAlgorithmStarpuGroup.hpp"
#include "../../Src/Core/FFmmAlgorithm.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FFmaParticle.hpp"
#include "../../Src/Extensions/FExtendForces.hpp"
#include "../../Src/Extensions/FExtendPotential.hpp"
#include "../../Src/Components/FBasicCell.hpp"
#include "../../Src/Files/FFmaLoader.hpp"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
////////////////////////////////////////////////////////////////
// Define classes
////////////////////////////////////////////////////////////////
class TestCell : public FTestCell {
public:
void intialCopy(const TestCell*const other){
setDataUp( other->getDataUp() );
setDataDown( other->getDataDown() );
}
void copyUp(const TestCell*const other){
setDataUp( other->getDataUp() );
}
void restoreCopy(const TestCell*const other){
setDataUp( other->getDataUp() );
setDataDown( other->getDataDown() );
}
};
// just to be able to load a fma file
class TestParticle : public FTestParticle, public FExtendPhysicalValue{
};
template <class ParticleClass>
class Container : public FVector<ParticleClass> {
public:
void reduce(const Container*const other){
for( int idx = 0 ; idx < FVector<ParticleClass>::getSize() ; ++idx){
FVector<ParticleClass>::data()[idx].setDataDown(FVector<ParticleClass>::data()[idx].getDataDown() +
other->FVector<ParticleClass>::data()[idx].getDataDown());
}
}
};
////////////////////////////////////////////////////////////////
// Typedefs
////////////////////////////////////////////////////////////////
typedef TestParticle ParticleClass;
typedef Container<ParticleClass> ContainerClass;
typedef TestCell CellClass;
typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass;
typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass;
typedef FTestKernels<ParticleClass, CellClass, ContainerClass > KernelClass;
typedef FFmmAlgorithmStarpuGroup<OctreeClass, ParticleClass, CellClass, ContainerClass,KernelClass,LeafClass> AlgorithmClass;
////////////////////////////////////////////////////////////////
// Main
////////////////////////////////////////////////////////////////
// Simply create particles and try the kernels
int main(int argc, char ** argv){
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
const int BlockSize = FParameters::getValue(argc,argv,"-bs", 250);
const bool usePerfModel = (FParameters::findParameter(argc, argv, "-perf") != FParameters::NotFound);
const bool useReductionPart = (FParameters::findParameter(argc, argv, "-reducepart") != FParameters::NotFound);
FTic counter;
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
std::cout << "Opening : " << filename << "\n";
FFmaLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
// -----------------------------------------------------
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
// -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
counter.tic();
loader.fillTree(tree);
counter.tac();
std::cout << "Done " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
// -----------------------------------------------------
KernelClass kernel;
AlgorithmClass algo( &tree, &kernel, BlockSize, usePerfModel, useReductionPart);
// -----------------------------------------------------
std::cout << "Build gouped tree..." << std::endl;
counter.tic();
algo.buildGroups();
counter.tac();
std::cout << "Done in " << counter.elapsed() << "s." << std::endl;
// -----------------------------------------------------
std::cout << "Execute Fmm..." << std::endl;
counter.tic();
algo.execute();
counter.tac();
std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << "s)." << std::endl;
// -----------------------------------------------------
std::cout << "Release gouped tree..." << std::endl;
counter.tic();
algo.releaseGroups();
counter.tac();
std::cout << "Done in " << counter.elapsed() << "s." << std::endl;
// -----------------------------------------------------
// Check result
ValidateFMMAlgo<OctreeClass, ParticleClass, CellClass, ContainerClass, LeafClass>(&tree);
return 0;
}
// ===================================================================================
// Ce LOGICIEL "ScalFmm" est couvert par le copyright Inria 20xx-2012.
// Inria détient tous les droits de propriété sur le LOGICIEL, et souhaite que
// la communauté scientifique l'utilise afin de le tester et de l'évaluer.
// Inria donne gracieusement le droit d'utiliser ce LOGICIEL. Toute utilisation
// dans un but lucratif ou à des fins commerciales est interdite sauf autorisation
// expresse et préalable d'Inria.
// Toute utilisation hors des limites précisées ci-dessus et réalisée sans l'accord
// expresse préalable d'Inria constituerait donc le délit de contrefaçon.
// Le LOGICIEL étant un produit en cours de développement, Inria ne saurait assurer
// aucune responsabilité et notamment en aucune manière et en aucun cas, être tenu
// de répondre d'éventuels dommages directs ou indirects subits par l'utilisateur.
// Tout utilisateur du LOGICIEL s'engage à communiquer à Inria ses remarques
// relatives à l'usage du LOGICIEL
// ===================================================================================
// ==== CMAKE =====
// @FUSE_BLAS
// @FUSE_STARPU
// ================
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <starpu.h>
#include "../../Src/Files/FFmaScanfLoader.hpp"
#include "../../Src/Kernels/Chebyshev/FChebParticle.hpp"
#include "../../Src/Kernels/Chebyshev/FChebLeaf.hpp"
#include "../../Src/Kernels/Chebyshev/FChebCell.hpp"
#include "../../Src/Kernels/Chebyshev/FChebMatrixKernel.hpp"
#include "../../Src/Kernels/Chebyshev/FChebKernel.hpp"
#include "../../Src/Kernels/Chebyshev/FChebSymKernel.hpp"
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Core/FFmmAlgorithm.hpp"
#include "../../Src/Core/FFmmAlgorithmThread.hpp"
#include "../../Src/Core/FFmmAlgorithmStarpu.hpp"
FReal computeL2norm(unsigned int N, FReal *const u, FReal *const v)
{
FReal dot = FReal(0.);
FReal diff_dot = FReal(0.);
for (unsigned int i=0; i<N; ++i) {
FReal w = v[i] - u[i];
diff_dot += w * w;
dot += u[i] * u[i];
}
return FMath::Sqrt(diff_dot / dot);
}
FReal computeINFnorm(unsigned int N, FReal *const u, FReal *const v)
{
FReal max = FReal(0.);
FReal diff_max = FReal(0.);
for (unsigned int n=0; n<N; ++n) {
if ( max<std::abs(u[n])) max = std::abs(u[n]);
if (diff_max<std::abs(u[n]-v[n])) diff_max = std::abs(u[n]-v[n]);
}
return diff_max / max;
}
// Simply create particles and try the kernels
int main(int argc, char* argv[])
{
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
const unsigned int TreeHeight = FParameters::getValue(argc, argv, "-h", 5);
const unsigned int SubTreeHeight = FParameters::getValue(argc, argv, "-sh", 2);
const unsigned int NbThreads = FParameters::getValue(argc, argv, "-t", 1);
const unsigned int ORDER = 3;
const FReal epsilon = FReal(1e-3);
// set threads
omp_set_num_threads(NbThreads);
std::cout << "Using " << omp_get_max_threads() << " threads." << std::endl;
// init timer
FTic time;
// typedefs for STARPU
typedef FChebParticle ParticleClass;
typedef StarVector<ParticleClass> ContainerClass;
typedef DataVector<ParticleClass> RealContainerClass;
typedef FChebLeaf<ParticleClass,ContainerClass> LeafClass;
typedef FChebMatrixKernelR MatrixKernelClass;
typedef FChebCell<ORDER> RealCellClass;
typedef FStarCell<RealCellClass> CellClass;
typedef FOctree<ParticleClass,CellClass,ContainerClass,LeafClass> OctreeClass;
//typedef FChebKernel<ParticleClass,RealCellClass,RealContainerClass,MatrixKernelClass,ORDER> KernelClass;
typedef FChebSymKernel<ParticleClass,RealCellClass,RealContainerClass,MatrixKernelClass,ORDER> KernelClass;
typedef FFmmAlgorithmStarpu<OctreeClass,ParticleClass,CellClass,RealCellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
// What we do //////////////////////////////////////////////////////
std::cout << ">> Testing the Chebyshev interpolation base FMM algorithm.\n";
// open particle file
FFmaScanfLoader<ParticleClass> loader(filename);
if(!loader.isOpen()) throw std::runtime_error("Particle file couldn't be opened!");
// init oct-tree
OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
// -----------------------------------------------------
std::cout << "Creating and inserting " << loader.getNumberOfParticles() << " particles in a octree of height " << TreeHeight
<< " ..." << std::endl;
time.tic();
loader.fillTree(tree);
std::cout << "Done " << "(" << time.tacAndElapsed() << ")." << std::endl;
// -----------------------------------------------------
// -----------------------------------------------------
std::cout << "\nChebyshev FMM ... " << std::endl;
time.tic();
KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon);
FmmClass algorithm(&tree,&kernels);
algorithm.initStarpu();
std::cout << "init fmm & kernel " << time.tacAndElapsed() << "sec." << std::endl;
time.tic();
algorithm.execute();
std::cout << "completed in " << time.tacAndElapsed() << "sec." << std::endl;
algorithm.releaseStarpu();
// -----------------------------------------------------
// -----------------------------------------------------
// find first non empty leaf cell
OctreeClass::Iterator iLeafs(&tree);
iLeafs.gotoBottomLeft();
const ContainerClass *const Targets = iLeafs.getCurrentListTargets();
const unsigned int NumTargets = Targets->getSize();
FReal* Potential = new FReal [NumTargets];
FBlas::setzero(NumTargets, Potential);
FReal* Force = new FReal [NumTargets * 3];
FBlas::setzero(NumTargets * 3, Force);
std::cout << "\nDirect computation of " << NumTargets << " target particles ..." << std::endl;
const MatrixKernelClass MatrixKernel;
do {
const ContainerClass *const Sources = iLeafs.getCurrentListSrc();
unsigned int counter = 0;
ContainerClass::ConstBasicIterator iTarget(*Targets);
while(iTarget.hasNotFinished()) {
const FReal wt = iTarget.data().getPhysicalValue();
ContainerClass::ConstBasicIterator iSource(*Sources);
while(iSource.hasNotFinished()) {
if (&iTarget.data() != &iSource.data()) {
const FReal one_over_r = MatrixKernel.evaluate(iTarget.data().getPosition(),
iSource.data().getPosition());
const FReal ws = iSource.data().getPhysicalValue();
// potential
Potential[counter] += one_over_r * ws;
// force
FPoint force(iSource.data().getPosition() - iTarget.data().getPosition());
force *= ((ws*wt) * (one_over_r*one_over_r*one_over_r));
Force[counter*3 + 0] += force.getX();
Force[counter*3 + 1] += force.getY();
Force[counter*3 + 2] += force.getZ();
}
iSource.gotoNext();
}
counter++;
iTarget.gotoNext();
}
} while(iLeafs.moveRight());
FReal* ApproxPotential = new FReal [NumTargets];
FReal* ApproxForce = new FReal [NumTargets * 3];
unsigned int counter = 0;
ContainerClass::ConstBasicIterator iTarget(*Targets);
while(iTarget.hasNotFinished()) {
ApproxPotential[counter] = iTarget.data().getPotential();
ApproxForce[counter*3 + 0] = iTarget.data().getForces().getX();
ApproxForce[counter*3 + 1] = iTarget.data().getForces().getY();
ApproxForce[counter*3 + 2] = iTarget.data().getForces().getZ();
counter++;
iTarget.gotoNext();
}
std::cout << "\nPotential error:" << std::endl;
std::cout << "Relative L2 error = " << computeL2norm( NumTargets, Potential, ApproxPotential)
<< std::endl;
std::cout << "Relative Lmax error = " << computeINFnorm(NumTargets, Potential, ApproxPotential)
<< std::endl;
std::cout << "\nForce error:" << std::endl;
std::cout << "Relative L2 error = " << computeL2norm( NumTargets*3, Force, ApproxForce)
<< std::endl;
std::cout << "Relative Lmax error = " << computeINFnorm(NumTargets*3, Force, ApproxForce)
<< std::endl;
std::cout << std::endl;
// free memory
delete [] Potential;
delete [] ApproxPotential;
delete [] Force;
delete [] ApproxForce;
/*
// Check if particles are strictly within its containing cells
const FReal BoxWidthLeaf = BoxWidth / FReal(FMath::pow(2, TreeHeight-1));
OctreeClass::Iterator octreeIterator(&tree);
octreeIterator.gotoBottomLeft();
do{
const CellClass *const LeafCell = octreeIterator.getCurrentCell();
const FPoint& LeafCellCenter = LeafCell -> getPosition();
const ContainerClass *const Particles = octreeIterator.getCurrentListSrc();
ContainerClass::ConstBasicIterator particleIterator(*Particles);
while(particleIterator.hasNotFinished()) {
const FPoint distance(LeafCellCenter-particleIterator.data().getPosition());
std::cout << "center - particle = " << distance << " < " << BoxWidthLeaf/FReal(2.) << std::endl;
if (std::abs(distance.getX())>BoxWidthLeaf/FReal(2.) ||
std::abs(distance.getY())>BoxWidthLeaf/FReal(2.) ||
std::abs(distance.getZ())>BoxWidthLeaf/FReal(2.)) {
std::cout << "stop" << std::endl;
exit(-1);
}
particleIterator.gotoNext();
}
} while(octreeIterator.moveRight());
*/
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -48,17 +48,10 @@ foreach(exec ${source_tests_files})
# Dependency are OK
if( compile_exec )
if( SCALFMM_USE_CUDA )
CUDA_ADD_EXECUTABLE(
add_executable(
${execname}
${exec}
)
else()
add_executable(
${execname}
${exec}
)
endif()
target_link_libraries(
${execname}
......
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