您的位置:首页 > Web前端

nsight 使用caffe。

2015-08-18 11:30 387 查看
http://www.pittnuts.com/2015/06/build-and-debug-caffe-in-nsight/ 参考博客

不用配置,直接在nsight中导入原有工程caffe-master就可以了。。


Build and Debug Caffe in Eclipse Nsight

Posted on June
29, 2015 by weiwen.web

For those who want to debug and dig into the source code of Caffe, it may be better to build
and debug it in a graphic IDE. This post records my success of building and debugging Caffe in Nvidia’s Eclipse Nsight.

I detoured far far away before figuring out this extremely simple solution:

Environment: Ubuntu 14.04

To build:

1. Follow Caffe
Installation tutorial to install all prerequisites;

2. git clone Caffe to $CAFFE_ROOT;

git clone https://github.com/BVLC/caffe.git $CAFFE_ROOT

3. cp Makefile.config.example Makefile.config and configure your parameters (ex. turn debug
mode by uncommenting DEBUG := 1);

4. run “nsight” in the terimal to launch Nsignt IDE;

5. in Nsight, File -> New -> Makefile Project with Existing Code, and browse $CAFFE_ROOT

6. Just build and all is done!!!

To debug

1. make sure you turned on DEBUG :=
1 when you built Caffe;

2. open the source file of the executive binary you want to debug (generally, there is a
main function);

3. click “Debug”!! (You may add a Debug Configuration for every executive program).





Fix includes and symbols unfound problem:

1. include all header folders in Properties -> General -> Paths and Symbols. Use following command to find the default header search paths and add them into the Includes tab

cpp -x c++ -Wp,-v # for cpp

cpp -x c -Wp,-v # for c

Archived (just for backup)

1. Follow Caffe
Installation tutorial to install all prerequisites;

2. run “nsight” in the terimal to launch Nsignt IDE

3. new a Cuda c/c++ project in Nsight

4. git clone Caffe under Nsight project ($CAFFE_ROOT), and refresh the project folder in Nsight

git clone https://github.com/BVLC/caffe.git
5. configure “include path” of the compiler (During building, if any header file is unfound, just use “locate/find” command to check where it is and include its location in the build configuration)

6.generate caffe.pb.h manually

protoc src/caffe/proto/caffe.proto –cpp_out=.

mkdir include/caffe/proto

#mv src/caffe/proto/caffe.pb.h include/caffe/proto (unnecessary if you included $CAFFE_ROOT/src )

7. For following error, check if and where you install python, and include /usr/include/python2.7, in my case

../caffe/python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory

8. fatal error: src/caffe/proto/caffe.pb.h: No such file or directory (Fix it by including $CAFFE_ROOT)

9. ../caffe/matlab/+caffe/private/caffe_.cpp:16:17: fatal error: mex.h: No such file or directory

ensure you installed matlab, “locate” and include the path of mex.h (in my case, /usr/local/MATLAB/R2014b/extern/include)

(Just for backup)…

--------------------------------------------------

加载工程 之后, 把脚本命令 放到 nsight 配置设置中去.如果在Linux下 编译好的话,在这里可以直接运行

配置文件 主要配置 程序运行的入口函数 和 配置参数 如下图所示:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: