Commit 3f3737b9 authored by berenger-bramas's avatar berenger-bramas
Browse files

A draft of the blas block kernel.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@53 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 8ad76e38
This diff is collapsed.
......@@ -39,5 +39,29 @@ void cblas_gemv<float>(const CBLAS_ORDER order ,
cblas_cgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY);
}
///////////////////////////////////////////////////////
// Dotu
///////////////////////////////////////////////////////
template <typename T>
void cblas_dotu_sub( const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
T t;
t.you_cannot_use_this_function_with_this_type();
}
template <>
void cblas_dotu_sub<double>(const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
cblas_zdotu_sub(N,X,incX,Y,incY,dotu);
}
template <>
void cblas_dotu_sub<float>(const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
cblas_cdotu_sub(N,X,incX,Y,incY,dotu);
}
#endif //FBLAS_HPP
......@@ -22,6 +22,7 @@
#include "../Sources/Components/FSimpleLeaf.hpp"
#include "../Sources/Fmb/FFmbKernelsBlockBlas.hpp"
#include "../Sources/Fmb/FFmbKernelsBlas.hpp"
#include "../Sources/Fmb/FFmbKernels.hpp"
......@@ -116,10 +117,10 @@ int main(int argc, char ** argv){
std::cout << "Working on particles ..." << std::endl;
counter.tic();
//FFmbKernelsBlas FFmbKernels
FFmbKernelsBlas<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmbKernelsBlas FFmbKernels FFmbKernelsBlockBlas
FFmbKernelsBlockBlas<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask
FFmmAlgorithm<FFmbKernelsBlas, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
FFmmAlgorithm<FFmbKernelsBlockBlas, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
// /!\ Please, you must read the license at the bottom of this page
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "../Sources/Utils/FTic.hpp"
#include "../Sources/Containers/FOctree.hpp"
#include "../Sources/Containers/FList.hpp"
#include "../Sources/Components/FSimpleLeaf.hpp"
#include "../Sources/Utils/F3DPosition.hpp"
#include "../Sources/Components/FTestParticle.hpp"
#include "../Sources/Components/FTestCell.hpp"
#include "../Sources/Components/FTestKernels.hpp"
#include "../Sources/Core/FFmmAlgorithmThreadProc.hpp"
#include "../Sources/Components/FBasicKernels.hpp"
// Compile by : g++ testFmmAlgorithmProc.cpp ../Sources/Utils/FAssertable.cpp ../Sources/Utils/FDebug.cpp ../Sources/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithmProc.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that each particles is impacted each other particles
*/
// 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 the FMM algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = 10;//10;
const int SizeSubLevels = 3;//3
const long NbPart = 20000;//2000000
FTestParticle* particles = new FTestParticle[NbPart];
FTic counter;
srand ( 1 ); // volontary set seed to constant
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Creating " << NbPart << " particles ..." << std::endl;
counter.tic();
for(long idxPart = 0 ; idxPart < NbPart ; ++idxPart){
particles[idxPart].setPosition(FReal(rand())/RAND_MAX,FReal(rand())/RAND_MAX,FReal(rand())/RAND_MAX);
}
counter.tac();
std::cout << "Done " << "(" << counter.elapsed() << "s)." << std::endl;
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
FOctree<FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> tree(1.0,F3DPosition(0.5,0.5,0.5));
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Inserting particles ..." << std::endl;
counter.tic();
for(long idxPart = 0 ; idxPart < NbPart ; ++idxPart){
tree.insert(&particles[idxPart]);
}
counter.tac();
std::cout << "Done " << "(" << counter.elapsed() << "s)." << std::endl;
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Working on particles ..." << std::endl;
counter.tic();
// FTestKernels FBasicKernels
FTestKernels<FTestParticle, FTestCell, NbLevels> kernels;
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThreadProc
FFmmAlgorithmThreadProc<FTestKernels, FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels,argc,argv);
algo.execute();
counter.tac();
std::cout << "Done " << "(" << counter.elapsed() << "s)." << std::endl;
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
algo.ValidateFMMAlgoProc();
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Deleting particles ..." << std::endl;
counter.tic();
delete [] particles;
counter.tac();
std::cout << "Done " << "(" << counter.elapsed() << "s)." << std::endl;
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
return 0;
}
// [--LICENSE--]
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