Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMP fault error in quick sorting recursive function #4165

Open
magicse opened this issue Aug 21, 2022 · 2 comments
Open

OpenMP fault error in quick sorting recursive function #4165

magicse opened this issue Aug 21, 2022 · 2 comments

Comments

@magicse
Copy link
Contributor

magicse commented Aug 21, 2022

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);
         }
    }
@magicse
Copy link
Contributor Author

magicse commented Aug 21, 2022

Also Pull request #4164

@magicse
Copy link
Contributor Author

magicse commented Aug 21, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant