mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

How to debug a C++ layer

Open lovedl opened this issue 9 years ago • 4 comments

Hi, I am new to Mxnet. I am interested in implementing a new C++ layer, but I am wondering how to debug during the process. Do I have to recompile the whole framework to test it? Or is there any other simpler way. It seems like recompiling takes way too much time. I did not find any useful info in the tutorial. Hope to get some hints. Thanks. @mli @piiswrong @tqchen

lovedl avatar Jun 23 '17 10:06 lovedl

If you just want to print debug log, just set DEBUG=1 in comfig.mk, then recompile the whole framework.

KangBing avatar Jun 24 '17 15:06 KangBing

@KangBing What I meant was compiling the whole framework takes too much time. Is there any way to compile only the necessary file, like a minimum package, to test the new layer.

lovedl avatar Jun 26 '17 00:06 lovedl

@lovedl I'm not sure. But you can modify the Makefile, don't delete *.o file after compile. If you recompile, the compiler only compile the modified file and relink.

KangBing avatar Jun 26 '17 11:06 KangBing

@lovedl , you can just change the code and make, gcc will only re-compile the file you changed and those related with it

if some unexpected problem appear, try make clean, and make to re-compile all frame work

besides,

  1. make -j $(nproc) YOU_OPTIONS will compile parallelly
  2. gdb --args python YOU_ARGS can debug with gdb

hanpum avatar Jun 27 '17 09:06 hanpum