Bromide is a general convolutional neural network (CNN) inference program using the Halide image processing language which is scheduled to be fast(-er than Caffe, up to 3x for now) on a single machine using CPU.
#Installation
##Installation of Halide
Bromide is built on the basis of Halide. To use Bromide, a copy of built Halide needs to be in place. The binary release of Halide can be downloaded [here] (https://github.com/halide/Halide/releases).
##Installation of glog Glog is helpful in Bromide. It can be downloaded [here] (https://github.com/google/glog).
##Installation of protobuf
Protocol Buffer is required for using Bromide. Protobuf can be downloaded [here] (https://developers.google.com/protocol-buffers/docs/downloads#latest-version). Note that src/caffe.pb.cc
and util/caffe.pb.h
need to be generated by the same version with the protobuf you link your application to. To make sure it works, we suggest you do: protoc resources/caffe.proto
, to obtain the caffe.pb.h and caffe.ph.cc files.
##Dependencies and Linking
To include/link the header files and source files, you need to check the Makefile, and modify it if necessary. The paths for searching static or shared library are defined in IDIR
and LFLAGS
, respectively. The default paths suppose your Halide is installed in your user's root directory ~/
.
##Setting environment Several environment variables for shared memory path need to be clarified for the ease of linking:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/halide/bin
#Running Bromide
##Running CNN
Having gone through the above procedures, it is now easy to run a certain CNN. The default network is LeNet. Simply running make clean
and make
, and ./run_test
, the inference process of the network will start.
##Environment ###Generating code If you are interested in the generated code by Halide, you may set the environment variable:
export HL_DEBUG_CODEGEN=1
If you wish to turn it off, just set it to 0.
###Profiling time and memory If you are interested in the time and memory consumed by each stage of the whole pipeline, such as each layer of the whole network, you may set:
export HL_JIT_TARGET=host-profile
If you wish to turn it off, just set it to blank.