IBM SMP directives

IBM SMP directives for parallelization are based on the possibility of parallelizing countable loops. A loop is considered countable when the following rules can be applied:

  • There is no branching into or outside of the loop.

  • The incremental expression (incr_expr) is not within a critical section.

Table E-1 shows the C language control flow statements and the regular expressions that define when they can be treated as countable loops.

Table E-1. Regular expressions for countable loops
C control flow statement keywordsRegular expression
for
for ([iv]; exit_cond; incr_expr)
   statement

for ([iv]; exit_cond; [expr] {
   [declaration_list]
   [statement_list]
   incr_expr;
   [statement_list]
}
while
while (exit_cond) {
   [declaration_list ...

Get Developing and Porting C and C++ Applications on AIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.