Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse the compilation of pytorch-gpu source code

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to parse pytorch-gpu source code compilation, the content is very detailed, interested friends can refer to reference, I hope to help you.

Software and hardware environment ubuntu 18.04 64bitNVidia GTX 1070Tianaconda with python 3.7CUDA 10.1cuDNN 7.6python 1.8python and GPU environment

This is not much to say, not installed, you can refer to the link below

anaconda basic use ubuntu installation CUDA and cuDNN compilation steps

Installation Base Dependency

conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses

Since you want to use GPU, you also need to install LAPACK support, and install the corresponding software package according to CUDA version.

# Add LAPACK support for the GPU if needed

conda install -c pytorch magma-cuda101 # or [ magma-cuda101 | magma-cuda100 | magma-cuda92 ] depending on your cuda version

Then you can start cloning code.

git clone --recursive https://github.com/pytorch/pytorch

cd pytorch

# if you are updating an existing checkout

git submodule sync

git submodule update --init --recursive

Once the preparations are complete, you can start compiling.

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../ "}

python setup.py install

CMAKE_PREFIX_PATH is actually the installation directory of anaconda, such as/home/xugaoxiang/anaconda3

pytorch

It takes a long time to compile, just wait patiently.

test

Open a new terminal for testing.

(base) xugaoxiang@1070Ti:~$ ipython

Python 3.7.6 (default, Jan 8 2020, 19:59:22)

Type 'copyright', 'credits' or 'license' for more information

IPython 7.19.0 -- An enhanced Interactive Python. Type '? ' for help.

In [1]: import torch

In [2]: torch.__ version__

Out[2]: '1.8.0a0+46d846f'

In [3]: torch.cuda.is_available()

Out[3]: True

In [4]:

Pytorch has been installed in the anaconda environment, and is the gpu version, done!

The whole compilation process is still very smooth, before we compiled opencv, tensorflow, caffe, compared with them, pytorch in the dependency processing is very good, in the form of sub-projects into their own projects, the whole compilation process did not appear error, the document is also written simple and clear, no wonder its market share will be higher and higher.

About how to parse pytorch-gpu source code compilation to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report