This repo makes it possible to use cuda-capable PyTorch v1.1.0 on old Fermi
architecture GPU with cuda compute capability (cc) 2.x
.
In the PyTorch v1.1.0 release note cuda 8.0 is announced deprecated, which is misleading because what they really mean is PyTorch will not provide official build binaries for cuda 8.0 devices anymore. But PyTorch v1.1.0 still support to be built from source with cuda>=7.5.
- Have fun.
- Learn more about the source code of
Pytorch
and tools e.g.ninja
,gcc
, etc.
PyTorch is a Python package that provides two high-level features:
- Tensor computation (like NumPy) with strong GPU acceleration
- Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
Linux distro | GCC | Python | CUDA | GPU arch (compute capability) |
---|---|---|---|---|
Ubuntu 20.04 LTS | 5.4.0 | 3.7 | 8.0 | Fermi (2.1) |
If you use .run
file to install NVIDIA driver, make sure dkms
is installed before driver installation. And do remember to register the driver to dkms
during driver installation. Otherwise, the driver will strike every time after Linux kernel update.
If you are installing from source, we highly recommend installing an Anaconda environment. You will get a high-quality BLAS library (MKL) and you get a controlled compiler version regardless of your Linux distro.
Once you have Anaconda installed, here are the instructions.
conda create --name torch110 python=3.7
conda activate torch110
Python is confined to at maximum 3.7
due to the requirements of torchvision 0.3.0
.
As state in the next section, cuda 8.0
which requires gcc<=5
is recommended. At the time of writing, the default apt
installed gcc-5 by Ubuntu 20.04 LTS
is 5.5.0
. But this version of gcc triggers error when compiling AVX512
related libs, as discussed here. Solution could be installing gcc 5.4.0
from source, which is also not a pleasant experience because of compiling errors when using original source code provided by GNU. Instead, a bug fixed version of gcc 5.4.0
is provided with installing instructions AdorableJiang/gcc-5.4.0.
If you want to compile with CUDA support, install
- NVIDIA CUDA 7.5 or above
As announced in release note of cuda 8.0 and cuda 9.0, cuda 8.0
is the latest version usable for Fermi GPUs, although you would find that your driver version meets the requirement of cuda 9.0
.
Fermi architecture support is being deprecated in the CUDA 8.0 Toolkit, which will be the last toolkit release to support it. Note that support for Fermi is being deprecated in the CUDA Toolkit but not in the driver. Applications compiled with CUDA 8.0 or older will continue to work on Fermi with newer NVIDIA drivers.
Use -override
to suppress cuda requirements check if necessary. Make sure verifying cuda installation by compiling and running cuda samples.
cuDNN requires compute capability >= 3.0. Install it if possible.
- NVIDIA cuDNN v6.x or above
Other potentially useful environment variables may be found in setup.py
.
conda install numpy pyyaml mkl mkl-include setuptools cmake cffi ninja
# Add LAPACK support for the GPU if needed
conda install -c pytorch magma-cuda80
git clone --recursive https://github.com/AdorableJiang/Pytorch1.1.0-cc2.x.git --branch v1.1.0 pytorch110
cd pytorch110
On Linux
./build.sh
In build.sh
, make sure CC
, CXX
and CUDAHOSTCXX
points to the right gcc&g++ 5.4.0
compiler. The build.sh
will
- install PyTorch automatically, and
- generate a
.whl
file at/dist
.
To build documentation in various formats, you will need Sphinx and the readthedocs theme.
cd docs/
pip install -r requirements.txt
You can then build the documentation by running make <format>
from the
docs/
folder. Run make
to get a list of all available output formats.
Install torchvision from source for a complete Pytorch experience. Refer to the table, torchvision 0.3.0 should be installed from source. Notice that you may need to install pillow<7.0
manually. pillow>=7.0
is not compatible with torchvision 0.3.0 #1712.
A simple test script is provided in branch testtorch
.
git worktree add -b testtorch ../testtorch
python3 ../testtorch/testtorch.py
Moreover, use Pytorch examples to verify installation.
Error occurs when running Basic MNIST Example.
This project is GPL 3.0 licensed, as found in the LICENSE file.