I'm trying to learn TensorFlow's internals by stepping from its CIFAR-10 model training's python code into its core C++ code.
Using Eclipse+PyDev for step by step debugging of the python code works great, but I can't find how to step into the C++ code of the TensorFlow core.
I tried using Eclipse CDT to build the C++ code in a separate project, and attach the debugger to the python process running cifar10_train.py
as described here, but the symbols are never loaded and (obviously) deferred breakpoints are never hit.
Background and setup:
I'm running on Ubuntu 14.04 LTS, installed the TensorFlow code from sources as described here and my CDT project uses a Makefile containing
bazel build -c dbg //tensorflow/cc:tutorials_example_trainer
.
TensorFlow loads a library called _pywrap_tensorflow.so
that includes its C API (as defined in tensorflow/tensorflow/core/client/tensor_c_api.cc
).
In my case the library loaded during runtime was located in~/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
but the library that was built from the local source code was located in ~/.cache/bazel/_bazel_<username>/dbb3c677efbf9967e464a5c6a1e69337/tensorflow/bazel-out/local_linux-dbg/bin/tensorflow/python/_pywrap_tensorflow.so
.
Copying the locally built library over the loaded library, and attaching to the python process as defined in the question solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With