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);
}
}
2条答案
按热度按时间jchrr9hc1#
Also Pull request #4164
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