Training process was killed without throwing any problems
System information
- What is the top-level directory of the model you are using: research/object_detection
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): v1.5.0-0-g37aa430d84
- CUDA/cuDNN version: CUDA9,cuDNN7
- GPU model and memory: Tesla M40 24GB major: 5 minor: 2 memoryClockRate(GHz): 1.112
- Exact command to reproduce:
You can collect some of this information using our environment capture script:
== cat /etc/issue =============================================== Linux VM-0-4-ubuntu 4.4.0-91-generic #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux VERSION="16.04.1 LTS (Xenial Xerus)" VERSION_ID="16.04"
== are we in docker ============================================= No
== compiler ===================================================== c++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
== uname -a ===================================================== Linux VM-0-4-ubuntu 4.4.0-91-generic #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
== check pips ===================================================
== check for virtualenv ========================================= False
== tensorflow import ============================================ tf.VERSION = 1.5.0 tf.GIT_VERSION = v1.5.0-0-g37aa430d84 tf.COMPILER_VERSION = v1.5.0-0-g37aa430d84 Sanity check: array([1], dtype=int32)
== env ========================================================== LD_LIBRARY_PATH is unset DYLD_LIBRARY_PATH is unset
== nvidia-smi ===================================================
Thu Mar 1 11:10:22 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.30 Driver Version: 390.30 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla M40 24GB On | 00000000:00:06.0 Off | 0 |
| N/A 27C P0 61W / 250W | 0MiB / 22945MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+
== cuda libs =================================================== /usr/local/cuda-9.0/doc/man/man7/libcudart.so.7 /usr/local/cuda-9.0/doc/man/man7/libcudart.7 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart_static.a /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0.176
Describe the problem
Task: Training multiple classes for object detection based on the latest model (http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz).
I have used the model in training 1 object detection with my own dataset, then I used the model in training multiple object detection with another dataset. The reason is that the single class dataset has the same object with respect to the multiple class dataset. However, they were calibrated using different names in the label maps. Thus, I trained them one after another using the same id for correlation. The single classes dataset training process was fine and nothing weird.
In multiple classes training process, it was weird. The loss often went huge and it got killed after several hundred steps every time I restarted it.
Source code / logs
INFO:tensorflow:global step 7926: loss = 42803435837627838758912.0000 (1.109 sec/step) INFO:tensorflow:global step 7927: loss = 0.2286 (1.109 sec/step) INFO:tensorflow:global step 7928: loss = 0.8232 (1.104 sec/step) INFO:tensorflow:global step 7929: loss = 0.4113 (1.107 sec/step) INFO:tensorflow:global step 7930: loss = 0.1828 (1.104 sec/step) INFO:tensorflow:global step 7931: loss = 1.8888 (1.107 sec/step) INFO:tensorflow:global step 7932: loss = 2.4186 (1.102 sec/step) INFO:tensorflow:global step 7933: loss = 0.4744 (1.108 sec/step) INFO:tensorflow:global step 7934: loss = 0.1696 (1.113 sec/step) INFO:tensorflow:global step 7935: loss = 0.4697 (1.104 sec/step) INFO:tensorflow:global step 7936: loss = 0.9910 (1.104 sec/step) INFO:tensorflow:global step 7937: loss = 1.1343 (1.095 sec/step) INFO:tensorflow:global step 7938: loss = 41321963229405431988224.0000 (1.143 sec/step) INFO:tensorflow:global step 7939: loss = 0.8357 (1.103 sec/step) INFO:tensorflow:global step 7940: loss = 0.5256 (1.123 sec/step) INFO:tensorflow:global step 7941: loss = 1.1733 (1.106 sec/step) INFO:tensorflow:Saving checkpoint to path ./fir_aw_train/model.ckpt INFO:tensorflow:global step 7942: loss = 18019390749668924194816.0000 (1.193 sec/step) INFO:tensorflow:Recording summary at step 7942. INFO:tensorflow:global step 7943: loss = 83944286808018566250496.0000 (1.568 sec/step) INFO:tensorflow:global_step/sec: 0.888548 INFO:tensorflow:global step 7944: loss = 0.6090 (1.252 sec/step) INFO:tensorflow:global step 7945: loss = 0.4089 (1.116 sec/step) INFO:tensorflow:global step 7946: loss = 2.1286 (1.105 sec/step) INFO:tensorflow:global step 7947: loss = 0.9250 (1.115 sec/step) INFO:tensorflow:global step 7948: loss = 0.3380 (1.100 sec/step) INFO:tensorflow:global step 7949: loss = 179512220139092306821120.0000 (1.111 sec/step) INFO:tensorflow:global step 7950: loss = 0.7792 (1.109 sec/step) INFO:tensorflow:global step 7951: loss = 0.2367 (1.109 sec/step) INFO:tensorflow:global step 7952: loss = 0.3605 (1.108 sec/step) INFO:tensorflow:global step 7953: loss = 0.3600 (1.109 sec/step) INFO:tensorflow:global step 7954: loss = 33583788277664898351104.0000 (1.109 sec/step) INFO:tensorflow:global step 7955: loss = 211582443157590156247040.0000 (1.121 sec/step) INFO:tensorflow:global step 7956: loss = 0.2094 (1.100 sec/step) INFO:tensorflow:global step 7957: loss = 0.3516 (1.099 sec/step) INFO:tensorflow:global step 7958: loss = 0.2174 (1.126 sec/step) INFO:tensorflow:global step 7959: loss = 0.2402 (1.107 sec/step) INFO:tensorflow:global step 7960: loss = 0.2025 (1.117 sec/step) INFO:tensorflow:global step 7961: loss = 1.4074 (1.109 sec/step) INFO:tensorflow:global step 7962: loss = 40670269845326784364544.0000 (1.126 sec/step) INFO:tensorflow:global step 7963: loss = 0.5242 (1.109 sec/step) INFO:tensorflow:global step 7964: loss = 122390039646202713079808.0000 (1.113 sec/step) Killed
It was caused by out-of-memory. Please check your RAM consumption.
GPU or CPU ram?
CPU ram
Tensorflow-GPU : 1.7 CUDA : 9.0 CUDNN : 7.0.5 RAM : 16GB GPU : 1060 6GB
I am facing the same problem. Before I was able to do all the training but recently after updating to try for SSD Mobilenet v2, I am not able to do even simple training. I have figured out that CPU RAM is getting out-of RAM even for SSD Mobilenet v1. Is there any particular solution to reduce CPU RAM consumption?
I have tried reducing the batch size to 1. I am able to do training but parallel evaluation is not working.
I followed the guidance in this thread https://github.com/tensorflow/models/issues/1817 and managed to get my RAM usage down far enough to find objects with some success on 811 4k training images using mobilenet v2 but I am still having out of memory problems when trying to train the faster_rcnn_nas network with 32GB of ram and a GeForce GTX 660 GPU enabled. Does anyone have any ideas for how to reduce RAM usage even further?
I agree, it looks like a CPU RAM exhaustion problem. Apart from making changes to the queue sizes, what helped me fix it (I was using 8 GB of RAM with 2 GPUs) was increasing the swap space. Try that out as well.
I did manage to solve this in the end by cutting my 4k images down into 512x512 images, training on those and then when I moved to using the model in anger cutting my images up, classifying 512x512 images and then stitching the results back together.
@viralbthakar How did you resolve?
Use low resolution images for training or you gotta upgrade your RAM afaik. Initially each image of mine was 1.5MB, reducing it to ~ 70kb (lower res from the one I chose before), it started training easily on batch_size = 24
Will it ever run out of GPU memory and give the killed message? How can we know which is the issue?
@neonb88 if it runs out of GPU memory, the OOM message will be very verbose (and logged from tensorflow) in the process. It won't die silently. If it's RAM exhaustion, it's the kernel killing the process and that will be silent (you'll have logs in dmesg to confirm that it was a RAM OOM)
I did manage to solve this in the end by cutting my 4k images down into 512x512 images, training on those and then when I moved to using the model in anger cutting my images up, classifying 512x512 images and then stitching the results back together.
@stuartspotlight Do you have code for stitching back together? that would be super useful. Cheers, Sam
the dmesg -k shows error with engine graphics. What is that?
[3140588.899090] python[37252]: segfault at 0 ip 00007feab0e91650 sp 00007fff1aeb0a00 error 4 in _pywrap_tensorflow_internal.so[7feaae2c8000+2d5be000]
[3200414.809015] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3200414.809021] NVRM: Xid (PCI:0000:18:00): 31, pid=36174, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_7 faulted @ 0x7f95_87d4e000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3200459.016817] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3200459.016823] NVRM: Xid (PCI:0000:18:00): 31, pid=36233, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_3 faulted @ 0x7f76_add4f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3200526.917934] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3200526.917940] NVRM: Xid (PCI:0000:18:00): 31, pid=36296, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_7 faulted @ 0x7f14_afd4e000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3200545.094503] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3200545.094509] NVRM: Xid (PCI:0000:18:00): 31, pid=36358, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_8 faulted @ 0x7f16_13d4f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3204617.861950] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3204617.861955] NVRM: Xid (PCI:0000:18:00): 31, pid=36487, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_4 faulted @ 0x7f59_3bd4f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3204644.132369] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3204644.132371] NVRM: Xid (PCI:0000:18:00): 31, pid=36546, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_0 faulted @ 0x7f90_b9d4f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3204837.137552] pynet-0.1.out[36619]: segfault at 18 ip 0000558537eb4b32 sp 00007fffb7d59700 error 4 in pynet-0.1.out[558537e94000+b1000]
[3205513.444556] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3205513.444562] NVRM: Xid (PCI:0000:18:00): 31, pid=37214, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_6 faulted @ 0x7fc3_8120f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3205973.213766] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3205973.213771] NVRM: Xid (PCI:0000:18:00): 31, pid=40680, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_5 faulted @ 0x7f85_9d20f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3205994.552125] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3205994.552131] NVRM: Xid (PCI:0000:18:00): 31, pid=40803, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_6 faulted @ 0x7fdf_f5214000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206021.679152] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206021.679157] NVRM: Xid (PCI:0000:18:00): 31, pid=40953, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_3 faulted @ 0x7f94_7320f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206145.037404] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206145.037410] NVRM: Xid (PCI:0000:18:00): 31, pid=41520, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_6 faulted @ 0x7f50_4320e000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206159.414010] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206159.414016] NVRM: Xid (PCI:0000:18:00): 31, pid=41578, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_7 faulted @ 0x7f4b_fd20f000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206177.371201] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206177.371206] NVRM: Xid (PCI:0000:18:00): 31, pid=41637, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_8 faulted @ 0x7f01_c320e000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206309.157566] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206309.157572] NVRM: Xid (PCI:0000:18:00): 31, pid=42218, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_4 faulted @ 0x7ff5_52c00000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206327.188774] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206327.188781] NVRM: Xid (PCI:0000:18:00): 31, pid=42289, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_10 faulted @ 0x7f5a_62c00000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
[3206470.823663] NVRM: GPU at PCI:0000:18:00: GPU-d7d12c0c-9406-6ae6-beea-8ed0d8d58a71
[3206470.823669] NVRM: Xid (PCI:0000:18:00): 31, pid=42415, Ch 00000008, intr 00000000. MMU Fault: ENGINE GRAPHICS GPCCLIENT_T1_10 faulted @ 0x7fb6_1b20e000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_WRITE
This was quite hard to debug for a beginner like me, is there any reason there is no warning or printout saying that the RAM memory was exhausted?