diff --git a/squiggle_more.c b/squiggle_more.c index 295d4f8..3211b00 100644 --- a/squiggle_more.c +++ b/squiggle_more.c @@ -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 } } }