Skip to content
Snippets Groups Projects
Commit 9dac290a authored by carlocamilloni's avatar carlocamilloni
Browse files

Merge branch 'v2.4' into v2.5

parents f1ed9fa5 62f23d87
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ void ActionWithValue::clearInputForces() {
}
void ActionWithValue::clearDerivatives() {
unsigned nt = OpenMP::getGoodNumThreads(values);
unsigned nt = OpenMP::getNumThreads(values);
#pragma omp parallel num_threads(nt)
{
#pragma omp for
......
......@@ -55,7 +55,7 @@ unsigned OpenMP::getGoodNumThreads(const T*x,unsigned n) {
(void) p; // this is not to have warnings. notice that the pointer location is not used actually.
// a factor two is necessary since there is no guarantee that x is aligned
// to cache line boundary
unsigned m=n/(2*getCachelineSize()*sizeof(T));
unsigned m=n*sizeof(T)/(2*getCachelineSize());
unsigned numThreads=getNumThreads();
if(m>numThreads) m=numThreads;
if(m==0) m=1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment