Calling an internal subroutine inside OpenMP region

前端 未结 1 618
滥情空心
滥情空心 2020-12-18 15:06

I have a module that contains a subroutine that contains another subroutine. The outer subroutine has a parallel OpenMP region in which I call the inner subroutine. The code

相关标签:
1条回答
  • 2020-12-18 15:33

    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.

    0 讨论(0)
提交回复
热议问题