Commit ec3df387 authored by BRAMAS Berenger's avatar BRAMAS Berenger

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 00d55c24
......@@ -41,8 +41,14 @@ public:
FAssertLF(inKernels, "kernels cannot be null");
kernels = new KernelClass*[MaxThreads];
#pragma omp parallel for schedule(static) num_threads(MaxThreads)
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread] = new KernelClass(*inKernels);
// We want to ensure that each thread allocate data close to him
// and that only one thread at a time call the copy constructor
#pragma omp critical (FGroupTaskDepAlgorithm_InitKernels)
{
this->kernels[idxThread] = new KernelClass(*inKernels);
}
}
FLOG(FLog::Controller << "FGroupTaskAlgorithm (Max Thread " << MaxThreads << ")\n");
......@@ -58,7 +64,7 @@ public:
void execute(const unsigned operationsToProceed = FFmmNearAndFarFields){
FLOG( FLog::Controller << "\tStart FGroupTaskAlgorithm\n" );
#pragma omp parallel
#pragma omp parallel num_threads(MaxThreads)
{
#pragma omp single nowait
{
......@@ -67,7 +73,7 @@ public:
}
}
#pragma omp parallel
#pragma omp parallel num_threads(MaxThreads)
{
#pragma omp single nowait
{
......
......@@ -43,7 +43,7 @@ public:
FAssertLF(inKernels, "kernels cannot be null");
kernels = new KernelClass*[MaxThreads];
#pragma omp parallel for schedule(static)
#pragma omp parallel for schedule(static) num_threads(MaxThreads)
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
// We want to ensure that each thread allocate data close to him
// and that only one thread at a time call the copy constructor
......@@ -66,7 +66,7 @@ public:
void execute(const unsigned operationsToProceed = FFmmNearAndFarFields){
FLOG( FLog::Controller << "\tStart FGroupTaskDepAlgorithm\n" );
#pragma omp parallel
#pragma omp parallel num_threads(MaxThreads)
{
#pragma omp single nowait
{
......@@ -75,7 +75,7 @@ public:
}
}
#pragma omp parallel
#pragma omp parallel num_threads(MaxThreads)
{
#pragma omp single nowait
{
......
......@@ -80,7 +80,6 @@ protected:
std::vector< std::vector< std::vector<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel;
std::vector< std::vector<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel;
int MaxThreads; //< The number of threads
OctreeClass*const tree; //< The Tree
KernelClass*const originalCpuKernel;
......@@ -112,8 +111,8 @@ protected:
FStarPUPtrInterface* wrapperptr;
public:
FGroupTaskStarPUAlgorithm(OctreeClass*const inTree, KernelClass* inKernels, const int inMaxThreads = -1)
: MaxThreads(inMaxThreads), tree(inTree), originalCpuKernel(inKernels),
FGroupTaskStarPUAlgorithm(OctreeClass*const inTree, KernelClass* inKernels)
: tree(inTree), originalCpuKernel(inKernels),
cellHandles(nullptr),
#ifdef STARPU_USE_CPU
cpuWrapper(tree->getHeight()),
......@@ -127,7 +126,6 @@ public:
wrapperptr(&wrappers){
FAssertLF(tree, "tree cannot be null");
FAssertLF(inKernels, "kernels cannot be null");
FAssertLF(MaxThreads <= STARPU_MAXCPUS, "number of threads to high");
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
......@@ -164,8 +162,6 @@ public:
starpu_pause();
MaxThreads = starpu_worker_get_count();//starpu_cpu_worker_get_count();
cellHandles = new std::vector<CellHandles>[tree->getHeight()];
initCodelet();
......
......@@ -95,7 +95,6 @@ protected:
std::vector< std::vector< std::vector<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel;
std::vector< std::vector<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel;
int MaxThreads; //< The number of threads
OctreeClass*const tree; //< The Tree
KernelClass*const originalCpuKernel;
......@@ -129,8 +128,8 @@ protected:
FStarPUPtrInterface* wrapperptr;
public:
FGroupTaskStarPUMpiAlgorithm(const FMpi::FComm& inComm, OctreeClass*const inTree, KernelClass* inKernels, const int inMaxThreads = -1)
: comm(inComm), MaxThreads(inMaxThreads), tree(inTree), originalCpuKernel(inKernels),
FGroupTaskStarPUMpiAlgorithm(const FMpi::FComm& inComm, OctreeClass*const inTree, KernelClass* inKernels)
: comm(inComm), tree(inTree), originalCpuKernel(inKernels),
cellHandles(nullptr),
#ifdef STARPU_USE_CPU
cpuWrapper(tree->getHeight()),
......@@ -144,7 +143,6 @@ public:
wrapperptr(&wrappers){
FAssertLF(tree, "tree cannot be null");
FAssertLF(inKernels, "kernels cannot be null");
FAssertLF(MaxThreads <= STARPU_MAXCPUS, "number of threads to high");
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
......@@ -182,8 +180,6 @@ public:
starpu_pause();
MaxThreads = starpu_worker_get_count();//starpu_cpu_worker_get_count();
cellHandles = new std::vector<CellHandles>[tree->getHeight()];
initCodelet();
......
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