PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

PGF90-F-0155-Compiler failed to translate accelerator region
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
wiersma



Joined: 16 May 2013
Posts: 29

PostPosted: Thu Dec 05, 2013 1:41 pm    Post subject: Reply with quote

Hi Mat,

Thanks - it's working now. I was initially using parallel regions, but encountered similar behaviour. For instance:
Code:

!$acc parallel
do i = 1, N   ! line 10

   !some code

   foo = 0
!$acc loop vector reduction(+:foo)
   do j = x1, x2    !line 30
       foo = foo + bar(j)
   enddo
enddo
!$acc end parallel

actually only generates a kernel for the inner loop, whereas 'kernels' only generates a kernel only for the outer loop. The only thing I hadn't tried evidently was to use 'parallel loop'.

Returning to my compilation error, I'm afraid I cannot isolate the problem into a stand alone test program (it goes away if I do). I'm also not permitted to distribute any source code. All I can tell you is that it looks something like this:
Code:

  integer :: nk                   
  integer :: n                   
  integer      :: m
  real :: b(45 , 46)
  logical      :: s

!$acc data create(b)
  b = 1.0
  nk = 30

  n = nk
  m = nk+1

!$acc kernels

  s = .FALSE.     

  r = 0
  if (n == 1) then                 
     if (b(1,1) == 0.) then
        s = .TRUE.
     else
        b(1,2:m) = b(1,2:m) / b(1,1)
     endif
     r = 1
  endif
!$acc end kernels
!$acc end data

(note that this doesn't generate the error). I'll admit that I sloppily threw "kernels" regions in on the first time around - I was able to get things to compile when I put the kernels statements around the b(1,2:m) = ... line only.

Thanks,
Rob
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Fri Dec 06, 2013 10:32 am    Post subject: Reply with quote

Hi Rob,

That's unfortunate about not being able to create a reproducing example. Without one, it's very difficult to determine the cause especially with a generic error like a seg fault. Hopefully, we can work around the error by moving the OpenACC directives.

In looking at this code, I see one error in coding:
Code:
!$acc data create(b)
  b = 1.0

Here you create the array on the device, then assign the value on the host with the device copy's values are uninitialized. To fix, either swap the statements and use "copyin" instead of "create", add an "update" directive, or put the assignment in a compute region.

Code:
b = 1.0
!$acc data copyin(b)
.. or ..
!$acc data create(b)
  b = 1.0
!$acc update device(b)
.. or ..
!$acc data create(b)
!$acc kernels
  b = 1.0
!$acc end kernels


As for the "kernels" region, the compiler is correctly creating a sequential GPU kernel given that there is a "if" statement. In the OpenACC 2.0 spec which we're currently in the process of implementing, you will be able to nest compute regions to exploit dynamic parallelism. The typical use case for dynamic parallelism is to transfer the control flow over to the GPU as a serial kernel which then launches one or more parallel kernels. So in this case, you could add a second "kernels" directive around the array syntax.

Though until nested compute regions are supported, you should just use "kernels" directive around the inner array assignment and maintain synchronization of "b" between the host and device.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group