25.06.2015 Views

clause

clause

clause

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sections 构 造 ( 非 循 环 并 行 )<br />

Sections 用 于 程 序 中 大 范 围 的 非 迭 代 执 行 代 码 段 间 的 并 行 化 .( 如 前 10<br />

行 和 后 10 行 间 代 码 间 无 依 赖 关 系 , 可 以 并 行 .)<br />

#pragma omp sections [no wait]<br />

{<br />

x_calculation();<br />

#pragma omp section<br />

y_calculation();<br />

#pragma omp section<br />

z_calculation();<br />

}<br />

缺 省 时 每 一 个 “omp sections” 构 造 结 束 后 有 一 个 barrier 同 步 操 作 . 通 过<br />

使 用 “nowait” 子 句 禁 止 隐 式 barrier 同 步 ( 在 构 造 语 句 后 直 接 加 即 可 ).<br />

与 for 结 构 相 类 似 ,OpenMP 也 提 供 parallel sections.<br />

x_calculation(),y_calc<br />

ulation() 以 及<br />

z_calculation() 代 表 三<br />

部 分 之 间 无 依 赖 关 系<br />

的 非 循 环 代 码 段 . 实<br />

质 上 它 们 各 代 表 很 多<br />

行 代 码 .<br />

2006 年 4 月 共 享 存 储 编 程 55/108

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!