PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Device kernel error (are maths operations the problem?)
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
mkcolg



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

PostPosted: Mon Apr 28, 2014 1:39 pm    Post subject: Reply with quote

Quote:
I tried it and it printed out 'no error'. Any ideas?
Ok, then let's focus on the copy. How are "a" and "adev" declared? Are they allocatables? If so, how are they allocated?

Minor note, "cudathreadsynchronize" is deprecated. You should use "cudeDeviceSynchronize" instead. They mean the same thing so I highly doubt it's causing your error, but it's better to update the code just in case.
Back to top
View user's profile
Torkin



Joined: 18 Apr 2012
Posts: 31

PostPosted: Mon Apr 28, 2014 2:18 pm    Post subject: Reply with quote

Hey Mat
Here are the allocatables and allocates:

Code:

      program
      use cudafor
      implicit real*8 (a-h,o-z)
....
      allocatable :: a(:,:),u(:),x(:,:),y(:,:),node(:,:),bc(:,:),dnorm(:,:)
....
      allocate (a(n,n),u(n),x(2,n),y(2,n),node(2,n),bc(2,n))
      allocate (dnorm(2,n))
....
   call coefficient(a,n,x,y,bc,node,dnorm)
....
      end program

    subroutine coefficient(a,n,x,y,bc,node,dnorm)
    use cudafor

       dimension a(n,n),x(2,n),y(2,n),bc(2,n),node(2,n),dnorm(2,n),a_coeff(n,n)
 
! a(n,n) is the same as a_coeff(n,n)
! allocatable device arrays

       real, device, allocatable, dimension(:,:) :: adev,xdev,ydev,dnormdev,bcdev
       integer, device, allocatable, dimension(:,:) :: nodedev
       integer, device :: ndev
....
       allocate( adev(n,n),xdev(2,n),ydev(2,n),dnormdev(2,n) )
       allocate( bcdev(2,n),nodedev(2,n) )
....
    end subroutine coefficient


with:
n=2 and 'a' should have 400 elements in it to be done on the device

Is it ok to have the subroutine 'coefficient' and the device subroutine just pasted after the program without being placed in a module? (although I doubt this is the problem)

- Ahmed
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 28, 2014 2:35 pm    Post subject: Reply with quote

Quote:
Is it ok to have the subroutine 'coefficient' and the device subroutine just pasted after the program without being placed in a module? (although I doubt this is the problem)
That depends. Do have explicit interfaces? If not, then this will be problematic.

Interfaces are required to pass allocable arrays and needed to call a CUDA Fortran kernels. Interfaces are implicit when the routines are defined in a module so I recommend using modules. Otherwise you need to provide an explicit interface.

- Mat
Back to top
View user's profile
Torkin



Joined: 18 Apr 2012
Posts: 31

PostPosted: Mon Apr 28, 2014 3:03 pm    Post subject: Reply with quote

Dear Mat

Please have a look at the whole code. I have minimized it to include the parts that call the 'coefficient subroutine' from a module and added the device code to the module too. I have made it simple for you to read:

https://www.dropbox.com/sh/hcyvs9moi2dbjta/0yAbMSeRP5

I have also attached an input file to go with the executable.

I am lost and this would be of tremendous help.

I thank you dearly.

- Ahmed
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 28, 2014 3:30 pm    Post subject: Reply with quote

Hi Ahemd,

Let me send you a link where you can upload the file using NVIDIA's secure FTP. Unfortunately our IT won't let us access dropbox.

- 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, 3  Next
Page 2 of 3

 
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