Giter Site home page Giter Site logo

trellixvulnteam / pytorch1.1.0-cc2.x_rz1r Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sjiang95/pytorch1.1.0-cc2.x

0.0 0.0 0.0 110.72 MB

Build Pytorch 1.1.0 for old GPUs with cuda compute capability 2.x

License: GNU General Public License v3.0

Shell 0.50% C++ 49.65% Python 32.79% C 4.41% Objective-C 0.01% Lua 0.01% PowerShell 0.01% CSS 0.01% Objective-C++ 0.80% Cuda 9.67% Makefile 0.01% HTML 0.02% CMake 1.89% Batchfile 0.04% Metal 0.14% Dockerfile 0.07% Vim Script 0.01%

pytorch1.1.0-cc2.x_rz1r's Introduction

Pytorch v1.1.0

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.

Motivation

  1. Have fun.
  2. Learn more about the source code of Pytorch and tools e.g. ninja, gcc, etc.

PyTorch Logo


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.

Installation

Tested build configurations

Linux distro GCC Python CUDA GPU arch (compute capability)
Ubuntu 20.04 LTS 5.4.0 3.7 8.0 Fermi (2.1)

Driver

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.

Anaconda

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.

GCC

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.

CUDA

If you want to compile with CUDA support, install

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

cuDNN requires compute capability >= 3.0. Install it if possible.

Other potentially useful environment variables may be found in setup.py.

Install Dependencies

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

Get the PyTorch Source

git clone --recursive https://github.com/AdorableJiang/Pytorch1.1.0-cc2.x.git --branch v1.1.0 pytorch110
cd pytorch110

Install PyTorch

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

  1. install PyTorch automatically, and
  2. generate a .whl file at /dist.

Building the Documentation

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.

Torchvision

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.

Verifying

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.

Known issue

Error occurs when running Basic MNIST Example.

License

This project is GPL 3.0 licensed, as found in the LICENSE file.

pytorch1.1.0-cc2.x_rz1r's People

Contributors

andresy avatar apaszke avatar bddppq avatar bwasti avatar colesbury avatar cpuhrsch avatar ezyang avatar gchanan avatar goldsborough avatar houseroad avatar jerryzh168 avatar jspark1105 avatar killeent avatar li-roy avatar lukeyeager avatar onnxbot avatar orionr avatar peterjc123 avatar pietern avatar pjh5 avatar smessmer avatar soumith avatar ssnl avatar suo avatar t-vi avatar vishwakftw avatar xiaomengy avatar yangqing avatar zdevito avatar zou3519 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.