microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.51k stars 4.28k forks source link

How should I compile CNTK for Python from source code and save debug information as much as possible, so that I can use 'gdb' to watch the source code when debugging my python code? #3809

Open shiningrain opened 4 years ago

shiningrain commented 4 years ago

I encountered some problems when compiling CNTK from source code following the operation in link(The detailed commands I used when installing dependent libraries can refer to the attached file 'cntk_compile.md' in the following zip). Even if I have added the debug option during the compilation process (show in the 'cntk_compile.md', the Flags in all makefiles were added to '-g -O0'), and I still couldn't use gdb to debug it successfully. I can't see the current execution of CNTK source codes when the code runs.
cntkcompile.zip

I debugged using these commands :

gdb python 
b xxx(set breakpoint on the functions in the source code you want to stop) 
r xxx.py(run your python code, then it will stay on the breakpoint) 

The following picture shows that I can see the Tensorflow source code by gdb when I compiled Tensorflow with debug options. TensorflowGdb And this following picture shows that CNTK with the same debug option will not show the source code or other details. I can only stop on the dynamic link library-even if I compile from the source code guiding by the above link and add the flag "-g -O0" to all makefile to enable debug information. But it seems that some information about CNTK source code is still being discarded during compilation. CNTKGdb

How should I compile CNTK for python so that the debugging information about the source code can be saved to the greatest extent (like the Tensorflow lib in the above picture) to help me see the relevant information of these source code when debugging with gdb? I hope that when I using gdb debug, I can also see the CNTK source code, like Tensorflow lib shown in the first picture.