TRANSPARENT clause
Parallel Directive Clause:Controls the visibility/propagation of dependencies across construct boundaries.
Syntax
TRANSPARENT[(visibility-modifier)]
visibility-modifer |
Is an integer scalar expression with kind type OMP_IMPEX_T that evaluates to a value of one of these named constants:
|
The TRANSPARENT clause is a construct dependence propagation mechanism, allowing dependencies of a construct to be visible outside the construct, or for dependencies of a enclosing or surrounding construct to be visible inside the construct.
visibility-modifier controls the direction that the dependency information flows. OMP_EXPORT makes a constructs dependencies visible outside the construct. OMP_IMPORT makes enclosing and surrounding construct dependencies visible inside the construct. OMP_IMPEX both exports dependencies from a construct and imports dependencies into a construct. OMP_NOT_IMPEX neither makes dependencies of the construct visible outside the construct nor makes dependencies outside the construct visible within the construct.
If visibility-modifier is not specified, it is as if OMP_IMPEX had been specified.
Example
The OMP_IMPORT modifier causes dependencies from outside the transparent task to be made visible inside enclosed tasks.
SUBROUTINE example1 ()
USE omp_lib
IMPLICIT NONE
INTEGER :: i
!$OMP PARALLEL
!$OMP SINGLE
!$OMP TASK DEPEND (OUT : i)
! Task 1
i = 42
!$OMP END TASK
!$OMP TASK (TRANSPARENT (OMP_IMPORT) DEPEND (IN : i)
! Task 2
! Task 2 imports the dependency established by Task 1
! Task 1's dependency is therefor visible to tasks enclosed by Task 2
!$OMP TASK
PRINT *, "Child of task 2 sees i = ", i
!$OMP END TASK
!$OMP END TASK
!$OMP END SINGLE
!$OMP END PARALLEL
END SUBROUTINE example
In the following example, the inner task's dependence DEPEND (OUT : i) will be exported outward. Thus, the successor task with DEPEND (IN : i) can establish its dependence on the inner task.
SUBROUTINE example2 ()
USE omp_lib
IMPLICIT NONE
INTEGER :: i
!$OMP PARALLEL
!$OMP SINGLE
!$OMP TASK TRANSPARENT (OMP_EXPORT)
!$OMP TASK DEPEND (OUT : i)
i = 42
!$OMP END TASK
!$OMP END TASK
!$OMP TASK DEPEND (IN : i)
PRINT *, "Subsequent/successor task sees the value i = ", i
!$OMP END TASK
!$OMP END SINGLE
!$OMP END PARALLEL
END SUBROUITNE example2