PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Using atomic memory functions
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Mon Jul 09, 2012 8:13 am    Post subject: Reply with quote

Okay, I tried using the atomicadd function with double precision mem and val variable and the result was...

Quote:
PGF90-S-0155-Could not resolve generic procedure atomicadd (acceler_formd.f: 380)
0 inform, 0 warnings, 1 severes, 0 fatal for formd_cuda


so, I changed these variables to integer and it compiled fine.

I'm a bit confused as clearly pgi fortran does not support 64-bit atomic functions.Do you mean that I'd need to create a wrapper for the function and cal it directly from the C for CUDA library?

Cheers,
Crip_crop
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Jul 09, 2012 1:57 pm    Post subject: Reply with quote

Hi Crip_crop,

Are you using a constant literal for the val? The default kinds for constant literals is 4, but val is expecting a kind of 8. Hence, you need to an "_8" to the end of the literal in order set the kind as 8.

Note that it did some checking and while we've had 64-bit atomics in since we added CUDA 4.0, it looks there was a issue with the 64-bit atomicadd where you'll get a undefined identifier error (TPR#18767). This issue will be resolved in the next release.

- Mat
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Mon Jul 09, 2012 3:54 pm    Post subject: Reply with quote

When is the next release?

Crip_crop
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Jul 09, 2012 4:20 pm    Post subject: Reply with quote

Hopefully soon. It's already be delayed by several weeks due to unforeseen problems. I was told this morning, barring more issues in our final QA testing, it should be out later this week or early next.

- Mat
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Tue Jul 10, 2012 4:06 am    Post subject: Reply with quote

Can I just check with you that this code will work in the new release... I just don't want to delay my work for a week if it ends up not having the right functionality. Here I go...

Code:

!   Module scope

double precision,allocatable,device,dimension(:)globdens_d
double precision,allocatable,device,dimension(:,:,:)::subdens



Code:

!   Host code

              allocate
     &       (subdens(subsystems,maxbasfun,maxbasfun),
     &        globdens_d(lowt)


Code:

!    Device code
integer::istat

      tx=threadIdx%x
      bx=blockIdx%x
      i=((bx-1)*blocksize)+tx

            x=0
            y=0

            do j=1,catoms_d(i)
               katm=coresubatoms(i,j)
               do k=1,catoms_d(i)
                  latm=coresubatoms(i,k)

                  llk=lowlim(katm)
                  lll=lowlim(latm)
                 
                  norbk=natorb(ian(katm))
                  norbl=natorb(ian(latm))


                  do iii=1,norbk
                     ik=llk+iii-1
                     ix=x+iii
                     do jjj=1,norbl
                        jk=lll+jjj-1
                        jy=y+jjj
                       
                        if(ik.ge.jk)then
                           ij=(ik*(ik-1)/2)+jk
                           istat=atomicadd(globdens_d(ij),
     &                          subdens(i,ix,jy))
c$$$                           globdens_d(ij)=globdens_d(ij)+subdens(i,ix,jy)
                           
                        end if
                     end do
                     jy=y
                  end do
                 
                  y=y+norbl
               end do
               x=x+norbk
               
               y=0
            end do


This code compiles fine when globdens_d and subdens are declared as integer, so presumably in the new release they will work when declared as above?

Cheers,
Crip_crop
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
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