正在加载图片...
1.3 Execution Model The OpenMP API uses the fork-join model of parallel execution Multiple threads of 3 defined implicitly or explicitly by OpenMP di ves.The 4 peMtended to suppt program that will eecute correctlyb s paralle programs(multiple threads of execution and a full OpenMP support library)and as 67 sequential programs(directives ignored and a simple OpenMP stubs library).However. it is possible and permitted to develop a program that executes correctly as a parallel 8910 program t not as sequential prograr that produces different results wher executed as a paralle program compare when it is executed as a sequential progra Furthermore,using different numbers of threads may result in different numeric results 11 because of changes in the association of numeric operations.For example,a serial addition reduction may have a different pattern of addition associations than a parallel reduction.These different associations may change the results of floating-point addition 14 An OpenMP program begins as a single thread of execution,called an initial thread.An initial thread executes sequentially,as if enclosed in an implicit task region,called an initial task region,that is defined by the implicit parallel region surrounding the whole 21 program. The thread implicit that the whoe program executes on the host device.An implementation may support other target devices.If 9 supported,one or more devices are available to the host device for offloading code and data.Each device has its own threads that are distinct from threads that execute on another device.Thre ads cannot r ate from ne device to another device.The 12324 -centric suc n that the h offloads target regions to 25 The initial thread that executes the implicit parallel region that surrounds the target 67728 on a targe t devce.An initial thread executes egion, alled an initial defined by an implicit inactive parallel region that surrounds the entire target region 29 When a target construct is encountered the target region is executed by the 0323 mplicit device task.The task that encounters the ade construet waits at the end until execution of the etes.Ifa target device does not exist,or the target device is not suported by the implemetation.or the targe t device canno execute the target construct then the target region is executed by the host device 4567 The teams construct creates a lea eof thread te ms where the master thread of each team executes the Each of t itial th xecutes sequ ntially,as if enclosed in an implicit task region that is defined by an implicit parallel region that surrounds the entire teams region. 14 OpenMP API.Version 4.0-July 2013 14 OpenMP API • Version 4.0 - July 2013 1.3 Execution Model The OpenMP API uses the fork-join model of parallel execution. Multiple threads of execution perform tasks defined implicitly or explicitly by OpenMP directives. The OpenMP API is intended to support programs that will execute correctly both as parallel programs (multiple threads of execution and a full OpenMP support library) and as sequential programs (directives ignored and a simple OpenMP stubs library). However, it is possible and permitted to develop a program that executes correctly as a parallel program but not as a sequential program, or that produces different results when executed as a parallel program compared to when it is executed as a sequential program. Furthermore, using different numbers of threads may result in different numeric results because of changes in the association of numeric operations. For example, a serial addition reduction may have a different pattern of addition associations than a parallel reduction. These different associations may change the results of floating-point addition. An OpenMP program begins as a single thread of execution, called an initial thread. An initial thread executes sequentially, as if enclosed in an implicit task region, called an initial task region, that is defined by the implicit parallel region surrounding the whole program. The thread that executes the implicit parallel region that surrounds the whole program executes on the host device. An implementation may support other target devices. If supported, one or more devices are available to the host device for offloading code and data. Each device has its own threads that are distinct from threads that execute on another device. Threads cannot migrate from one device to another device. The execution model is host-centric such that the host device offloads target regions to target devices. The initial thread that executes the implicit parallel region that surrounds the target region may execute on a target devce. An initial thread executes sequentially, as if enclosed in an implicit task region, called an initial task region, that is defined by an implicit inactive parallel region that surrounds the entire target region. When a target construct is encountered, the target region is executed by the implicit device task. The task that encounters the target construct waits at the end of the construct until execution of the region completes. If a target device does not exist, or the target device is not supported by the implementation, or the target device cannot execute the target construct then the target region is executed by the host device. The teams construct creates a league of thread teams where the master thread of each team executes the region. Each of these master threads is an initial thread, and executes sequentially, as if enclosed in an implicit task region that is defined by an implicit parallel region that surrounds the entire teams region. 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
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有