正在加载图片...
23 If muliple threads write without synchronation to the same mm atomicity con dera as described above,the without synchronization to that same memory unit,including cases due to atomicity considerations as described above,then a data race occurs.If a data race occurs then the 6 result of the program is unspecified. 78 A private variable in a task region that eventually generates an inner nested paralle region is permitted to be made shared by implicit tasks in the inner parallel region A private variable in a task region can be shared by an explicit task region generated 1 during its execution.However,it is the programmer's responsibility to ensure through synchronization that the lifetime of the variable does not end before completion of the explicit sharing itAny ther access by one task to the private variables of another task unspecifed behavior. 141.4.2 Device Data Environments When an OpenMP program begins,each device has an initial device data environment. The initial device data environment for the host device is the data environment associated with the initial task region.Directives that accept data-mapping attribute 18 clauses determine how an original variable is ma g variable in a 190 device da h s th e ee same name tha If a corresponding variable is present in the enclosing device data environment,the new 22 device data environment inherits the corresponding variable from the enclosing device 2 riable isnot present in then sing device dat new variable (of the same type and size)is created in the new device data environment.In the latter case,the initial value of the new 26 corresponding variable is determined from the clauses and the data environment of the 27 encountering thread. 28 The corresponding variable in the device data environment may share storage with the 2 original variable.Writes to the corresponding variable may alter the value of the origina 0 variable.The impact of this on memory consistency is discussed in Section 1.4.4 on 1 page 20.When a task executes in the context of a device data environment,references to 32 the originl variablereferto the responding variable in the device data 33 The relationship between the value of the original variable and the initial or final value of the corresponding variable depends on the map-type.Details of this issue,as well as 35 other issues with mapping a variable,are provided in Section 2.14.5 on page 177. The original variable in a data environment and the correspon ding variable(s)in one or more device data environments may share storage.Without intervening synchronization data races can occur. 18 OpenMP API.Version 4.0-July 2013 18 OpenMP API • Version 4.0 - July 2013 If multiple threads write without synchronization to the same memory unit, including cases due to atomicity considerations as described above, then a data race occurs. Similarly, if at least one thread reads from a memory unit and at least one thread writes without synchronization to that same memory unit, including cases due to atomicity considerations as described above, then a data race occurs. If a data race occurs then the result of the program is unspecified. A private variable in a task region that eventually generates an inner nested parallel region is permitted to be made shared by implicit tasks in the inner parallel region. A private variable in a task region can be shared by an explicit task region generated during its execution. However, it is the programmer’s responsibility to ensure through synchronization that the lifetime of the variable does not end before completion of the explicit task region sharing it. Any other access by one task to the private variables of another task results in unspecified behavior. 1.4.2 Device Data Environments When an OpenMP program begins, each device has an initial device data environment. The initial device data environment for the host device is the data environment associated with the initial task region. Directives that accept data-mapping attribute clauses determine how an original variable is mapped to a corresponding variable in a device data environment. The original variable is the variable with the same name that exists in the data environment of the task that encounters the directive. If a corresponding variable is present in the enclosing device data environment, the new device data environment inherits the corresponding variable from the enclosing device data environment. If a corresponding variable is not present in the enclosing device data environment, a new corresponding variable (of the same type and size) is created in the new device data environment. In the latter case, the initial value of the new corresponding variable is determined from the clauses and the data environment of the encountering thread. The corresponding variable in the device data environment may share storage with the original variable. Writes to the corresponding variable may alter the value of the original variable. The impact of this on memory consistency is discussed in Section 1.4.4 on page 20. When a task executes in the context of a device data environment, references to the original variable refer to the corresponding variable in the device data environment. The relationship between the value of the original variable and the initial or final value of the corresponding variable depends on the map-type. Details of this issue, as well as other issues with mapping a variable, are provided in Section 2.14.5 on page 177. The original variable in a data environment and the corresponding variable(s) in one or more device data environments may share storage. Without intervening synchronization data races can occur. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有