OpenMP 结构化块在 Fortran 中意味着什么?
What does OpenMP structured-block mean in fortran?
openMP structured-block 在 fortran 中是什么意思?
!$omp sections
!$omp section
structured-block
!$omp section
structured-block
...
!$omp end sections
我可以像这样在每个部分下有多个命令吗?
!$omp sections
!$omp section
command 1
command 2
command 3
!$omp section
command 4
command 5
command 6
...
!$omp end sections
这是否正确使用了部分结构,更具体地说是“结构化块”?
一个“顶部有一个入口,底部有一个出口的可执行语句块”意味着你不使用goto
来转移控制到块内的标签,不要使用 goto 将控制转移到块外的标签。
!$omp section
call foo()
bar = baz
qux = bar
!$omp section
...
如果 foo()
returns. 没问题
!$omp section
bar = foo()
if (bar == baz) then
goto qux
end if
!$omp section
...
qux: ...
不太好。
你可以在里面有一个循环,只要它的整个主体都包含在块中,你可以调用函数和子程序,只要它们 return.
openMP structured-block 在 fortran 中是什么意思?
!$omp sections
!$omp section
structured-block
!$omp section
structured-block
...
!$omp end sections
我可以像这样在每个部分下有多个命令吗?
!$omp sections
!$omp section
command 1
command 2
command 3
!$omp section
command 4
command 5
command 6
...
!$omp end sections
这是否正确使用了部分结构,更具体地说是“结构化块”?
一个“顶部有一个入口,底部有一个出口的可执行语句块”意味着你不使用goto
来转移控制到块内的标签,不要使用 goto 将控制转移到块外的标签。
!$omp section
call foo()
bar = baz
qux = bar
!$omp section
...
如果 foo()
returns. 没问题
!$omp section
bar = foo()
if (bar == baz) then
goto qux
end if
!$omp section
...
qux: ...
不太好。
你可以在里面有一个循环,只要它的整个主体都包含在块中,你可以调用函数和子程序,只要它们 return.