Chunk_size in OpenMP* SCHEDULE clause not loop-invariant

The chunk_size expression used in an OpenMP SCHEDULE clause must be a loop-invariant positive integer.

ID

Observation

Description

1

OpenMP declaration

The place the bad chunk_size expression was specified

1

Memory write

The place the chunk_size was modified

Example


    integer :: I, J
    integer :: OMP_GET_THREAD_NUM
    J = 10
    call OMP_SET_NUM_THREADS(3)
!$OMP PARALLEL SHARED(J)
!$OMP DO ORDERED SCHEDULE(STATIC, J)
    do I = 1, 100
!$OMP CRITICAL
! Bad: schedule chunk size modified in loop
        J = J + I
!$OMP END CRITICAL
!$OMP ORDERED
        print *, I, OMP_GET_THREAD_NUM()
!$OMP END ORDERED
    end do
!$OMP END DO
!$OMP END PARALLEL
    end
        

Copyright © 2010, Intel Corporation. All rights reserved.