Calling an internal subroutine inside OpenMP region

对着背影说爱祢 提交于 2019-11-29 08:43:26

I am not sure if this is allowed by the OpenMP specifications. This thread https://software.intel.com/en-us/forums/topic/297424 also has some doubts. Maybe it is just wrongly implemented by Intel Fortran, but one would have to carefully read the official specifications.

In your case I would avoid the need for the host association by pasting the code of the procedure directly into the loop as you also tried.

The other option is to pass the private variables as dummy arguments, as is suggested in the referenced thread, which also avoids the host association.

I am unsure whether using high enough optimization level alone will help, it is probably unsafe to need the inlining.

FWIW I am getting the same error also with the Oracle Solaris Studio 12.4beta.


According to IanH:

"The reference to i inside the internal subroutine is in a region but not in a construct. Whether the i being referred to is the original i prior to the parallel do construct or a private copy is called out as being "unspecified "in OpenMP 4.0 and earlier."

The relevant section from the specifiction is (OpenMP 4.0 2.14.3.3. 14):

The corresponding original list item. Inside the construct, all references to the original
list item are replaced by references to the new list item. In the rest of the region, it is
unspecified whether references are to the new list item or the original list item.

This means this usage should be avoided.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!