|
1 | | -# Build and Install from Source Code |
| 1 | +Installation Guide |
| 2 | +================== |
2 | 3 |
|
3 | | -This is guide to build an Intel® Extension for PyTorch* PyPI package from source and install it in Linux. |
4 | | - |
5 | | - |
6 | | -## Prepare |
| 4 | +## System Requirements |
7 | 5 |
|
8 | 6 | ### Hardware Requirement |
9 | 7 |
|
10 | 8 | Verified Hardware Platforms: |
11 | 9 | - Intel® Data Center GPU Flex Series 170 |
| 10 | + - Intel® Data Center GPU Max Series |
| 11 | + - Intel® Arc™ A-Series Graphics (with limited validation) |
12 | 12 |
|
13 | 13 | ### Software Requirements |
14 | 14 |
|
15 | | -- Ubuntu 20.04 (64-bit) |
| 15 | +- Ubuntu 22.04 (64-bit) |
16 | 16 | - Intel GPU Drivers |
17 | | - - Intel® Data Center GPU Flex Series [419.40](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html) |
18 | | -- Intel® oneAPI Base Toolkit 2022.3 |
| 17 | + - Intel® Data Center GPU Flex Series [TBD](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html) |
| 18 | + - Intel® Data Center GPU Max Series [TBD](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html) |
| 19 | + - Intel® Arc™ A-Series Graphics [TBD](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html) |
| 20 | +- Intel® oneAPI Base Toolkit 2023.0 |
19 | 21 | - Python 3.7-3.10 |
20 | 22 |
|
| 23 | +## PyTorch-Intel® Extension for PyTorch\* Version Mapping |
| 24 | + |
| 25 | +Intel® Extension for PyTorch\* has to work with a corresponding version of PyTorch. Here are the PyTorch versions that we support and the mapping relationship: |
| 26 | + |
| 27 | +|PyTorch Version|Extension Version| |
| 28 | +|--|--| |
| 29 | +|[v1.13.\*](https://github.com/pytorch/pytorch/tree/v1.13.0) (patches needed)|[v1.13.\*](https://github.com/intel/intel-extension-for-pytorch/tree/v1.13.10+xpu)| |
| 30 | +|[v1.10.\*](https://github.com/pytorch/pytorch/tree/v1.10.0) (patches needed)|[v1.10.\*](https://github.com/intel/intel-extension-for-pytorch/tree/v1.10.200+gpu)| |
| 31 | + |
| 32 | +## Preparations |
| 33 | + |
21 | 34 | ### Install Intel GPU Driver |
22 | 35 |
|
23 | 36 | |Release|OS|Intel GPU|Install Intel GPU Driver| |
24 | 37 | |-|-|-|-| |
25 | | -|v1.0.0|Ubuntu 20.04|Intel® Data Center GPU Flex Series| Refer to the [Installation Guides](https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-focal-dc.html) for latest driver installation. If install the verified Intel® Data Center GPU Flex Series [419.40](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html), please append the specific version after components, such as `sudo apt-get install intel-opencl-icd=22.28.23726.1+i419~u20.04`| |
| 38 | +|v1.0.0|Ubuntu 20.04|Intel® Data Center GPU Flex Series| Refer to the [Installation Guides](https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-focal-dc.html) for the latest driver installation. If installing the verified Intel® Data Center GPU Flex Series [419.40](https://dgpu-docs.intel.com/releases/stable_419_40_20220914.html), use a specific version for component package names, such as `sudo apt-get install intel-opencl-icd=22.28.23726.1+i419~u20.04`| |
26 | 39 |
|
27 | 40 | ### Install oneAPI Base Toolkit |
28 | 41 |
|
29 | | -Please refer to [Install oneAPI Base Toolkit Packages](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#base-kit) |
| 42 | +Please refer to [Install oneAPI Base Toolkit Packages](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#base-kit). |
30 | 43 |
|
31 | 44 | Need to install components of Intel® oneAPI Base Toolkit: |
32 | 45 | - Intel® oneAPI DPC++ Compiler |
33 | 46 | - Intel® oneAPI Math Kernel Library (oneMKL) |
34 | 47 |
|
35 | | -Default installation location is /opt/intel/oneapi for root account, ${HOME}/intel/oneapi for other accounts. |
| 48 | +Default installation location *{ONEAPI_ROOT}* is `/opt/intel/oneapi` for root account, `${HOME}/intel/oneapi` for other accounts. |
36 | 49 |
|
37 | | -### Configure the AOT |
| 50 | +**_NOTE:_** You need to activate oneAPI environment when using Intel® Extension for PyTorch\* on Intel GPU. |
38 | 51 |
|
39 | | -Please refer to [AOT documentation](./AOT.md) for how to configure AOT. |
| 52 | +```bash |
| 53 | +source {ONEAPI_ROOT}/setvars.sh |
| 54 | +``` |
40 | 55 |
|
41 | | -### Build and Install from Source Code |
| 56 | +## Install via wheel files |
42 | 57 |
|
43 | | -Make sure PyTorch is installed so that the extension will work properly. For each PyTorch release, we have a corresponding release of the extension. Here are the PyTorch versions that we support and the mapping relationship: |
| 58 | +Prebuilt wheel files availability matrix for Python versions: |
44 | 59 |
|
45 | | -|PyTorch Version|Intel® Extension for PyTorch* Version| |
46 | | -|--|--| |
47 | | -|[v1.10.\*](https://github.com/pytorch/pytorch/tree/v1.10.0 "v1.10.0")|[v1.10.\*](https://github.com/intel/intel-extension-for-pytorch/tree/v1.10.200)| |
| 60 | +| Extension Version | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 | |
| 61 | +| :--: | :--: | :--: | :--: | :--: | :--: | |
| 62 | +| 1.13.10+xpu | | ✔️ | ✔️ | ✔️ | ✔️ | |
| 63 | +| 1.10.200+gpu | ✔️ | ✔️ | ✔️ | ✔️ | | |
48 | 64 |
|
| 65 | +### Install PyTorch and TorchVision |
49 | 66 |
|
50 | | -Build and Install PyTorch: |
| 67 | +```bash |
| 68 | +python -m pip install torch==1.13.0a0 torchvision==0.14.0 -f https://developer.intel.com/ipex-whl-stable-xpu |
| 69 | +``` |
| 70 | + |
| 71 | +**Note:** Installation of TorchVision is optional. |
| 72 | + |
| 73 | +### Install Numpy |
| 74 | + |
| 75 | +Numpy is required to work with PyTorch\*. Verified numpy versions differ according to python versions. |
| 76 | + |
| 77 | +```bash |
| 78 | +python -m pip install numpy==1.19.5 # for Python 3.6 |
| 79 | +python -m pip install numpy==1.21.6 # for Python 3.7 |
| 80 | +python -m pip install numpy==1.23.4 # for Python 3.8 and 3.9 |
| 81 | +``` |
| 82 | + |
| 83 | +### Install torchaudio (Optional) |
| 84 | + |
| 85 | +Intel® Extension for PyTorch\* doesn't depend on torchaudio. If you need TorchAudio, please follow the [instructions](https://github.com/pytorch/audio/tree/v0.13.0#from-source) to compile it from source. According to torchaudio-pytorch dependency table, torchaudio 0.13.0 is recommended. |
| 86 | + |
| 87 | +### Install Intel® Extension for PyTorch\* |
| 88 | + |
| 89 | +```bash |
| 90 | +python -m pip install intel_extension_for_pytorch==1.13.10+xpu -f https://developer.intel.com/ipex-whl-stable-xpu |
| 91 | +``` |
| 92 | + |
| 93 | +## Install via compiling from source |
| 94 | + |
| 95 | +### Download source code of PyTorch and Intel® Extension for PyTorch\*: |
51 | 96 |
|
52 | 97 | ```bash |
53 | 98 | $ git clone https://github.com/pytorch/pytorch.git |
54 | 99 | $ cd pytorch |
55 | | -# checkout to specific release branch if in need |
56 | | -$ git checkout ${PYTORCH_RELEASE_BRANCH_NAME} |
57 | | -# apply git patch to pytorch code, e.g., apply patch for pytorch v1.10. |
58 | | -$ git apply ${intel_extension_for_pytorch_directory}/torch_patches/{xpu-1.10}.patch |
| 100 | +$ git checkout v1.13.0 |
| 101 | + |
| 102 | +$ git clone https://github.com/intel/intel-extension-for-pytorch.git |
| 103 | +$ cd intel-extension-for-pytorch |
| 104 | +$ git checkout v1.13.10+xpu |
| 105 | +``` |
| 106 | + |
| 107 | +### Install PyTorch: |
| 108 | + |
| 109 | +```bash |
| 110 | +$ cd pytorch |
| 111 | +$ git apply ${intel_extension_for_pytorch_directory}/torch_patches/*.patch |
| 112 | +$ git submodule sync |
59 | 113 | $ git submodule update --init --recursive |
60 | 114 | $ pip install -r requirements.txt |
61 | | -# configure MKL env to enable MKL features |
62 | | -$ source ${oneAPI_HOME}/mkl/latest/env/vars.sh |
63 | | -# build pypi package and install it locally |
| 115 | +$ source {ONEAPI_ROOT}/setvars.sh |
64 | 116 | $ python setup.py bdist_wheel |
65 | 117 | $ pip install dist/*.whl |
66 | 118 | ``` |
67 | 119 |
|
68 | | -Build and Install Intel® Extension for PyTorch*: |
| 120 | +### Configure the AOT (Optional) |
| 121 | + |
| 122 | +Please refer to [AOT documentation](./AOT.md) for how to configure `USE_AOT_DEVLIST`. |
| 123 | + |
| 124 | +```bash |
| 125 | +$ export USE_AOT_DEVLIST='ats-m150,pvc' |
| 126 | +``` |
| 127 | + |
| 128 | +### Install Intel® Extension for PyTorch\*: |
69 | 129 |
|
70 | 130 | ```bash |
71 | | -$ git clone -b xpu-master https://github.com/intel/intel-extension-for-pytorch.git |
72 | 131 | $ cd intel-extension-for-pytorch |
73 | | -# checkout to specific release branch if in need |
74 | | -$ git checkout ${IPEX_RELEASE_BRANCH_NAME} |
| 132 | +$ git submodule sync |
75 | 133 | $ git submodule update --init --recursive |
76 | 134 | $ pip install -r requirements.txt |
77 | | -# configure dpcpp compiler env |
78 | | -$ source ${oneAPI_HOME}/compiler/latest/env/vars.sh |
79 | | -# configure MKL env to enable MKL features |
80 | | -$ source ${oneAPI_HOME}/mkl/latest/env/vars.sh |
81 | | -# build pypi package and install it locally |
82 | | -$ ${USE_AOT_DEVLIST} python setup.py bdist_wheel |
| 135 | +$ source {ONEAPI_ROOT}/setvars.sh # If you have sourced the oneAPI environment when compiling PyTorch, please skip this step. |
| 136 | +$ python setup.py bdist_wheel |
83 | 137 | $ pip install dist/*.whl |
84 | 138 | ``` |
0 commit comments