0

I am porting a c++ code from linux to iOS.The code is using openmp to accelerate the performance. I want to know how to convert openmp code to pthread code(or gcd)? The openmp code likes below:

#pragma omp parallel num_threads(SEETA_NUM_THREADS)
  {
#pragma omp for nowait
    for (int32_t i = 1; i <= height; i++) {
      const int32_t* top_left = int_img + (i - 1) * width_;
      const int32_t* top_right = top_left + rect_width_ - 1;
      const int32_t* bottom_left = top_left + rect_height_ * width_;
      const int32_t* bottom_right = bottom_left + rect_width_ - 1;
      int32_t* dest = rect_sum + i * width_;

      *(dest++) = (*bottom_right) - (*top_right);
      seeta::fd::MathFunction::VectorSub(bottom_right + 1, top_right + 1, dest, width);
      seeta::fd::MathFunction::VectorSub(dest, bottom_left, dest, width);
      seeta::fd::MathFunction::VectorAdd(dest, top_left, dest, width);
    }
  }
}
xhsoldier
  • 575
  • 6
  • 31
  • You are basically asking how to re-implement OpenMP. I'm afraid the question is rather broad. See also https://stackoverflow.com/a/3949965/620382 – Zulan Jun 28 '17 at 10:19
  • I am wondering if there is any existing solutions for this. More or more third party libraries are using openmp, and I guess many people like me want to porting these libraries to iOS. – xhsoldier Jun 28 '17 at 10:25
  • and you think continuing to use OpenMP would be cheating? or you wish to take iOS back to the 90's? – tim18 Jun 28 '17 at 11:47

0 Answers0