Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

GAP Message (Diagnostic ID 30525)

Message

Insert a "%s loop count min(%d)" statement right before the loop at line %d to parallelize the loop.

Advice

Add "#pragma loop count" before the specified loop. This pragma indicates the minimum trip count (number of iterations) of the loop that enables the parallelization of the loop.

The minimum trip count required to parallelize the loop may differ depending on the target architecture, and this will be reflected in the message generated.

Example

Consider the following:

#define N 10000 
float A[N], B[N];
 
void foo(int n) {
  int i;
  for (i =0; i < n; i++) {
      A[i] = A[i] + B[i] * B[i] + 1.5;
  } 
}

In this case, the compiler may not parallelize the loop because it is not sure that n is large enough for the parallelization to be beneficial.

If you determine it is safe to do so, you can add the pragma as follows:

#define N 10000 
float A[N], B[N];
 
void foo(int n) {
  int i; 
#pragma loop count min(128)
  for (i =0; i < n; i++) {
      A[i] = A[i] + B[i] * B[i] + 1.5;
  } 
}

Verify

Confirm that the loop has the minimum number of iterations, as specified in the diagnostic message.

See Also