[SciPy-User] fmin_l_bfgs_b stdout gets mixed into following Python stdout
Daan Wynen
daan.wynen at inria.fr
Tue Feb 3 09:20:53 EST 2015
sadly, the -u flag doesn't help after all.
I guess for the moment at least I have to live with this... :/
On 01/29/2015 04:32 PM, Matthew Gidden wrote:
> If this works for you, not that you can also set the PYTHONUNBUFFERED
> <https://docs.python.org/2/using/cmdline.html#envvar-PYTHONUNBUFFERED>
> environment variable (in case you're running this via a testing
> framework, for instance).
>
> On Thu, Jan 29, 2015 at 9:25 AM, Jaidev Deshpande
> <deshpande.jaidev at gmail.com <mailto:deshpande.jaidev at gmail.com>> wrote:
>
>
>
> On Thu, Jan 29, 2015 at 8:28 PM, Daan Wynen <daan.wynen at inria.fr
> <mailto:daan.wynen at inria.fr>> wrote:
>
> Hi,
>
> I couldn't find anything about this issue, and it is not
> critical but annoying.
> Whenever I run the solver, the standard output order gets
> mixed up.
> What I want to see is the following (blank lines stripped out
> for saving space):
>
> ...
> ME SAYS: Unoptimized objective: 0.947251976788
>
> RUNNING THE L-BFGS-B CODE
> * * *
> Machine precision = 2.220D-16
> N = 50 M = 20
> At X0 0 variables are exactly at the bounds
> At iterate 0 f= 9.47252D-01 |proj g|= 1.04635D-01
> At iterate 1 f= 7.95655D-01 |proj g|= 9.16550D-02
> ...
> At iterate 3769 f= 7.12543D-05 |proj g|= 2.07939D-05
> At iterate 3770 f= 7.12527D-05 |proj g|= 1.51021D-04
> * * *
> Tit = total number of iterations
> ...
> Total User time 0.000E+00 seconds.
>
> ME SAYS: After optimization: 7.1252665476e-05
> ...
>
>
> Instead, what I get is this:
>
>
> ...
> ME SAYS: Unoptimized objective: 0.947251976788
>
> RUNNING THE L-BFGS-B CODE
> * * *
> Machine precision = 2.220D-16
> N = 50 M = 20
> At X0 0 variables are exactly at the bounds
> At iterate 0 f= 9.47252D-01 |proj g|= 1.04635D-01
> At iterate 1 f= 7.95655D-01 |proj g|= 9.16550D-02
> ...
> At iterate 3147 f= 8.09457D-05 |proj g|= 5.97659D-05
>
> ME SAYS: After optimization: 7.1252665476e-05
> At iterate 3148 f= 8.09298D-05 |proj g|= 5.19516D-05
> ...
> At iterate 3769 f= 7.12543D-05 |proj g|= 2.07939D-05
> At iterate 3770 f= 7.12527D-05 |proj g|= 1.51021D-04
> * * *
> Tit = total number of iterations
> ...
> Total User time 0.000E+00 seconds.
> ...
>
> Obviously, when I run an experiment, I would like to see the
> result at the end, and not buried somewhere in the middle of
> the iteration outputs.
> I tried passing callback=lambda _: sys.stdout.flush() and
> putting another flush after the whole optimization, but it
> didn't help.
> The example is on a very fast toy calculation, but this also
> happens when each iteration takes multiple seconds.
>
> I am using:
> python 2.7.3 (virtualenv from Fedora 18 distribution)
> scipy 0.14.1
> numpy 1.9.1
> But this also happens on Canopy.
>
> Is this maybe just to be expected when interfacing with
> fortran, or am I using this the wrong way?
>
> Best Regards
> Daan Wynen
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org <mailto:SciPy-User at scipy.org>
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
> Perhaps this can be fixed by running your Python script in the
> unbuffered output mode, as
>
> $ python -u foo.py
>
> --
> JD
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org <mailto:SciPy-User at scipy.org>
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
>
>
> --
> Matthew Gidden
> Ph.D. Candidate, Nuclear Engineering
> The University of Wisconsin -- Madison
> Ph. 225.892.3192
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150203/a9e9ae41/attachment.html>
More information about the SciPy-User
mailing list