We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 810b0f9 + 768819c commit d24fbbdCopy full SHA for d24fbbd
src/2013-05-16-using-rcppprogress.Rmd
@@ -170,14 +170,14 @@ Now check that it is parallelized:
170
// [[Rcpp::depends(RcppProgress)]]
171
#include <progress.hpp>
172
// [[Rcpp::export]]
173
-double long_computation_omp2(int nb, int threads=1) {
+double long_computation_omp2(const int nb, int threads=1) {
174
#ifdef _OPENMP
175
if ( threads > 0 )
176
omp_set_num_threads( threads );
177
#endif
178
Progress p(nb, true);
179
double sum = 0;
180
-#pragma omp parallel for schedule(dynamic)
+#pragma omp parallel for default(none) reduction(+ : sum) schedule(dynamic)
181
for (int i = 0; i < nb; ++i) {
182
double thread_sum = 0;
183
if ( ! Progress::check_abort() ) {
0 commit comments