PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

passing device allocatable array to kernel subprogram

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Wed Feb 17, 2010 10:58 pm    Post subject: passing device allocatable array to kernel subprogram Reply with quote

when i use static array like
Code:
integer, dimension(10,10), device :: arr2

instead of
Code:
integer, dimension(:,:), allocatable, device :: arr2


the code below works fine.

Code:
module test_mod                                                                       
 use cudafor
 real, dimension(10,10), device :: arr1
  integer, dimension(:,:),allocatable, device :: arr2
! integer, dimension(10,10), device :: arr2
contains
  attributes(global) subroutine doOnGPU()
     integer, value :: i, j

     i = threadIdx%x
      do j = 1, 10
        arr1(i,j) = i +j/0.5d0
        arr1(i,j) =  i + j + arr1(arr2(i,i), j)
      enddo

   end subroutine doOnGPU

   subroutine doOnCPU()
       allocate(arr2(10,10))
       arr2 = 1;

       call doOnGPU<<<1, 10>>>()

   end subroutine doOnCPU

end module test_mod

program  test1
   use test_mod

   call doOnCPU()
end program test1

However, when I use allocatable, I get this warning
Quote:
/tmp/pgcudaforVr5cnWS3-zwQ.gpu: In function `doongpu':
/tmp/pgcudaforVr5cnWS3-zwQ.gpu:17: warning: cast to pointer from integer of different size
/tmp/pgcudaforVr5cnWS3-zwQ.gpu(17): Warning: Cannot tell what pointer points to, assuming global memory space


Could you please tell me why?

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



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

PostPosted: Thu Feb 18, 2010 9:44 pm    Post subject: Reply with quote

Hi Tuan,

Currently only fixed size device arrays are allowed in a Module. However, we are actively working on adding this (it's our most requested feature). It should be available in 10.6 or possibly sooner.

- 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
Page 1 of 1

 
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