Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
change OMP for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
shesung committed Nov 5, 2018
1 parent 0421d7a commit 76f9990
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/operator/contrib/roi_align.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ void ROIAlignForward(
int n_rois = nthreads / channels / pooled_width / pooled_height;
// (n, c, ph, pw) is an element in the pooled output
// can be parallelized using omp
for (int n = 0; n < n_rois; n++) {
int n;
#pragma omp parallel for private(n) \
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
for (n = 0; n < n_rois; n++) {
int index_n = n * channels * pooled_width * pooled_height;

// roi could have 4 or 5 columns
Expand Down Expand Up @@ -209,10 +212,7 @@ void ROIAlignForward(
roi_bin_grid_w,
&pre_calc);

int c;
#pragma omp parallel for private(c) \
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
for (c = 0; c < channels; c++) {
for (int c = 0; c < channels; c++) {
int index_n_c = index_n + c * pooled_width * pooled_height;
int pre_calc_index = 0;

Expand Down

0 comments on commit 76f9990

Please sign in to comment.