All Projects → Adlik → Adlik

Adlik / Adlik

Licence: apache-2.0
Adlik: Toolkit for Accelerating Deep Learning Inference

Projects that are alternatives of or similar to Adlik

Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (+54.85%)
Mutual labels:  compiler, performance
Fastexpressioncompiler
Fast ExpressionTree compiler to delegate
Stars: ✭ 631 (+166.24%)
Mutual labels:  compiler, performance
Nuitka
Nuitka is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, and 3.9. You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.
Stars: ✭ 6,173 (+2504.64%)
Mutual labels:  compiler, performance
Models
Model Zoo for Intel® Architecture: contains Intel optimizations for running deep learning workloads on Intel® Xeon® Scalable processors
Stars: ✭ 248 (+4.64%)
Mutual labels:  inference, performance
Tensorrt Laboratory
Explore the Capabilities of the TensorRT Platform
Stars: ✭ 236 (-0.42%)
Mutual labels:  grpc, inference
Clang
Mirror kept for legacy. Moved to https://github.com/llvm/llvm-project
Stars: ✭ 2,880 (+1115.19%)
Mutual labels:  compiler, performance
Nimporter
Compile Nim Extensions for Python On Import!
Stars: ✭ 474 (+100%)
Mutual labels:  compiler, performance
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (+9.7%)
Mutual labels:  compiler, performance
Ngraph
nGraph has moved to OpenVINO
Stars: ✭ 1,322 (+457.81%)
Mutual labels:  compiler, performance
Delta
Programming language focused on performance and productivity
Stars: ✭ 77 (-67.51%)
Mutual labels:  compiler, performance
Halide
a language for fast, portable data-parallel computation
Stars: ✭ 4,722 (+1892.41%)
Mutual labels:  compiler, performance
Openvino
OpenVINO™ Toolkit repository
Stars: ✭ 2,858 (+1105.91%)
Mutual labels:  inference, performance
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+3062.03%)
Mutual labels:  compiler, performance
Fortio
Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.
Stars: ✭ 2,199 (+827.85%)
Mutual labels:  grpc, performance
Rubyspeed
Compile ruby functions to C
Stars: ✭ 180 (-24.05%)
Mutual labels:  compiler, performance
Droidtelescope
DroidTelescope(DT),Android端App性能监控框架
Stars: ✭ 231 (-2.53%)
Mutual labels:  performance
Weld
High-performance runtime for data analytics applications
Stars: ✭ 2,709 (+1043.04%)
Mutual labels:  performance
Entitas Cpp
Entitas++ is a fast Entity Component System (ECS) C++11 port of Entitas C#
Stars: ✭ 229 (-3.38%)
Mutual labels:  performance
Perfview
PerfView is a CPU and memory performance-analysis tool
Stars: ✭ 2,924 (+1133.76%)
Mutual labels:  performance
Yivnet
Yivnet is a microservice game server base on go-kit
Stars: ✭ 237 (+0%)
Mutual labels:  grpc

Adlik

Build Status Tests Coverage Bors enabled CII Best Practices

Adlik [ædlik] is an end-to-end optimizing framework for deep learning models. The goal of Adlik is to accelerate deep learning inference process both on cloud and embedded environment.

Adlik schematic diagram

With Adlik framework, different deep learning models can be deployed to different platforms with high performance in a much flexible and easy way.

Using Adlik to Deploy Models in Cloud/Edge/Device

  1. In cloud environment, the compiled model and Adlik Inference Engine should be built as a docker image, and deployed as a container.

  2. In edge environment, Adlik Inference Engine should be deployed as a container. The compiled model should be transferred to edge environment, and the Adlik Inference Engine should automatically update and load model.

  3. In device environment, Adlik Inference Engine and the compiled model should be compiled into a binary file (so or lib). Users who want to run model inference on device should link user defined AI function and Adlik binary file to the execution file, and run directly.

Inference performance of Adlik

We test the inference performance of Adlik on the same CPU or GPU using the simple CNN model (MNIST model), the ResNet50 model, and InceptionV3 with different serving engines. The test performance data of Adlik on different models are as follows:

