The OpenMP* ORDERED directive is only allowed in loops marked with the ORDERED clause.
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. This diagnostic indicates that that constraint was (or may be) violated.
It is legal for a non-ordered loop to contain an ordered loop. The only loop that must be marked as ORDERED is the one whose body directly executes the ORDERED directive.
ID |
Observation |
Description |
---|---|---|
1 |
OpenMP usage error |
The location of the ORDERED directive |
2 |
OpenMP declaration |
The location of the loop that lacks the required ORDERED clause |
// Example A.24.1c from OpenMP 3.0 Specification // Copyright (C) 1997-2008 OpenMP Architecture Review Board #include <stdio> void work(int k) { #pragma ordered 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 A.24.1f from OpenMP 3.0 Specification ! Copyright (C) 1997-2008 OpenMP Architecture Review Board SUBROUTINE WORK(K) INTEGER K !$OMP ORDERED WRITE(*,*) k !$OMP END ORDERED 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.
Copyright © 2010, Intel Corporation. All rights reserved.