PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

An interesting CUDA Fortran ICE involving XOR

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



Joined: 06 Jul 2009
Posts: 304
Location: Greenbelt, MD

PostPosted: Wed Apr 25, 2012 6:12 am    Post subject: An interesting CUDA Fortran ICE involving XOR Reply with quote

This is an ICE, and so should probably be fixed or warned against, but I thought I'd report it. Namely, while testing/shaking out some new GPU code, it turns out that you don't want to name any array "XOR"--which sort of makes sense in this code, name-wise--as it seems to interfere with -Mcuda (as of PGI 12.4).

To test this, I copied the mmul_mod code from the end of the CUDA Fortran manual and put it in mmulmod.F90. I then copied that to a new file, mmulmod.xor.F90 and did a simple sed renaming Asub to XOR:
Code:
(339) > diff mmulmod.F90 mmulmod.xor.F90
19c19
-   real, shared :: Asub(16,16), Bsub(16,16)
---
+   real, shared :: XOR(16,16), Bsub(16,16)
39c39
-     ! loads one element of Asub and Bsub
---
+     ! loads one element of XOR and Bsub
41c41
-     Asub(tx,ty) = A(i,kb+ty-1)
---
+     XOR(tx,ty) = A(i,kb+ty-1)
53c53
-       Cij = Cij + Asub(tx,k) * Bsub(k,ty)
---
+       Cij = Cij + XOR(tx,k) * Bsub(k,ty)
Now when you compile:

Code:
(337) > pgfortran -Mcuda=keepgpu,keepptx,keepbin mmulmod.F90
/opt/pgi/linux86-64/12.4/lib/f90main.o: In function `main':
f90main.c:(.text+0x40): undefined reference to `MAIN_'
(338) > pgfortran -Mcuda=keepgpu,keepptx,keepbin mmulmod.xor.F90
mmulmod.xor.001.gpu(9): error: expected an identifier

mmulmod.xor.001.gpu(59): error: expected an expression

mmulmod.xor.001.gpu(69): error: expected an expression

3 errors detected in the compilation of "/tmp/pgnvdmhUK-FoMe3r.nv0".
PGF90-F-0000-Internal compiler error. Device compiler exited with error status code       0 (mmulmod.xor.F90: 109)
PGF90/x86-64 Linux 12.4-0: compilation aborted
where line 9 is:
Code:
       9 __shared__ __align__(8) long long xor[128];

My guess is that naming an array the same name as an operation/intrinsic can lead to interesting clashes. The right thing to do is not use XOR as an variable name, but it is technically allowed in Fortran, right?

Matt
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Apr 25, 2012 11:28 am    Post subject: Reply with quote

Hi Matt,
Quote:

The right thing to do is not use XOR as an variable name, but it is technically allowed in Fortran, right?
I believe you are correct, so I've add a problem report (TPR#18656) and sent it on to our engineers for investigation.

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



Joined: 30 Jun 2004
Posts: 373

PostPosted: Wed Aug 14, 2013 10:24 am    Post subject: TPR 18656 has been fixed in the 13.7 release Reply with quote

18656 - CUDA Fortran: naming a shared array the same as intrinsic cause CUDA errors is corrected in the current 13.7 release. Thnaks again for the report.

dave
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