Static Analysis Problem Type Reference
An OpenMP* parallel loop has the ORDERED clause, but there is no ORDERED directive inside.
The ORDERED directive is used to sequentially order the results of work done in parallel. The parallel loop that executes the ORDERED directive must be itself marked with the ORDERED clause. The ORDERED directive marks the region that is to execute in strict order.
This diagnostic indicates that that the loop was marked with the ORDERED clause, but there was no ORDERED directive that could be executed by that loop. This means the ORDERED clause on the loop was unnecessary. Loops without the ORDERED clause run faster, so this usage pattern is inefficient.
This error usually indicates that the ORDERED directive was omitted by mistake.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
OpenMP declaration |
The location of the loop that lacks the required ORDERED clause |
// Example adapted from A.24.1c from OpenMP 3.0 Specification
// Copyright (C) 1997-2008 OpenMP Architecture Review Board
#include <stdio>
void work(int k)
{
// #pragma ordered should be here
printf(" %d\n", k);
}
void a24(int lb; int ub; int stride)
{
int i;
#pragma omp parallel for ordered schedule(dynamic)
for (i = lb; i < ub; i += stride) {
work(i);
}
}
int main(int argc, char **argv)
{
a24(0, 100, 5);
return 0;
}
Here is the same example in FORTRAN:
! Example adapted from A.24.1f from OpenMP 3.0 Specification
! Copyright (C) 1997-2008 OpenMP Architecture Review Board
SUBROUTINE WORK(K)
INTEGER K
! OMP ORDERED SHOULD BE HERE
WRITE(*,*) k
! OMP END ORDERED SHOULD BE HERE
SUBROUTINE SUBA24(LB, UB, STRIDE)
INTEGER LB, UB, STRIDE
INTEGER I
!$OMP PARALLEL DO ORDERED SCHEDULE(DYNAMIC)
DO I = LB, UB, STRIDE
CALL WORK(I)
END DO
!$OMP END PARALLEL DO
END SUBROUTINE SUBA24
PROGRAM A24
CALL SUBA24(0, 100, 5)
END PROGRAM A24
Copyright © 1997-2008 OpenMP Architecture Review Board.
Permission to copy without fee all or part of this material is granted, provided the OpenMP Architecture Review Board copyright notice and the title of this document appear. Notice is given that copying is by permission of OpenMP Architecture Review Board.