PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

fundamental for-loop question.

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



Joined: 30 Jun 2011
Posts: 102

PostPosted: Tue Oct 16, 2012 8:58 am    Post subject: fundamental for-loop question. Reply with quote

In the follwing loop:

for(i=0;i<(*Env).Nfreq;i=i+1)
PRS2[i] = 0.0;

The execution of the program skips completely over it. It does not execute even once. I used the nemiver debugger and put my cursor on the two variables and they are

i=705286624
(*Env).Nfreq = 5

Now as I said it does not execute even once. So what is going on? It seems that i=0 would be set and the the program's execution would start in the loop. It does not.

I am not sure how n becomes equal to 705286624, but it should not matter. This is really a gcc programming problme not even a pgcc problem. However, I must know why this happens.

Any help appreciated. Thanks in advance.

Newport_j
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Oct 16, 2012 9:06 am    Post subject: Reply with quote

Hi Newport_j,

Is this optimized code that you're debugging? Most likely the compiler idiom recognition will be applied here and the loop would be replaced with a call to memset/bzero. The compiler feedback messages (-Minfo) will tell you if this loop was replaced. Also "i" would be put in a register so what's shown in memory for "i" will be junk.

- Mat
Back to top
View user's profile
THX 1138



Joined: 30 Jun 2011
Posts: 102

PostPosted: Tue Oct 16, 2012 1:34 pm    Post subject: loop question reply Reply with quote

I think that I know the probelm here. I compiled with optimization level 0 and I used the pgcc compiler. I also used the nemiver debugger to step through the code and to look at the variables, by putting my cursor on them.

This did not happen when I compiled with gcc and then used the nemiver debugger. I guess if I compile with pgcc then I should use only the PGI debugger to step through the code. Maybe there is an incompatibility between pggc -g and nemiver, that does not exist with gcc -g and nemiver?

Thanks in advance.

Newport_j
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Oct 16, 2012 3:37 pm    Post subject: Reply with quote

Quote:
Maybe there is an incompatibility between pggc -g and nemiver, that does not exist with gcc -g and nemiver?
I've never used nemiver so don't know, but any DWARF 2 compliant debugger should be able to debug a PGI compiled exe.

- Mat
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