try adding quotient as private variable

This commit is contained in:
NunoSempere 2024-01-12 16:58:45 +01:00
parent 14a18276c0
commit 1eccd33c71

View File

@ -56,14 +56,16 @@ void sampler_parallel(double (*sampler)(uint64_t* seed), double* results, int n_
}
int i;
#pragma omp parallel private(i)
#pragma omp parallel private(i, quotient)
{
#pragma omp for
for (i = 0; i < n_threads; i++) {
int quotient = n_samples / n_threads;
int lower_bound_inclusive = i * quotient;
int upper_bound_not_inclusive = ((i + 1) * quotient); // note the < in the for loop below,
for (int j = lower_bound_inclusive; j < upper_bound_not_inclusive; j++) {
results[j] = sampler(&(cache_box[i].seed));
// Could also result in inefficient cache stuff, but hopefully not too often
}
}
}