| View previous topic :: View next topic |
| Author |
Message |
tlstar
Joined: 31 Mar 2011 Posts: 22
|
Posted: Thu Apr 14, 2011 3:29 pm Post subject: Initial value for constant variable in cuda fortran |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4995 Location: The Portland Group Inc.
|
Posted: Mon Apr 18, 2011 10:47 am Post subject: |
|
|
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 |
|
 |
jtull
Joined: 30 Jun 2004 Posts: 233
|
Posted: Sun May 19, 2013 3:11 pm Post subject: TPR 17806 was fixed in 11.5 |
|
|
And we were late to update you.
thanks,
dave |
|
| Back to top |
|
 |
|