jkandzi/Progress.swift

Print Statements are Sometimes Hidden

Opened this issue · 0 comments

I'm running on Ubuntu 18.04 in tmux with Swift for Tensorflow 0.10:

$ which swift
/home/xander/swift-tensorflow-RELEASE-0.10-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 55d27a5828, Swift 6a5d84ec08)
Target: x86_64-unknown-linux-gnu

When iterating quickly through ~1M items, I see this output:

66324 of 1135979 [-                             ] ETA: 00:00:04 (at 220509.61) it/s)
108336 of 1135979 [--                            ] ETA: 00:00:04 (at 216336.73) it/s)
129321 of 1135979 [---                           ] ETA: 00:00:04 (at 215253.02) it/s)
175216 of 1135979 [----                          ] ETA: 00:00:04 (at 218805.01) it/s)
ERROR: 2233827600 != 707152639 - 4
ERROR: 12597800 != 707152639 - 5
ERROR: 2399647697 != 707152639 - 6
ERROR: 3381059415 != 707152639 - 7
801095 of 1135979 [---------------------         ] ETA: 00:00:01 (at 216461.09) it/s)
842723 of 1135979 [----------------------        ] ETA: 00:00:01 (at 216034.35) it/s)
1124439 of 1135979 [----------------------------- ] ETA: 00:00:00 (at 216200.51) it/s)

Note that the above output isn't always the same. On different runs it may hide some of those ERROR statements.

I was confused by this because I had a print statement in there that was being called but wasn't showing up in my terminal. So, doing the exact same run with the ProgressBar commented out, I see this:

Successful checksum - 1
Successful checksum - 2
Successful checksum - 3
ERROR: 2233827600 != 707152639 - 4
ERROR: 12597800 != 707152639 - 5
ERROR: 2399647697 != 707152639 - 6
ERROR: 3381059415 != 707152639 - 7
Successful checksum - 8
Successful checksum - 9
Successful checksum - 10

This is the full print() output I expect.

This also occurred on Ubuntu outside of tmux. Just ssh-ed into bash. I haven't attempted to reproduce on macOS.

Hiding print statements is making it difficult to both debug a for loop at the same time I know how efficient my code is running inside the for loop.