Recompling TF Serving

After the CANN software of another version is installed, the tensorflow_model_server service may fail to be started due to a dynamic link library (DLL) link error, as shown in Figure 1.

Figure 1 DLL link error

The following describes the solution.

  1. Go to the serving-1.15.0/third_party/tf_adapter directory and run the following commands.
    Copy and save the _tf_adapter.so file in the tf_adapter folder, and change the name of the _tf_adapter.so file to lib_tf_adapter.so.
    cp ${TFPLUGIN_INSTALL_PATH}/npu_bridge/_tf_adapter.so .
    mv _tf_adapter.so lib_tf_adapter.so

    ${TFPLUGIN_INSTALL_PATH} is the installation path of the TF Adapter package.

  2. Run the following commands to clear the cache of the last compilation to prevent incremental compilation:
    rm -rvf /opt/tf_serving
    bazel clean
  3. Compile TF Serving.

    Run the following command in the TF Serving installation directory serving-1.15.0 to compile TF Serving:

    bazel --output_user_root=/opt/tf_serving build -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" tensorflow_serving/model_servers:tensorflow_model_server

    The --output_user_root option specifies the installation path of TF Serving. Set it based on the actual situation.