https://github.com/oneflow-inc/oneflow-mlu
https://github.com/oneflow-inc/oneflow-mlu
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oneflow-inc/oneflow-mlu
- Owner: Oneflow-Inc
- Created: 2023-03-09T01:50:24.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-22T11:23:40.000Z (about 3 years ago)
- Last Synced: 2025-04-22T17:49:29.859Z (about 1 year ago)
- Language: C++
- Size: 58.3 MB
- Stars: 7
- Watchers: 31
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# oneflow-mlu
OneFlow-MLU is an OneFlow extension that enables oneflow to run on the Cambricon MLU chips. Currently it only supports the MLU 370 series.
## Installation
### pip
TODO
### Building From Source
#### Prerequisites
- install cmake
- install Cambricon MLU driver (https://sdk.cambricon.com/download?sdk_version=V1.11.0&component_name=Driver ),CNToolKit,CNNL and CNCL (https://sdk.cambricon.com/download?sdk_version=V1.11.0&component_name=Basis ).
- build oneflow with cpu only from source and install it
#### Get the OneFlow-MLU Source
```shell
git clone https://github.com/Oneflow-Inc/oneflow-mlu
```
#### Building
Inside OneFlow-MLU source directory, then run the following command to build and install `oneflow_mlu`,
```shell
python3 setup.py install
```
## Run A Toy Program
```python
# python3
>>> import oneflow as flow
>>> import oneflow_mlu
>>>
>>> m = flow.nn.Linear(3, 4).to("mlu")
>>> x = flow.randn(4, 3, device="mlu")
>>> y = m(x)
>>> print(y)
tensor([[ 0.4239, -0.4689, -0.1660, 0.0718],
[ 0.5413, 1.9006, 2.0763, 0.8693],
[ 0.4226, -0.0207, 0.1006, 0.2234],
[ 0.4054, -0.2816, -0.4405, 0.1099]], device='mlu:0', dtype=oneflow.float32, grad_fn=)
```
## Models
- [ResNet50](https://github.com/Oneflow-Inc/oneflow-mlu-models#resnet50)
- [GPT2](https://github.com/Oneflow-Inc/oneflow-mlu-models#libai_gpt2)