我正在将一个c ++代码从linux移植到iOS。代码使用openmp来加速性能。 我想知道如何将openmp代码转换为pthread代码(或gcd)? openmp代码如下:
#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);
}
}
}