installation.rst 4.6 KB
Newer Older
Przemek Tredak's avatar
Przemek Tredak committed
1
..
2
    Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Przemek Tredak's avatar
Przemek Tredak committed
3
4
5
6
7
8
9
10
11
12
13
14

    See LICENSE for license information.

Installation
============

Prerequisites
-------------
.. |driver link| replace:: NVIDIA Driver
.. _driver link: https://www.nvidia.com/drivers

1. Linux x86_64
15
16
17
2. `CUDA 12.1+ (12.8+ for Blackwell support) <https://developer.nvidia.com/cuda-downloads>`__
3. |driver link|_ supporting CUDA 12.1 or later.
4. `cuDNN 9.3 <https://developer.nvidia.com/cudnn>`__ or later.
Przemek Tredak's avatar
Przemek Tredak committed
18

Tim Moon's avatar
Tim Moon committed
19
20
21
If the CUDA Toolkit headers are not available at runtime in a standard
installation path, e.g. within `CUDA_HOME`, set
`NVTE_CUDA_INCLUDE_PATH` in the environment.
Przemek Tredak's avatar
Przemek Tredak committed
22
23
24
25
26
27
28
29

Transformer Engine in NGC Containers
------------------------------------

Transformer Engine library is preinstalled in the PyTorch container in versions 22.09 and later
on `NVIDIA GPU Cloud <https://ngc.nvidia.com>`_.


30
31
32
33
34
35
36
pip - from PyPI
-----------------------

Transformer Engine can be directly installed from `our PyPI <https://pypi.org/project/transformer-engine/>`_, e.g.

.. code-block:: bash

37
    pip3 install --no-build-isolation transformer_engine[pytorch]
38

39
To obtain the necessary Python bindings for Transformer Engine, the frameworks needed must be explicitly specified as extra dependencies in a comma-separated list (e.g. [jax,pytorch]). Transformer Engine ships wheels for the core library. Source distributions are shipped for the JAX and PyTorch extensions.
40

41
42
43
44
45
46
47
48
The core package from Transformer Engine (without any framework extensions) can be installed via:

.. code-block:: bash

    pip3 install transformer_engine[core]

By default, this will install the core library compiled for CUDA 12. The cuda major version can be specified by modified the extra dependency to `core_cu12` or `core_cu13`.

Przemek Tredak's avatar
Przemek Tredak committed
49
50
51
52
53
54
pip - from GitHub
-----------------------

Additional Prerequisites
^^^^^^^^^^^^^^^^^^^^^^^^

Tim Moon's avatar
Tim Moon committed
55
56
1. [For PyTorch support] `PyTorch <https://pytorch.org/>`__ with GPU support.
2. [For JAX support] `JAX <https://github.com/google/jax/>`__ with GPU support, version >= 0.4.7.
Przemek Tredak's avatar
Przemek Tredak committed
57
58
59
60
61
62
63
64

Installation (stable release)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Execute the following command to install the latest stable version of Transformer Engine:

.. code-block:: bash

65
  pip3 install --no-build-isolation git+https://github.com/NVIDIA/TransformerEngine.git@stable
Tim Moon's avatar
Tim Moon committed
66

67
This will automatically detect if any supported deep learning frameworks are installed and build Transformer Engine support for them. To explicitly specify frameworks, set the environment variable `NVTE_FRAMEWORK` to a comma-separated list (e.g. `NVTE_FRAMEWORK=jax,pytorch`).
Przemek Tredak's avatar
Przemek Tredak committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81

Installation (development build)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. warning::

   While the development build of Transformer Engine could contain new features not available in
   the official build yet, it is not supported and so its usage is not recommended for general
   use.

Execute the following command to install the latest development build of Transformer Engine:

.. code-block:: bash

82
  pip3 install --no-build-isolation git+https://github.com/NVIDIA/TransformerEngine.git@main
Tim Moon's avatar
Tim Moon committed
83

84
This will automatically detect if any supported deep learning frameworks are installed and build Transformer Engine support for them. To explicitly specify frameworks, set the environment variable `NVTE_FRAMEWORK` to a comma-separated list (e.g. `NVTE_FRAMEWORK=jax,pytorch`). To only build the framework-agnostic C++ API, set `NVTE_FRAMEWORK=none`.
Tim Moon's avatar
Tim Moon committed
85

86
In order to install a specific PR, execute (after changing NNN to the PR number):
87
88
89

.. code-block:: bash

90
  pip3 install --no-build-isolation git+https://github.com/NVIDIA/TransformerEngine.git@refs/pull/NNN/merge
91
92


93
94
95
96
97
98
99
Installation (from source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Execute the following commands to install Transformer Engine from source:

.. code-block:: bash

Tim Moon's avatar
Tim Moon committed
100
101
102
103
  # Clone repository, checkout stable branch, clone submodules
  git clone --branch stable --recursive https://github.com/NVIDIA/TransformerEngine.git

  cd TransformerEngine
104
105
  export NVTE_FRAMEWORK=pytorch         # Optionally set framework
  pip3 install --no-build-isolation .   # Build and install
Tim Moon's avatar
Tim Moon committed
106
107
108
109
110
111
112
113
114
115
116

If the Git repository has already been cloned, make sure to also clone the submodules:

.. code-block:: bash

  git submodule update --init --recursive

Extra dependencies for testing can be installed by setting the "test" option:

.. code-block:: bash

117
  pip3 install --no-build-isolation .[test]
118

Tim Moon's avatar
Tim Moon committed
119
To build the C++ extensions with debug symbols, e.g. with the `-g` flag:
120
121
122

.. code-block:: bash

123
  NVTE_BUILD_DEBUG=1 pip3 install --no-build-isolation .
124
125
126
127

.. include:: ../README.rst
   :start-after: troubleshooting-begin-marker-do-not-remove
   :end-before: troubleshooting-end-marker-do-not-remove