Re: NCL and stdout

From: Sean Egan <sdegan_at_nyahnyahspammersnyahnyah>
Date: Sun Oct 20 2013 - 10:10:53 MDT

Hi all,

The supercomputing center that I'm using found out that it is a buffering
issue. I guess most versions of linux come with a program written at NIST
called "unbuffer". When I execute

unbuffer ncl program.ncl >> output.txt 2>&1 &

I get the output I expect.

Just thought I'd share that with you.

Cheers,

Sean in Alaska

On Fri, Oct 18, 2013 at 4:35 AM, Carl Schreck <cjschrec@ncsu.edu> wrote:

> Dave & Sean,
>
> I've noticed similar behavior for a while. In Sean's example, program.out
> will have content once the script finishes running, but not before. Hence
> why tail -f doesn't seem to do anything.
>
> I haven't tried tee yet, maybe that'll help. One other quirky workaround I
> have found:
>
> print( "Hello" ) doesn't appear in the log file until the script finishes
>
> BUT
>
> system( "echo Hello" ) shows up immediately.
>
> Carl
>
>
> On Thu, Oct 17, 2013 at 6:53 PM, David Brown <dbrown@ucar.edu> wrote:
>
>> Hi Sean,
>> I experimented with your scenario and I do get output in the file and I
>> can see it using 'tail -f'. Is there a lot of output? If not, it could be a
>> buffering issue. The OS may not output its internal buffer until it fills
>> up.
>> If you run the program to completion does the program.out file remain
>> empty? That would definitely be weird. The OS should flush the buffers when
>> the script exits.
>>
>> Maybe try using 'tee' and see if it gives better results.
>>
>> ncl program.ncl | tee program.out
>>
>> This should output to the terminal and to the file simultaneously.
>> If this doesn't help, let us know.
>> -dave
>>
>>
>> On Oct 17, 2013, at 4:09 PM, Sean Egan <sdegan@alaska.edu> wrote:
>>
>> > I have a curious bash issue that I need help with.
>> >
>> > When I execute
>> >
>> > ncl program.ncl > program.out &
>> > tail -f program.out
>> >
>> > I receive no output. The program continues to run in the background,
>> but the file "program.out" remains empty. When I run
>> >
>> > ncl program.ncl
>> >
>> > I immediately receive output. Why is the redirect not working in this
>> case?
>> >
>> > Is this something unique to NCL or is this a problem with the way I
>> have my shell profile setup?
>> >
>> > Just curious,
>> >
>> > Sean Egan
>> > University of Alaska Fairbanks
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
> --
>
> <http://www.cicsnc.org/>
> Follow CICS-NC on Facebook <http://www.facebook.com/cicsnc>
> *Carl J. Schreck III, PhD*
> *Research Associate*
> Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/>
> North Carolina State University <http://ncsu.edu/>
> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
> 151 Patton Ave, Asheville, NC 28801
> e: cjschrec@ncsu.edu
> o: +1 828 257 3140
> CycloneCenter.org: Help analyze tropical cyclones<http://www.cyclonecenter.org/>
> monitor.cicsnc.org/mjo: See recent MJO diagnostics<http://monitor.cicsnc.org/mjo/>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Oct 20 10:11:21 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT