Commit fa0a4436 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

When using starpu number of threads should be given by env variables (and not...

When using starpu number of threads should be given by env variables (and not command line parameter)
parent ec3df387
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
#include "../../Src/Core/FFmmAlgorithm.hpp" #include "../../Src/Core/FFmmAlgorithm.hpp"
int main(int argc, char* argv[]){ int main(int argc, char* argv[]){
setenv("STARPU_NCPU","1",1);
const FParameterNames LocalOptionBlocSize { const FParameterNames LocalOptionBlocSize {
{"-bs"}, {"-bs"},
"The size of the block of the blocked tree" "The size of the block of the blocked tree"
}; };
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::NbThreads, FParameterDefinitions::OctreeHeight, FParameterDefinitions::NbParticles, LocalOptionBlocSize);
FParameterDefinitions::NbParticles, LocalOptionBlocSize);
typedef double FReal; typedef double FReal;
...@@ -69,8 +69,6 @@ int main(int argc, char* argv[]){ ...@@ -69,8 +69,6 @@ int main(int argc, char* argv[]){
typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm; typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm;
#elif defined(SCALFMM_USE_OMP4) #elif defined(SCALFMM_USE_OMP4)
typedef FTestKernels< GroupCellClass, GroupContainerClass > GroupKernelClass; typedef FTestKernels< GroupCellClass, GroupContainerClass > GroupKernelClass;
// Set the number of threads
omp_set_num_threads(FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, omp_get_max_threads()));
typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass,
GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm; GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#else #else
...@@ -121,8 +119,9 @@ int main(int argc, char* argv[]){ ...@@ -121,8 +119,9 @@ int main(int argc, char* argv[]){
// Put the data into the tree // Put the data into the tree
//GroupOctreeClass groupedTree(NbLevels, groupSize, &tree); //GroupOctreeClass groupedTree(NbLevels, groupSize, &tree);
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles); //GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles);
//GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, true); //GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, true);
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, false, true, 0.2);
groupedTree.printInfoBlocks(); groupedTree.printInfoBlocks();
// Check tree structure at leaf level // Check tree structure at leaf level
......
...@@ -54,7 +54,6 @@ int main(int argc, char* argv[]){ ...@@ -54,7 +54,6 @@ int main(int argc, char* argv[]){
#else #else
FParameterDefinitions::InputFile, FParameterDefinitions::InputFile,
#endif #endif
FParameterDefinitions::NbThreads,
LocalOptionBlocSize, LocalOptionNoValidate); LocalOptionBlocSize, LocalOptionNoValidate);
// Initialize the types // Initialize the types
...@@ -76,8 +75,6 @@ int main(int argc, char* argv[]){ ...@@ -76,8 +75,6 @@ int main(int argc, char* argv[]){
typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm; typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm;
#elif defined(SCALFMM_USE_OMP4) #elif defined(SCALFMM_USE_OMP4)
typedef FChebSymKernel<FReal,GroupCellClass,GroupContainerClass,MatrixKernelClass,ORDER> GroupKernelClass; typedef FChebSymKernel<FReal,GroupCellClass,GroupContainerClass,MatrixKernelClass,ORDER> GroupKernelClass;
// Set the number of threads
omp_set_num_threads(FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, omp_get_max_threads()));
typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass,
GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm; GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#else #else
......
...@@ -52,8 +52,8 @@ int main(int argc, char* argv[]){ ...@@ -52,8 +52,8 @@ int main(int argc, char* argv[]){
"The size of the block of the blocked tree" "The size of the block of the blocked tree"
}; };
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::NbThreads, FParameterDefinitions::OctreeHeight,
FParameterDefinitions::NbParticles, FParameterDefinitions::NbThreads, FParameterDefinitions::NbParticles,
LocalOptionBlocSize); LocalOptionBlocSize);
typedef double FReal; typedef double FReal;
// Initialize the types // Initialize the types
...@@ -72,7 +72,6 @@ int main(int argc, char* argv[]){ ...@@ -72,7 +72,6 @@ int main(int argc, char* argv[]){
FMpi mpiComm(argc, argv); FMpi mpiComm(argc, argv);
// Get params // Get params
const int maxThreads = FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, -1);
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5); const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20); const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 250); const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 250);
...@@ -141,7 +140,7 @@ int main(int argc, char* argv[]){ ...@@ -141,7 +140,7 @@ int main(int argc, char* argv[]){
// Run the algorithm // Run the algorithm
GroupKernelClass groupkernel; GroupKernelClass groupkernel;
GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel,maxThreads); GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel);
groupalgo.execute(); groupalgo.execute();
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){ groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){
......
...@@ -56,7 +56,7 @@ int main(int argc, char* argv[]){ ...@@ -56,7 +56,7 @@ int main(int argc, char* argv[]){
const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"}; const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"};
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::InputFile, FParameterDefinitions::OctreeHeight,FParameterDefinitions::InputFile,
FParameterDefinitions::OctreeSubHeight, FParameterDefinitions::NbThreads, FParameterDefinitions::OctreeSubHeight,
LocalOptionBlocSize, LocalOptionNoValidate); LocalOptionBlocSize, LocalOptionNoValidate);
typedef double FReal; typedef double FReal;
...@@ -86,7 +86,6 @@ int main(int argc, char* argv[]){ ...@@ -86,7 +86,6 @@ int main(int argc, char* argv[]){
const char* const filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/test20k.fma"); const char* const filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/test20k.fma");
const unsigned int TreeHeight = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 5); const unsigned int TreeHeight = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 5);
const unsigned int SubTreeHeight = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeSubHeight.options, 2); const unsigned int SubTreeHeight = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeSubHeight.options, 2);
const unsigned int NbThreads = FParameters::getValue(argc, argv, FParameterDefinitions::NbThreads.options, 1);
// init particles position and physical value // init particles position and physical value
struct TestParticle{ struct TestParticle{
...@@ -164,7 +163,7 @@ int main(int argc, char* argv[]){ ...@@ -164,7 +163,7 @@ int main(int argc, char* argv[]){
const MatrixKernelClass MatrixKernel; const MatrixKernelClass MatrixKernel;
GroupKernelClass groupkernel(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), &MatrixKernel); GroupKernelClass groupkernel(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), &MatrixKernel);
// Run the algorithm // Run the algorithm
GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel,NbThreads); GroupAlgorithm groupalgo(mpiComm.global(), &groupedTree,&groupkernel);
groupalgo.execute(); groupalgo.execute();
timer.tac(); timer.tac();
......
...@@ -43,7 +43,6 @@ int main(int argc, char* argv[]){ ...@@ -43,7 +43,6 @@ int main(int argc, char* argv[]){
const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"}; const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"};
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::InputFile, FParameterDefinitions::OctreeHeight,FParameterDefinitions::InputFile,
FParameterDefinitions::NbThreads,
FParameterDefinitions::NbParticles, LocalOptionBlocSize, LocalOptionNoValidate); FParameterDefinitions::NbParticles, LocalOptionBlocSize, LocalOptionNoValidate);
// Initialize the types // Initialize the types
...@@ -62,8 +61,6 @@ int main(int argc, char* argv[]){ ...@@ -62,8 +61,6 @@ int main(int argc, char* argv[]){
typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm; typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm;
#elif defined(SCALFMM_USE_OMP4) #elif defined(SCALFMM_USE_OMP4)
typedef FRotationKernel< FReal, GroupCellClass, GroupContainerClass , P> GroupKernelClass; typedef FRotationKernel< FReal, GroupCellClass, GroupContainerClass , P> GroupKernelClass;
// Set the number of threads
omp_set_num_threads(FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, omp_get_max_threads()));
typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass,
GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm; GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#else #else
......
...@@ -43,7 +43,6 @@ int main(int argc, char* argv[]){ ...@@ -43,7 +43,6 @@ int main(int argc, char* argv[]){
const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"}; const FParameterNames LocalOptionNoValidate { {"-no-validation"}, "To avoid comparing with direct computation"};
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::InputFile, FParameterDefinitions::OctreeHeight,FParameterDefinitions::InputFile,
FParameterDefinitions::NbThreads,
FParameterDefinitions::NbParticles, LocalOptionBlocSize, LocalOptionNoValidate); FParameterDefinitions::NbParticles, LocalOptionBlocSize, LocalOptionNoValidate);
// Initialize the types // Initialize the types
...@@ -62,8 +61,6 @@ int main(int argc, char* argv[]){ ...@@ -62,8 +61,6 @@ int main(int argc, char* argv[]){
typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm; typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm;
#elif defined(SCALFMM_USE_OMP4) #elif defined(SCALFMM_USE_OMP4)
typedef FTaylorKernel< FReal,GroupCellClass, GroupContainerClass , P,1> GroupKernelClass; typedef FTaylorKernel< FReal,GroupCellClass, GroupContainerClass , P,1> GroupKernelClass;
// Set the number of threads
omp_set_num_threads(FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, omp_get_max_threads()));
typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass,
GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm; GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#else #else
......
...@@ -111,8 +111,6 @@ int main(int argc, char* argv[]){ ...@@ -111,8 +111,6 @@ int main(int argc, char* argv[]){
typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm; typedef FGroupTaskStarPUAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupCpuWrapper > GroupAlgorithm;
#elif defined(SCALFMM_USE_OMP4) #elif defined(SCALFMM_USE_OMP4)
typedef FRotationKernel< FReal, GroupCellClass, GroupContainerClass , P> GroupKernelClass; typedef FRotationKernel< FReal, GroupCellClass, GroupContainerClass , P> GroupKernelClass;
// Set the number of threads
omp_set_num_threads(FParameters::getValue(argc,argv,FParameterDefinitions::NbThreads.options, omp_get_max_threads()));
typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, typedef FGroupTaskDepAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass,
GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm; GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#else #else
......
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