1

I have a python tensorflow script, named train.py

when I use python train.py, it trains successfully, but when I use python train.py >log, the script suspends, and the last log is

I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K40c, pci bus id: 0000:04:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tesla K40c, pci bus id: 0000:0a:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:2) -> (device: 2, name: Tesla K40c, pci bus id: 0000:84:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:3) -> (device: 3, name: Tesla K40c, pci bus id: 0000:8a:00.0)

I have try another simple python script named test.py which includes

while True:
   print "abc"

and use python test.py >log &, it runs successfully.

My operating system is CentOs 6.2. May be it not the tensorflow's problem. But I don't have any idea, so I can only post my status.

Maybe useful: The same script is running in another directory successfully. But I cp -r train.py to this directory and change some parameters, it failes.

Please help, thanks.

Cow
  • 99
  • 7

1 Answers1

0

You're probably getting an exception that is being feed to STDERR and you're only redirecting STDOUT to your log. See this question for redirecting both STDERR and STDOUT to your log, and... voila! It'll all make sense, or so I suspect. :)

How can I redirect and append both stdout and stderr to a file with Bash?

Community
  • 1
  • 1
David Parks
  • 30,789
  • 47
  • 185
  • 328
  • Thanks, when I use python train.py >>train.log 2>&1 & to run the script, it is also suspend. – Cow Apr 27 '17 at 02:33