拆程序
[ ] 分析一个发展到半程的DL项目CXXNET
- 开始时间
- 源码阅读,code structure
- coding guide
- 格式,注释文档
- getting started
- src文件夹下的文件夹都有一个.h文件.这个文件是一个模块module,
.h
文件是模块接口interface. - 所有其他的
-inl.hpp
文件是接口的实现implementations.
- 所有接口都是对其他模块可视的.
- Templatized class with parameter xpu that can stands for cpu or gpu.
- The project depends on mshadow for tensor operations.
- src文件夹下的文件夹都有一个.h文件.这个文件是一个模块module,
- 项目的逻辑布局
- 依赖顺序:nnet->updater->layer
- 所有模块依赖global.h and utils
- io is an independent module
- ayer is implementation of neural net layers and defines forward and backward propagation
- updater is the parameter updating module,it defines update rule of weights.
- AsyncUpdater is a special updater that handles asynchronize communication and update
- It uses mshadow-ps to do async communication
- nnet is the neural net structure that combines layers together to form a neural net
- Dependency in nnet: CXXNetThreadTrainer->NeuralNetThread->NeuralNet
- io is the input module to handle reading various data and preprocessing.
-( io看来是数据传输模块,涉及底层的操作
- io uses iterator pattern to handle data processing pipeline
- The pipeline can be mult-threaded using threadbuffer trick
- 依赖顺序:nnet->updater->layer
- 所有的源码怎么组织工作起来.
- 数据从io模块拉入nnet
- nnet获得已经获取部分数据的#gpu线程,调用层对象来做forwardbackprop(forward and backward propagation)
- 对于每个权重,更新(updater)被创建
- AsyncUpdater.AfterBackprop is called after backprop of the corresponding layer to push out gradient
- AsyncUPdater.UpdateWait is called before forward to the layer
- mshadow-ps does the async trick of parameter communication
- AsyncUpdater will call IUpdater, which does the updating trick
- If update_on_server is on, IUpdater will be created on server-side instead
- 文件命名惯例
- coding guide
- .h files are data structures and interface
- In each folder, there is one .h file that have same name as the folder, this file defines everything needed for other module to use this module
- Interface headers: layer/layer.h, updater/updater.h
- -inl.hpp files are implementations of interface, like cpp file in most project.
- You only need to understand the interface file to understand the usage of that layer
- In each folder, there can be a .cpp file, and .cu file that that compiles the module of that layer
- the .cpp file and .cu file does not contain implementation, but reuse common implementation in file ends with _impl-inl.hpp
分析项目
- automake 工具使用
- 原因是缺少libtool,其实也是缺少aclocal等工具.
- ?但是安装automake时已经自动安装了m4,autoconf.是否可以通过设置 m4_pattern_allow?
configure.ac:16: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
[ ] 怎么查找错误?