'cancel' examples are a bit complicated

Discuss the OpenMP 4.0 Examples document.

'cancel' examples are a bit complicated

Postby jgpallero » Thu Nov 14, 2013 8:11 am


First of all, thank you all people involved in the examples document. It's a great work!

I'm trying to learn about the new 'cancel' directive and I find the examples a bit complicated. In addition to them, I propose a very simple example like this:
Code: Select all
int limit=500,greater_than_limit=0;
double vector[NELEM];
//vector initialization...
for(int i=0;i<NELEM;i++){
    if vector[i]>limit{
        greater_than_limit = 1;

It only checks if a vector contains any element (no matter which of them) is greater than a defined limit. If this simple function is parallelized via OpenMP 4, I think it could be stopped with 'cancel', but I don't know how. I suggest the addition of this simple example to the document

Posts: 15
Joined: Fri May 11, 2012 1:47 am

Return to OpenMP 4.0 Examples

Who is online

Users browsing this forum: No registered users and 1 guest