项目作者: jizhuoran

项目描述 :
Convert Caffe-CPU prototxt to HUAWEI Atlas prototxt
高级语言: Python
项目地址: git://github.com/jizhuoran/caffe-huawei-atlas-convertor.git
创建时间: 2020-07-31T07:01:10Z
项目社区:https://github.com/jizhuoran/caffe-huawei-atlas-convertor

开源协议:

下载


caffe-huawei-atlas-convertor

This is a converter to transfer Caffe-CPU prototxt to HUAWEI Atlas prototxt. It generates the Atlas AICORE kernel codes, compiler the code, and append the kernel info to prototxt.

Basic Logic

It relies on Caffe-CPU to figure out what AICORE kernel codes are needed. The “name” of these AICORE kernel codes is automatically collected into a python file.

The python file also contains the necessary code to compile the code. It compiles the code first and then collects the kernels’ information, such as their names and num_cores. It then appends the information to the original caffe prototxt, which is used by caffe-atlas.

Compile

HUAWEI only provides binary files for its compiler, which is for Ubuntu 18.04. This converter also runs on Ubuntu 18.04 only.

Caffe can be compiled follow link, but you must compiler the one in this repo!

Usage Example (lenet on mnist)

  1. cd REPO_HOME
  2. cd caffe
  3. ./data/mnist/get_mnist.sh
  4. ./examples/mnist/create_mnist.sh
  5. ./examples/mnist/train_lenet.sh
  6. cd ..

It generates a python file gen_compile_net.py. Some path needs to be specified, but you can just run

  1. sh run.sh

A directory named ‘kernel_meta’ is generated. It contains the *.o kernel codes and the aicore_YOU_PROTOTXT_NAME.prototxt file.

You can then use caffe-atlas and these files for training.