ncnn OpenMP fault error in quick sorting recursive function

vsdwdz23  于 2022-10-22  发布在  其他
关注(0)|答案(2)|浏览(174)

In file of examples ncnn/examples/rfcn.cpp
Recursive calls function with support OpenMP didn't work correct with "#pragma omp parallel sections" and produce core fault error on x86.


# pragma omp parallel sections

     {
        #pragma omp section
        {
            if (left < j) qsort_descent_inplace(faceobjects, left, j);
        }
        #pragma omp section
        {
            if (i < right) qsort_descent_inplace(faceobjects, i, right);
        }
    }

Need use OpenMP tasks "#pragma omp task shared(faceobjects)" instead of sections "#pragma omp section".
And "#pragma omp taskq" instead "#pragma omp parallel sections"

I made changes for correct working with OpenMP support enable without fault error.


# pragma omp taskq

     {
         #pragma omp task shared(faceobjects)
        {
            if (left < j) qsort_descent_inplace(faceobjects, left, j);
         }
         #pragma omp task shared(faceobjects)
        {
            if (i < right) qsort_descent_inplace(faceobjects, i, right);
         }
    }
whhtz7ly

whhtz7ly2#

Also I think there are more errors in the sources with #pragma and OpenMP support, because after building the NCNN library with OpenMP support, I always get a segmentation fault error in my applications using the lbncnn.a library

相关问题