• ubuntu 20.04, cudn10.0, cudnn v7.6, support pytorch 1.2 gpu and tensorflow 1.15 GPU, config record.


    0, install nvida driver
        sudo add-apt-repository ppa:graphics-drivers/ppa
        then, open "software & updates" from "show application" and choose "additional drivers", and choose a fit driver:
        Using NVIDIA driver metapackage from nvidia-driver-440(proprietary)
        choose apply chaneges,
        then restart.

    1, downgrade gcc g++, for if you do not downgrade, cuda_xxx.run wuold not be executed.
        sudo apt-get install gcc-7 g++-7

        sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
        sudo ln -s /usr/bin/g++-7 /usr/bin/g++

    output:
        kai@kai:~/Downloads$ gcc --version
        gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0
        Copyright (C) 2017 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

        kai@kai:~/Downloads$ g++ --version
        g++ (Ubuntu 7.5.0-6ubuntu2) 7.5.0
        Copyright (C) 2017 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    2, install cuda and cudnn:
        sudo chmod a+x cuda_10.0.130_410.48_linux.run
        sudo sh cuda_10.0.130_410.48_linux.run
        
        sudo gedit ~/.bashrc
        add follow text:
        "
        export CUDA_HOME=/usr/local/cuda
        export PATH=$PATH:$CUDA_HOME/bin
        export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
        "
        source ~/.bashrc
        
        test cuda:
        cd /usr/local/cuda/samples/1_Utilities/deviceQuery
        sudo make
        ./deviceQuery
        
        output:
        deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.2, CUDA Runtime Version = 10.0, NumDevs = 1
        Result = PASS
        
        test cuda version:
        ~/.bashrc
        
        output:
        nvcc: NVIDIA (R) Cuda compiler driver
        Copyright (c) 2005-2018 NVIDIA Corporation
        Built on Sat_Aug_25_21:08:01_CDT_2018
        Cuda compilation tools, release 10.0, V10.0.130
        
        install cudnn:
        tar -xzvf  cudnn-10.0-linux-x64-v7.6.5.32.tgz cuda/
        sudo cp cuda/include/cudnn.h /usr/local/cuda/include
        sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
        sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
        
    3, install anaconda3:
        download
        https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
        bash Anaconda3-2020.07-Linux-x86_64.sh

    4, install pytorch1.2, python3.7:
        conda create -n rltorch python=3.7
        conda activate rltorch
        pytorch with gpu support:
        conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch    #can not install by this command in china.

        get some help in follow site:
        https://pytorch.org/get-started/previous-versions/#via-pip
        https://download.pytorch.org/whl/torch_stable.html
        
        pip install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

    5, test pytorch
        import torch as t
        x = t.rand(5,3)
        y = t.rand(5,3)
        if t.cuda.is_available():
            x = x.cuda()
            y = y.cuda()
            print(x+y)

        output:
        ensor([[1.4095, 1.4061, 1.1705],
            [1.6440, 0.6937, 1.0405],
            [0.7109, 0.5343, 1.1778],
            [0.5223, 0.1559, 1.3047],
            [1.4479, 0.5002, 1.1370]], device='cuda:0')
        
        >>import torch    
        >>print(torch.cuda.get_device_name(0))
        GeForce RTX 2060

    6, install gym, mujoco


        To be continued...
        
        
        
        
       

  • 相关阅读:
    Linux服务器上监控网络带宽命令
    boost编译很慢的解决方法
    python select poll
    python SocketServer
    boost implicit_cast
    函数名 函数名取地址 区别
    STL make_heap push_heap pop_heap sort_heap
    STL: fill,fill_n,generate,generate_n
    gcc __attribute__
    Linux命令 lsof使用
  • 原文地址:https://www.cnblogs.com/siahekai/p/14161025.html
Copyright © 2020-2023  润新知