没有合适的资源?快使用搜索试试~ 我知道了~
首页OpenMP Application Program Interface Version 4.0
OpenMP Application Program Interface Version 4.0
需积分: 11 12 下载量 169 浏览量
更新于2023-03-16
收藏 1.6MB PDF 举报
The collection of compiler directives, library routines, and environment variables described in this document collectively define the specification of the OpenMP Application Program Interface (OpenMP API) for shared-memory parallelism in C, C++ and Fortran programs. This specification provides a model for parallel programming that is portable across shared memory architectures from different vendors. Compilers from numerous vendors support the OpenMP API. More information about the OpenMP API can be found at the following web site
资源详情
资源推荐
OpenMP
Application Program
Interface
Version 4.0 - July 2013
Copyright © 1997-2013 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.
This page is intentionally blank.
i
CONTENTS
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Threading Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2 OpenMP Language Terminology . . . . . . . . . . . . . . . . . . . . . 2
1.2.3 Synchronization Terminology . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.4 Tasking Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.5 Data Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2.6 Implementation Terminology . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Execution Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Memory Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.4.1 Structure of the OpenMP Memory Model . . . . . . . . . . . . . . . 17
1.4.2 Device Data Environments . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.4.3 The Flush Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4.4 OpenMP Memory Consistency . . . . . . . . . . . . . . . . . . . . . . 20
1.5 OpenMP Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.6 Normative References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.7 Organization of this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2. Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.1 Directive Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.1.1 Fixed Source Form Directives . . . . . . . . . . . . . . . . . . . . . . . 27
2.1.2 Free Source Form Directives . . . . . . . . . . . . . . . . . . . . . . . . 28
2.1.3 Stand-Alone Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.2 Conditional Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.2.1 Fixed Source Form Conditional Compilation Sentinels . . . . 32
ii OpenMP API • Version 4.0 - July 2013
2.2.2 Free Source Form Conditional Compilation Sentinel . . . . . . 33
2.3 Internal Control Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3.1 ICV Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.3.2 ICV Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.3.3 Modifying and Retrieving ICV Values . . . . . . . . . . . . . . . . . . 37
2.3.4 How ICVs are Scoped . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.5 ICV Override Relationships . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4 Array Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.5 parallel Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.5.1 Determining the Number of Threads
for a parallel Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.5.2 Controlling OpenMP Thread Affinity . . . . . . . . . . . . . . . . . . . 49
2.6 Canonical Loop Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.7 Worksharing Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.7.1 Loop Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.7.2 sections Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.7.3 single Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.7.4 workshare Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2.8 SIMD Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.8.1 simd construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.8.2 declare simd construct . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
2.8.3 Loop SIMD construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
2.9 Device Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2.9.1 target data Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2.9.2 target Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
2.9.3 target update Construct . . . . . . . . . . . . . . . . . . . . . . . . . 81
2.9.4 declare target Directive . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.9.5 teams Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
2.9.6 distribute Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
2.9.7 distribute simd Construct . . . . . . . . . . . . . . . . . . . . . . . 91
iii
2.9.8 Distribute Parallel Loop Construct . . . . . . . . . . . . . . . . . . . . 92
2.9.9 Distribute Parallel Loop SIMD Construct . . . . . . . . . . . . . . . 94
2.10 Combined Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.10.1 Parallel Loop Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.10.2 parallel sections Construct . . . . . . . . . . . . . . . . . . . . . 97
2.10.3 parallel workshare Construct . . . . . . . . . . . . . . . . . . . . 99
2.10.4 Parallel Loop SIMD Construct . . . . . . . . . . . . . . . . . . . . . . . 100
2.10.5 target teams construct . . . . . . . . . . . . . . . . . . . . . . . . . . 101
2.10.6 teams distribute Construct . . . . . . . . . . . . . . . . . . . . . . 102
2.10.7 teams distribute simd Construct . . . . . . . . . . . . . . . . . 104
2.10.8 target teams distribute Construct . . . . . . . . . . . . . . . 105
2.10.9 target teams distribute simd Construct . . . . . . . . . . 106
2.10.10 Teams Distribute Parallel Loop Construct . . . . . . . . . . . . . . 107
2.10.11 Target Teams Distribute Parallel Loop Construct . . . . . . . . . 109
2.10.12 Teams Distribute Parallel Loop SIMD Construct . . . . . . . . . 110
2.10.13 Target Teams Distribute Parallel Loop SIMD Construct . . . . 111
2.11 Tasking Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
2.11.1 task Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
2.11.2 taskyield Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
2.11.3 Task Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
2.12 Master and Synchronization Constructs . . . . . . . . . . . . . . . . . . . . . . 120
2.12.1 master Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
2.12.2 critical Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
2.12.3 barrier Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
2.12.4 taskwait Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
2.12.5 taskgroup Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
2.12.6 atomic Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
2.12.7 flush Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
2.12.8 ordered Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
2.13 Cancellation Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
剩余319页未读,继续阅读
nudtxiaobai
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 基于嵌入式ARMLinux的播放器的设计与实现 word格式.doc
- 经典:大学答辩通过_基于ARM微处理器的嵌入式指纹识别系统设计.pdf
- 嵌入式系统课程设计.doc
- 基于飞思卡尔控制器的智能寻迹车设计ARM基础课程课程设计.doc
- 下载基于ARM7的压电陶瓷换能器导纳圆测量仪的研制PDF格式可编辑.pdf
- 课程设计基于ARM的嵌入式家居监控系统的研究与设计.doc
- 论文基于嵌入式ARM的图像采集处理系统设计.doc
- 嵌入式基于ARM9的中断驱动程序设计—课程设计.doc
- 在Linux系统下基于ARM嵌入式的俄罗斯方块.doc
- STK-MirrorStore Product Release Notes(96130)-44
- STK-MirrorStore Storage Connectivity Guide for StorageTek Disk A
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科毕业设计.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科生毕业论文.doc
- 麻阳风貌展示网站的设计与实现毕业论文.pdf
- 高速走丝气中电火花线切割精加工编程设计.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功