You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 9.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. ![MindSpore Logo](docs/MindSpore-logo.png "MindSpore logo")
  2. ============================================================
  3. - [What is MindSpore?](#what-is-mindspore)
  4. - [Automatic Differentiation](#automatic-differentiation)
  5. - [Automatic Parallel](#automatic-parallel)
  6. - [Installation](#installation)
  7. - [Binaries](#binaries)
  8. - [From Source](#from-source)
  9. - [Docker Image](#docker-image)
  10. - [Quickstart](#quickstart)
  11. - [Docs](#docs)
  12. - [Community](#community)
  13. - [Governance](#governance)
  14. - [Communication](#communication)
  15. - [Contributing](#contributing)
  16. - [Release Notes](#release-notes)
  17. - [License](#license)
  18. ## What Is MindSpore
  19. MindSpore is a new open source deep learning training/inference framework that
  20. could be used for mobile, edge and cloud scenarios. MindSpore is designed to
  21. provide development experience with friendly design and efficient execution for
  22. the data scientists and algorithmic engineers, native support for Ascend AI
  23. processor, and software hardware co-optimization. At the meantime MindSpore as
  24. a global AI open source community, aims to further advance the development and
  25. enrichment of the AI software/hardware application ecosystem.
  26. <img src="docs/MindSpore-architecture.png" alt="MindSpore Architecture" width="600"/>
  27. For more details please check out our [Architecture Guide](https://www.mindspore.cn/docs/en/0.1.0-alpha/architecture.html).
  28. ### Automatic Differentiation
  29. There are currently three automatic differentiation techniques in mainstream deep learning frameworks:
  30. - **Conversion based on static compute graph**: Convert the network into a static data flow graph at compile time, then turn the chain rule into a data flow graph to implement automatic differentiation.
  31. - **Conversion based on dynamic compute graph**: Record the operation trajectory of the network during forward execution in an operator overloaded manner, then apply the chain rule to the dynamically generated data flow graph to implement automatic differentiation.
  32. - **Conversion based on source code**: This technology is evolving from the functional programming framework and performs automatic differential transformation on the intermediate expression (the expression form of the program during the compilation process) in the form of just-in-time compilation (JIT), supporting complex control flow scenarios, higher-order functions and closures.
  33. TensorFlow adopted static calculation diagrams in the early days, whereas PyTorch used dynamic calculation diagrams. Static maps can utilize static compilation technology to optimize network performance, however, building a network or debugging it is very complicated. The use of dynamic graphics is very convenient, but it is difficult to achieve extreme optimization in performance.
  34. But MindSpore finds another way, automatic differentiation based on source code conversion. On the one hand, it supports automatic differentiation of automatic control flow, so it is quite convenient to build models like PyTorch. On the other hand, MindSpore can perform static compilation optimization on neural networks to achieve great performance.
  35. <img src="docs/Automatic-differentiation.png" alt="Automatic Differentiation" width="600"/>
  36. The implementation of MindSpore automatic differentiation can be understood as the symbolic differentiation of the program itself. Because MindSpore IR is a functional intermediate expression, it has an intuitive correspondence with the composite function in basic algebra. The derivation formula of the composite function composed of arbitrary basic functions can be derived. Each primitive operation in MindSpore IR can correspond to the basic functions in basic algebra, which can build more complex flow control.
  37. ### Automatic Parallel
  38. The goal of MindSpore automatic parallel is to build a training method that combines data parallelism, model parallelism, and hybrid parallelism. It can automatically select a least cost model splitting strategy to achieve automatic distributed parallel training.
  39. <img src="docs/Automatic-parallel.png" alt="Automatic Parallel" width="600"/>
  40. At present, MindSpore uses a fine-grained parallel strategy of splitting operators, that is, each operator in the figure is splitted into a cluster to complete parallel operations. The splitting strategy during this period may be very complicated, but as a developer advocating Pythonic, you don't need to care about the underlying implementation, as long as the top-level API compute is efficient.
  41. ## Installation
  42. ### Binaries
  43. MindSpore offers build options across multiple backends:
  44. | Hardware Platform | Operating System | Status |
  45. | :---------------- | :--------------- | :----- |
  46. | Ascend910 | Ubuntu-x86 | ✔️ |
  47. | | EulerOS-x86 | ✔️ |
  48. | | EulerOS-aarch64 | ✔️ |
  49. | GPU CUDA 9.2 | Ubuntu-x86 | ✔️ |
  50. | GPU CUDA 10.1 | Ubuntu-x86 | ✔️ |
  51. | CPU | Ubuntu-x86 | ✔️ |
  52. | | Windows-x86 | ✔️ |
  53. For installation using `pip`, take `CPU` and `Ubuntu-x86` build version as an example:
  54. 1. Download whl from [MindSpore download page](https://www.mindspore.cn/versions/en), and install the package.
  55. ```
  56. pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/0.1.0-alpha/MindSpore/cpu/ubuntu-x86/mindspore-0.1.0-cp37-cp37m-linux_x86_64.whl
  57. ```
  58. 2. Run the following command to verify the install.
  59. ```
  60. python -c 'import mindspore'
  61. ```
  62. ### From Source
  63. [Install MindSpore](https://www.mindspore.cn/install/en).
  64. ### Docker Image
  65. MindSpore docker image is hosted on [Docker Hub](https://hub.docker.com/r/mindspore),
  66. currently the containerized build options are supported as follows:
  67. | Hardware Platform | Docker Image Repository | Tag | Description |
  68. | :---------------- | :---------------------- | :-- | :---------- |
  69. | CPU | `mindspore/mindspore-cpu` | `0.1.0-alpha` | Production environment with pre-installed MindSpore `0.1.0-alpha` CPU release. |
  70. | | | `devel` | Development environment provided to build MindSpore (with `CPU` backend) from the source, refer to https://www.mindspore.cn/install/en for installation details. |
  71. | | | `runtime` | Runtime environment provided to install MindSpore binary package with `CPU` backend. |
  72. | GPU | `mindspore/mindspore-gpu` | `0.1.0-alpha` | Production environment with pre-installed MindSpore `0.1.0-alpha` GPU release. |
  73. | | | `devel` | Development environment provided to build MindSpore (with `GPU CUDA10.1` backend) from the source, refer to https://www.mindspore.cn/install/en for installation details. |
  74. | | | `runtime` | Runtime environment provided to install MindSpore binary package with `GPU` backend. |
  75. | Ascend | <center>&mdash;</center> | <center>&mdash;</center> | Coming soon. |
  76. * CPU
  77. For `CPU` backend, you can directly pull and run the image using the below command:
  78. ```
  79. docker pull mindspore/mindspore-cpu:0.1.0-alpha
  80. docker run -it mindspore/mindspore-cpu:0.1.0-alpha python -c 'import mindspore'
  81. ```
  82. * GPU
  83. For `GPU` backend, please make sure the `nvidia-container-toolkit` has been installed in advance, here are some install guidelines for `Ubuntu` users:
  84. ```
  85. DISTRIBUTION=$(. /etc/os-release; echo $ID$VERSION_ID)
  86. curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
  87. curl -s -L https://nvidia.github.io/nvidia-docker/$DISTRIBUTION/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list
  88. sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-docker2
  89. sudo systemctl restart docker
  90. ```
  91. Then you can pull and run the image using the below command:
  92. ```
  93. docker pull mindspore/mindspore-gpu:0.1.0-alpha
  94. docker run -it --runtime=nvidia --privileged=true mindspore/mindspore-gpu:0.1.0-alpha /bin/bash
  95. ```
  96. To test if the docker image works, please execute the python code below and check the output:
  97. ```python
  98. import numpy as np
  99. from mindspore import Tensor
  100. from mindspore.ops import functional as F
  101. import mindspore.context as context
  102. context.set_context(device_target="GPU")
  103. x = Tensor(np.ones([1,3,3,4]).astype(np.float32))
  104. y = Tensor(np.ones([1,3,3,4]).astype(np.float32))
  105. print(F.tensor_add(x, y))
  106. ```
  107. ```
  108. [[[ 2. 2. 2. 2.],
  109. [ 2. 2. 2. 2.],
  110. [ 2. 2. 2. 2.]],
  111. [[ 2. 2. 2. 2.],
  112. [ 2. 2. 2. 2.],
  113. [ 2. 2. 2. 2.]],
  114. [[ 2. 2. 2. 2.],
  115. [ 2. 2. 2. 2.],
  116. [ 2. 2. 2. 2.]]]
  117. ```
  118. If you want to learn more about the building process of MindSpore docker images,
  119. please check out `docker` folder for the details.
  120. ## Quickstart
  121. See the [Quick Start](https://www.mindspore.cn/tutorial/en/0.1.0-alpha/quick_start/quick_start.html)
  122. to implement the image classification.
  123. ## Docs
  124. More details about installation guide, tutorials and APIs, please see the
  125. [User Documentation](https://gitee.com/mindspore/docs).
  126. ## Community
  127. ### Governance
  128. Check out how MindSpore Open Governance [works](https://gitee.com/mindspore/community/blob/master/governance.md).
  129. ### Communication
  130. - [MindSpore Slack](https://join.slack.com/t/mindspore/shared_invite/enQtOTcwMTIxMDI3NjM0LTNkMWM2MzI5NjIyZWU5ZWQ5M2EwMTQ5MWNiYzMxOGM4OWFhZjI4M2E5OGI2YTg3ODU1ODE2Njg1MThiNWI3YmQ) - Communication platform for developers.
  131. - IRC channel at `#mindspore` (only for meeting minutes logging purpose)
  132. - Video Conferencing: https://meet.jit.si
  133. - Mailing-list: https://mailweb.mindspore.cn/postorius/lists
  134. ## Contributing
  135. Welcome contributions. See our [Contributor Wiki](CONTRIBUTING.md) for
  136. more details.
  137. ## Release Notes
  138. The release notes, see our [RELEASE](RELEASE.md).
  139. ## License
  140. [Apache License 2.0](LICENSE)