diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51806a6863612decfd5b3fb30ba2ef1918e63f40..91d057a49e2a0a71a3e160f0f772bfeaf8891dca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,8 @@ docs: - cd docs - make html - CI_LATEST_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/latest - - CI_JOB_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/$CI_BUILD_ID + - CI_JOB_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/$CI_PIPELINE_ID + - rm -rf $CI_JOB_OUTPUT_PATH - mkdir -p $CI_JOB_OUTPUT_PATH - cp -r _build/html $CI_JOB_OUTPUT_PATH/docs - rm -rf $CI_LATEST_OUTPUT_PATH diff --git a/docs/faq.md b/docs/faq.md index 01d1cd9acf12d39526802c714b39c9a922cbcdbf..c8ee4a9095f050e12d45c9a5ea6cab00a57aecd2 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,6 +1,17 @@ Frequently asked questions ========================== +Does the tensor data consume extra memory when compiled into C++ code? +---------------------------------------------------------------------- +When compiled into C++ code, the data will be mmaped by the system loader. +For CPU runtime, the tensor data are used without memory copy. +For GPU and DSP runtime, the tensor data is used once during model +initialization. The operating system is free to swap the pages out, however, +it still consumes virtual memory space. So generally speaking, it takes +no extra physical memory. If you are short of virtual memory space (this +should be very rare), you can choose load the tensor data from a file, which +can be unmapped after initialization. + Why is the generated static library file size so huge? ------------------------------------------------------- The static library is simply an archive of a set of object files which are diff --git a/docs/getting_started/docker.md b/docs/getting_started/docker.md deleted file mode 100644 index f58f4a64f7320552849a543fca23ab20ea71b5e1..0000000000000000000000000000000000000000 --- a/docs/getting_started/docker.md +++ /dev/null @@ -1,27 +0,0 @@ -Docker Images -============= - -* Login in [Xiaomi Docker Registry](http://docs.api.xiaomi.net/docker-registry/) - -``` -docker login cr.d.xiaomi.net -``` - -* Build with `Dockerfile` - -``` -docker build -t cr.d.xiaomi.net/mace/mace-dev -``` - -* Pull image from docker registry - -``` -docker pull cr.d.xiaomi.net/mace/mace-dev -``` - -* Create container - -``` -# Set 'host' network to use ADB -docker run -it --rm -v /local/path:/container/path --net=host cr.d.xiaomi.net/mace/mace-dev /bin/bash -``` diff --git a/docs/getting_started/how_to_build.rst b/docs/getting_started/how_to_build.rst index 47781280c28220262be074192bd241071f04602a..7f2c0d3a3e7030c78dc523b7f7812d0c9360a4d9 100644 --- a/docs/getting_started/how_to_build.rst +++ b/docs/getting_started/how_to_build.rst @@ -48,6 +48,36 @@ How to build | docker(for caffe) | >= 17.09.0-ce | `install doc `__ | +---------------------+-----------------+---------------------------------------------------------------------------------------------------+ +Docker Images +---------------- + +* Login in `Xiaomi Docker Registry `__ + +.. code:: sh + + docker login cr.d.xiaomi.net + +* Build with Dockerfile + +.. code:: sh + + docker build -t cr.d.xiaomi.net/mace/mace-dev + + +* Pull image from docker registry + +.. code:: sh + + docker pull cr.d.xiaomi.net/mace/mace-dev + +* Create container + +.. code:: sh + + # Set 'host' network to use ADB + docker run -it --rm -v /local/path:/container/path --net=host cr.d.xiaomi.net/mace/mace-dev /bin/bash + + 使用简介 -------- diff --git a/docs/getting_started/introduction.md b/docs/getting_started/introduction.md deleted file mode 100644 index 8cfc6b72537f996fa6f7b220167caf532effac3a..0000000000000000000000000000000000000000 --- a/docs/getting_started/introduction.md +++ /dev/null @@ -1,8 +0,0 @@ -Introduction -============ - -TODO: describe the conceptions and workflow with diagram. -![alt text](workflow.jpg "MiAI workflow") - -TODO: describe the runtime. - diff --git a/docs/getting_started/introduction.rst b/docs/getting_started/introduction.rst new file mode 100644 index 0000000000000000000000000000000000000000..4f9d4c8ae38c085bb0d5e54c587a65390950a5dc --- /dev/null +++ b/docs/getting_started/introduction.rst @@ -0,0 +1,46 @@ +Introduction +============ + +MiAI Compute Engine is a deep learning inference framework optimized for +mobile heterogeneous computing platforms. The following figure shows the +overall architecture. + +.. image:: mace-arch.png + :scale: 40 % + :align: center + +Model format +------------ + +MiAI Compute Engine defines a customized model format which is similar to +Caffe2. The MiAI model can be converted from exported models by TensorFlow +and Caffe. We define a YAML schema to describe the model deployment. In the +next chapter, there is a detailed guide showing how to create this YAML file. + +Model conversion +---------------- + +Currently, we provide model converters for TensorFlow and Caffe. And +more frameworks will be supported in the future. + +Model loading +------------- + +The MiAI model format contains two parts: the model graph definition and +the model parameter tensors. The graph part utilizes Protocol Buffers +for serialization. All the model parameter tensors are concatenated +together into a continuous array, and we call this array tensor data in +the following paragraphs. In the model graph, the tensor data offsets +and lengths are recorded. + +The models can be loaded in 3 ways: + +1. Both model graph and tensor data are dynamically loaded externally + (by default, from file system, but the users are free to choose their own + implementations, for example, with compression or encryption). This + approach provides the most flexibility but the weakest model protection. +2. Both model graph and tensor data are converted into C++ code and loaded + by executing the compiled code. This approach provides the strongest + model protection and simplest deployment. +3. The model graph is converted into C++ code and constructed as the second + approach, and the tensor data is loaded externally as the first approach. diff --git a/docs/getting_started/mace-arch.png b/docs/getting_started/mace-arch.png new file mode 100644 index 0000000000000000000000000000000000000000..bfa4928b83df9604273a3bca4633bad40c0299ad Binary files /dev/null and b/docs/getting_started/mace-arch.png differ diff --git a/docs/getting_started/workflow.jpg b/docs/getting_started/workflow.jpg deleted file mode 100644 index e00ebea13ac5e261feb38306938f97fa995d47c7..0000000000000000000000000000000000000000 Binary files a/docs/getting_started/workflow.jpg and /dev/null differ diff --git a/docs/index.rst b/docs/index.rst index 70cfab0fdd9f1c69a62108dd0773f9dbadb21d37..a42b1655448dad6c622882f7359918b851a41576 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,6 @@ The main documentation is organized into the following sections: getting_started/introduction getting_started/create_a_model_deployment - getting_started/docker getting_started/how_to_build getting_started/op_lists