Contents

Model Optimizer

Model optimizer focuses on specific hardware and runs on it to achieve acceleration. The proposed framework mainly consists of two categories of algorithm components, i.e. pruner and quantizer.

Model Compiler

Model compiler supports several optimizing technologies like pruning, quantization and structural compression, which can be easily used for models developed with TensorFlow, Keras, PyTorch, etc.

Serving Engine

Serving Engine provides deep learning models with optimized runtime based on the deployment environment. Put simply, based on a deep learning model, the users of Adlik can optimize it with model compiler and then deploy it to a certain platform with Adlik serving platform.

Docker images

All Adlik compiler images and serving images are stored in Alibaba Cloud. These images can be downloaded and used directly, users do not need to build the Adlik on Ubuntu. Users can use the compiler images to compile model from H5, CheckPoint, FrozenGraph, ONNX and SavedModel to Openvino, TensorFlow, TensorFlow Lite, TensorRT. Users also can use the serving images for model inference.

Docker pull command:

docker pull docker_image_name:tag

Compiler docker images

The compiler docker images can be used in CPU and GPU. In the CPU, you can compile the model from source type to TensorFlow model, OpenVino model and TensorFlow Lite model. And in the CPU, you can compile the model from source type to TensorFlow model, and TensorRT model. The names and labels of compiler mirrors are as follows, and the first half of label represents the version of TensorRT, the latter part of label represents the version of CUDA:

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.2.1.6_11.0

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.2.1.6_10.2

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.2.0.11_11.0

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.1.3.4_11.0

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.1.3.4_10.2

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.0.0.11_10.2

registry.cn-beijing.aliyuncs.com/adlik/model-compiler:7.0.0.11_10.0

Using model compiler image compile model

  1. Run the image.

    docker run -it --rm -v source_model:/home/john/model
    registry.cn-beijing.aliyuncs.com/adlik/model-compiler:latest bash
    
  2. Configure the json file or environment variables required to compile the model.

    The json_field.json describle the json file field information, and for the example, you can reference compiler_json_example.json. For the environment variable field description, see env_field.txt, for the example, reference compiler_env_example.txt.

    Note: The checkpoint model must be given the input and output op names of the model when compiling, and other models can be compiled without the input and output op names of the model.

  3. Compile the model.

    Compilation instructions (json file mode):

    python3 "-c" "import json; import model_compiler as compiler;
    file=open('/mnt/model/serving_model.json','r'); request = json.load(file);compiler.compile_model(request);file.close()"
    

    Compilation instructions (environment variable mode):

    python3 "-c" "import model_compiler.compiler as compiler;compiler.compile_from_env()"
    

Serving docker imaegs

The serving docker imaegs contains CPU and GPU mirrors. The label of openvino image represents the version of OpenVINO. And for the TensorRT image the first half of label represents the version of TensorRT, the latter part of label represents the version of CUDA. The names and labels of serving mirrors are as follows:

CPU:

registry.cn-beijing.aliyuncs.com/adlik/serving/tflite-cpu:latest

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorflow-cpu:latest

registry.cn-beijing.aliyuncs.com/adlik/serving/openvino:2021.1.110

GPU:

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorflow-gpu:latest

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.2.1.6_11.0

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.2.1.6_10.2

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.2.0.11_11.0

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.1.3.4_11.0

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.1.3.4_10.2

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.0.0.11_10.2

registry.cn-beijing.aliyuncs.com/adlik/serving/tensorrt:7.0.0.11_10.0

Using the serving images for model inference

  1. Run the mirror and pay attention to mapping out the service port. example command line:

    docker run -it --rm -p 8500:8500 -v compiled_model:/model adlik/serving-openvino:latest bash
    
  2. Load the compiled model in the image and start the service.

    example command line:

    adlik-serving --grpc_port=8500 --http_port=8501 --model_base_path=/model
    
  3. Install the client wheel package adlik serving package or adlik serving gpu package locally, execute the inference code, and perform inference.

