PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

buffer issue with Fortran compiler??
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
abhivg



Joined: 11 Jul 2007
Posts: 3

PostPosted: Wed Jul 11, 2007 2:05 am    Post subject: buffer issue with Fortran compiler?? Reply with quote

I am trying to run a 64 bit application built using PGI fortran compiler.
Initially the application was not displaying the expected output on screen. So I added some debug 'write' statements in the code and tried after building again. Now the expected output got displayed along with my debug write statements.

The same application when built with Intel Fortran compiler runs fine.
Is this some output buffer issue? Or is there some other problem. It would be really helpful if someone could point me in the right direction.

BTW this application is a 64 bit MPI application. However I am testing only on a single machine. Also the application contains both Fortran and C code. I have used Microsoft Visual C++ Compiler to build the C code.
I am using pgf90 on windows with MSMPI.

thanks in advance.
Abhishek
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Jul 11, 2007 9:21 am    Post subject: Reply with quote

Hi Abhishek,

Quote:
I am trying to run a 64 bit application built using PGI fortran compiler.
Initially the application was not displaying the expected output on screen. So I added some debug 'write' statements in the code and tried after building again. Now the expected output got displayed along with my debug write statements.

Ah, the Heisenberg debugging problem. The most likely reasons for this is that the compiler is performing an optimization which gets inhibited when you insert in the WRITE statements. To test this theory, compile your original program (no WRITEs) without optimization, "-O0". Do you now get the expected answer? Is so, then the next step to narrow down which optimization is causing the problem and exactly where in the code the problem occurs.

For problem 1, the optimization, start by compiling at "-O1" then "-O2", "-fast", etc. until you've found the optimization that's causing the problem. Once there, reinsert the WRITE statements, either in a binary search or serially, until the problem disappears again. While doing this keep a log of the "-Minfo" messages (add this flag to the compilation to have the compiler display which optimizations it's performing). Compare the passing and failing Minfo logs to determine what optimizations were inhibited and where in the source they occur. The final step is to compile again with the problem optimization and"-gopt". Then use the PGI debugger, PGDBG, to determine the exact cause.

If you're still failing at "-O0", then look for UMRs (uninitialized memory reads) or porting problems. The same method I described above, except for the optimization hunting, will apply to these types of errors as well.

While this does seem like a lot of work and you may be tempted to simply use Intel or the lowest passing optimization, if this is a bug in your program then you may have problems in the future, or if it's a problem with the PGI compilers, we would very much appreciate a report sent to trs@pgroup.com so we can fix the issue.

Best Regards,
Mat
Back to top
View user's profile
abhivg



Joined: 11 Jul 2007
Posts: 3

PostPosted: Fri Jul 13, 2007 2:02 am    Post subject: Reply with quote

Hi Mat,

I tried without optimizations (-O0) but it didnt help. I am not really sure if its an issue with the compiler (the thread title may seem a bit misleading) or something else. Will get back in case of any updates.

thanks,
Abhishek
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Jul 13, 2007 12:32 pm    Post subject: Reply with quote

Another thought is that you have an array out-of-bounds error. Try compiling with "-Mbounds" to see if anything shows up.

- Mat
Back to top
View user's profile
abhivg



Joined: 11 Jul 2007
Posts: 3

PostPosted: Wed Jul 18, 2007 2:46 am    Post subject: Reply with quote

I tried with -Mbounds, but no change.

I am testing the application by using:

mpiexec -n 4 appname.exe

The application has a call to MPI_Abort which should kill all 4 processes. The rank 0 process should be printing the output, and then the abort should happen.

I read in some forum that the problem might be with the output buffers not getting flushed before the call to abort. However I confirmed that both stdout and stderr are being flushed explicitly before calling abort. I am trying to set the bufferring on 'stdout' and 'stderr' to unbuffered by using setvbuf3f and see if this works.

Abhishek
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 1, 2  Next
Page 1 of 2

 
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