PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

output redirection & PGI compilers
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
pgf90User



Joined: 08 Jul 2006
Posts: 1

PostPosted: Sat Jul 08, 2006 2:13 am    Post subject: output redirection & PGI compilers Reply with quote

Hello,

I have exactly the same problem as Denis. Has a solution been found in the meantime?

In my case the redirected output is only written in the log file after the code is done.

My output statement is simply write(*,...). I use pgf90. I have Gentoo linux and it's an intel. The shell is tcsh. I find the solution suggested by Ohio State, as recommended by Mat, too awkward for this problem. Isn't there just a flag I can set when compiling, which would resolve this problem?

Just as in Denis' case, the redirection works fine with a different compiler. Also, if I use pgf90 and I don't redirect the output it is nicely written on the screen while the code is running.

I hope someone could help. I would be grateful. Many thanks in advance.

Jurgen
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Jul 10, 2006 9:49 am    Post subject: Reply with quote

Hi Jurgen,

It's most likely an issue with the way stdio works on Linux. When stdio writes to a "tty" it uses line buffering. For pipes and redirection, it uses block buffering. One solution is to explicitly set line buffering via the 3F runtime routine "setbuf3f".
Code:

setvbuf3f(lu,type,size)
    lu is the logical unit
    type is 0 - full buffering, 1 - line buffering, 2 - no buffering
    size is the size of the new buffer


For the logical unit, use 6 for standard out (stdout). So, for line
buffering you may use the following call at the beginning of your program:

Code:
call setvbuf3f(6,1,180)


Note that the size doesn't actually set the buffer size as the Linux man pages indicate, but it does correctly set the buffering type.

Hope this helps,
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
Goto page Previous  1, 2
Page 2 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