Static Analysis Problem Type Reference
A single loop iteration must not execute more than one ORDERED construct.
The ORDERED clause and the ORDERED construct are used to sequentially order the results of work done in parallel. It is legal for a single loop region to contain more than one ORDERED construct, but a single iteration is not allowed to execute more than one of them. This diagnostic indicates that that constraint was (or may be) violated.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
OpenMP usage error |
The place where the second ORDERED directive is executed |
|
2 |
OpenMP declaration |
The location of the ordered loop |
|
3 |
OpenMP declaration |
The place where the first ORDERED directive is executed |
// Example A.24.3c from OpenMP 3.0 Specification
// Copyright (C) 1997-2008 OpenMP Architecture Review Board
// This example is legal because each iteration of the loop will
// execute only one ORDERED construct.
void work(int i) { }
void a24_good(int n)
{
int i;
#pragma omp for ordered
for (i = 0; i < n; i++) {
if (i <= 10) {
#pragma omp ordered
work (i);
}
if (i > 10) {
#pragma omp ordered
work (i + 1);
}
}
}
Here is the same example in FORTRAN:
! Example A.24.3f from OpenMP 3.0 Specification
! Copyright (C) 1997-2008 OpenMP Architecture Review Board
SUBROUTINE A24_GOOD(N)
INTEGER N
!$OMP DO ORDERED
DO I = 1,N
IF I <= N THEN
!$OMP ORDERED
CALL WORK(I)
!$OMP END ORDERED
END IF
IF I > N THEN
!$OMP ORDERED
CALL WORK(I+1)
!$OMP END ORDERED
END IF
END DO
END SUBROUTINE A24_GOOD
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.