OpenMP break out of the task

This place was so helpful so many times with c++, so I dare to ask a question about openmp just in case someone has and is willing to share . I apologize in advance if questions not directly related to c++ should not be asked here.

I read some tutorials yet got only the impression that it is not simple to break out of the parallelism in openmp, but I don't have the enough knowledge to understand how to do it properly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
   #pragma omp parallel shared(monomer, rotation, nom)
    {
        #pragma omp single nowait
        {
        for (int32_t i = 0; i < nom; i++)
        {
            #pragma omp task firstprivate(i)
            {
            if (intersecting_serial(monomer, rotation, i))
                {
                #pragma omp atomic write
                    checker = true;
                }
            }
        }
        }
    }


I would need to stop everything as soon as checker gets the true. What is the best way to do that?

Thanks,
Last edited on
Topic archived. No new replies allowed.