PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Initial value for constant variable in cuda fortran

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
tlstar



Joined: 31 Mar 2011
Posts: 22

PostPosted: Thu Apr 14, 2011 3:29 pm    Post subject: Initial value for constant variable in cuda fortran Reply with quote

Please test following code by pgfortran V11.4:

Code:
program test


    use kernel
    IMPLICIT NONE

    double precision, device :: data1(10)
    double precision :: data2(10)

    call functest<<<1,10>>>(data1)

    data2 = data1

    write(0,*) data2

end program

MODULE kernel

CONTAINS
attributes(global) SUBROUTINE functest(output)

  IMPLICIT NONE
  double precision :: output(:)
  double precision,constant :: s = 2.d0

  output(threadidx%x) = s


END SUBROUTINE functest

END MODULE kernel


Compiled by "pgfortran -Mcuda test.F90"

Results:
0.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000

Analysis:

All initial values of constant variable are set to 0 in .gpu file by the compiler.
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 18, 2011 10:47 am    Post subject: Reply with quote

Hi tlstar,

It looks this is a bug since single precision and integer constants get properly data initialized, just not double precision. I've reported this as TPR#17806.

Thanks,
Mat
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 438

PostPosted: Sun May 19, 2013 3:11 pm    Post subject: TPR 17806 was fixed in 11.5 Reply with quote

And we were late to update you.

thanks,
dave
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
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