1

Many OpenACC tutorials assume that the compiler/accelerator will check for correctness, by automatically inspecting dependencies and ensuring that the loop is actually parallelizable. However, the OpenACC specification doesn't seem to mention anything about mandatory correctness analysis. Are OpenACC compilers OBLIGATED to check if loops are actually parallelizable and give up if they're not?

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257

1 Answers1

2

The compiler is required to analyze loops to determine if they are data independent when the "loop" directive's "auto" clause is used. (See section 2.9.6 of the OpenACC standard).

For loops within a "kernels" construct, "auto" is enabled by default unless either the "independent" or "seq" clauses are used.

For "loop" directives within a "parallel" construct, "auto" is not enabled by default hence the decorated loops are presumed independent.

Mat Colgrove
  • 5,441
  • 1
  • 10
  • 11
  • 1
    It's a little bit stronger than this. Within a parallel region decorated loops implicitly have the "independent" clause and the compiler doesn't need to perform any analysis. For undecorated loops within a parallel region its up to the compiler. The compiler isn't required to analyze undecorated loops in a parallel region, but frequently do. – jefflarkin Apr 19 '16 at 14:53