Note: If you not mapping out the service port when you run the mirror, you need install the adlik serving package or adlik serving gpu package in the container. Then execute the inference code, and perform inference in the container.

Build

This guide is for building Adlik on Ubuntu systems.

First, install Git and Bazel.

Then, clone Adlik and change the working directory into the source directory:

git clone https://github.com/ZTE/Adlik.git
cd Adlik

Build clients

  1. Install the following packages:

    • python3-setuptools
    • python3-wheel
  2. Build clients:

    bazel build //adlik_serving/clients/python:build_pip_package -c opt
    
  3. Build pip package:

    mkdir /tmp/pip-packages && bazel-bin/adlik_serving/clients/python/build_pip_package /tmp/pip-packages
    

Build serving

First, install the following packages:

  • automake
  • libtbb2
  • libtool
  • make
  • python3-six

Build serving with OpenVINO runtime

  1. Install intel-openvino-runtime-ubuntu<OS_VERSION>-<VERSION> package from OpenVINO.

  2. Assume the installation path of OpenVINO is /opt/intel/openvino_VERSION, run the following command:

    export INTEL_CVSDK_DIR=/opt/intel/openvino_VERSION
    export InferenceEngine_DIR=$INTEL_CVSDK_DIR/deployment_tools/inference_engine/share
    bazel build //adlik_serving \
        --config=openvino \
        -c opt
    

Build serving with TensorFlow CPU runtime

Run the following command:

bazel build //adlik_serving \
    --config=tensorflow-cpu \
    -c opt

Build serving with TensorFlow GPU runtime

Assume building with CUDA version 11.0.

  1. Install the following packages from here and here:

    • cuda-cupti-dev-11-0
    • libcublas-dev-11-0
    • libcudnn8=*+cuda11.0
    • libcudnn8-dev=*+cuda11.0
    • libcufft-dev-11-0
    • libcurand-dev-11-0
    • libcusolver-dev-11-0
    • libcusparse-dev-11-0
  2. Run the following command:

    env TF_CUDA_VERSION=11.0 \
        bazel build //adlik_serving \
            --config=tensorflow-gpu \
            -c opt \
            --incompatible_use_specific_tool_files=false
    

Build serving with TensorFlow Lite CPU runtime

Run the following command:

bazel build //adlik_serving \
    --config=tensorflow-lite-cpu \
    -c opt

Build serving with TensorRT runtime

Assume building with CUDA version 11.0.

  1. Install the following packages from here and here:

    • cuda-cupti-dev-11-0
    • cuda-nvml-dev-11-0
    • cuda-nvrtc-11-0
    • libcublas-dev-11-0
    • libcudnn8=*+cuda11.0
    • libcudnn8-dev=*+cuda11.0
    • libcufft-dev-11-0
    • libcurand-dev-11-0
    • libcusolver-dev-11-0
    • libcusparse-dev-11-0
    • libnvinfer7=7.2.*+cuda11.0
    • libnvinfer-dev=7.2.*+cuda11.0
    • libnvonnxparsers7=7.2.*+cuda11.0
    • libnvonnxparsers-dev=7.2.*+cuda11.0
  2. Run the following command:

    env TF_CUDA_VERSION=11.0 \
        bazel build //adlik_serving \
            --config=TensorRT \
            -c opt \
            --action_env=LIBRARY_PATH=/usr/local/cuda-11.0/lib64/stubs \
            --incompatible_use_specific_tool_files=false
    

Build in Docker

The ci/docker/build.sh file can be used to build a Docker images that contains all the requirements for building Adlik. You can build Adlik with the Docker image.

Note: If you build the runtime with GPU in a Docker image, you need to add the CUDA environment variables in the Dockerfile, such as:

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute, utility

Getting Started

Release

The version of the service engine Adlik supports.

TensorFlow 1.14 TensorFlow 2.x OpenVINO 2021 TensorRT 6 TensorRT 7
Keras
TensorFlow
PyTorch

License

Apache License 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].