Updated on 2022-03-13 GMT+08:00

Compiling the Operator Plug-In

  1. Log in to the DDK server as the DDK installation user.
  2. Modify the Makefile file in projects/customop_te/plugin.

    cd $HOME/tools/projects/customop_te/plugin/

    vi Makefile

    • Change the name of the generated operator plug-in.
      ll : libcaffe_reduction_layer.so lib_caffe_parser.so
      ......bian
      libcaffe_reduction_layer.so: $(OBJS_customop)
              $(CC) -c $(CC_FLAGS) -o proto/caffe/caffe.pb.o proto/caffe/caffe.pb.cc
              $(CC) $^ $(LNK_FLAGS) -o $@
      
      lib_caffe_parser.so: $(OBJS_no_customop)
              $(CC) -c $(CC_FLAGS) -o proto/caffe/caffe.pb.o proto/caffe/caffe.pb.cc
              @if [ -f $(LOCAL_DIR)/proto/caffe/caffe.proto ]; then $(CC) $^ proto/caffe/caffe.pb.o $(LNK_FLAGS) -o $@; fi;

      libcaffe_reduction_layer.so is the name of the generated operator plug-in. You can change the name as required.

      lib_caffe_parser.so is the library file generated during the parsing of the caffe.proto file, and its name cannot be changed. For Caffe operators, ensure that all unsupported custom ones in the same model have been defined in caffe.proto File Operator Definition (Optional).

    • Set TOPDIR to the installation directory of the DDK.
      ifeq ($(DDK_PATH),)
      TOPDIR      := $(HOME)/tools/che/ddk/ddk
      else
      TOPDIR := $(DDK_PATH)
      endif
    • Use the default values for other parameters in Makefile, which serve as the common template for the operator plug-in compilation.

  3. Compile the operator plug-in.

    Run the following command in the plug-in directory to compile the operator plug-in:

    make

    After the compilation is complete, the operator plug-in file libcaffe_reduction_layer.so is generated in the current directory.