openMP reduction and thread number control -
i use openmp as:
#pragma omp parallel reduction(+:average_stroke_width) for(int = 0; < gb_name.size(); ++i) {...} i know can use :
#pragma omp parallel num_threads(thread) for(int index = 0; index < gb_name.size(); ++index){...} how can control thread number when use reduction?
how can control thread number when use reduction?
both clauses can used togehter:
#pragma omp parallel reduction(+:average_stroke_width) num_threads(thread) for(int = 0; < gb_name.size(); ++i) {...} note reduction involves threads, cannot have parallel loop 8 threads , perform reduction 4 threads only. reduction combines local values in threads , therefore of them need participate.
Comments
Post a Comment