Skip to content
Snippets Groups Projects
Commit 62f23d87 authored by carlocamilloni's avatar carlocamilloni
Browse files

Merge branch 'v2.3' into v2.4

parents 865b2037 dc2d61eb
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