您的位置:首页 > 其它

雷神新911PRO晖金二代win10+ubuntu16.04系统安装教程+Anaconda3搭建深度学习环境tensorflow-gpu

2020-06-23 04:44 766 查看

雷神新911PRO晖金二代win10+ubuntu16.04系统安装教程

雷神新911PRO晖金二代win10+ubuntu16.04系统安装教程

  • 2、识别不到无线网卡
  • 3、RTX2070S显卡驱动安装
  • 3、深度学习环境安装
  • 1、ubuntu16.04安装

    1.1、ubuntu16.04下载

    建议大家直接到ubuntu官网下载ubuntu的安装包
    链接: https://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-amd64.iso.

    1.2、安装U盘制作

    UltraISO下载并制作安装,官网下载或者直接在网上下载UltraISO,打开后点击使用就行。为避免后面无法使别到U盘,制作过程中需将写入方式应选择USB-ZIP,详细步骤请参考博客: https://blog.csdn.net/fu6543210/article/details/79722615

    1.3、ubuntu16.04安装

    出现开机画面时按F2进入bios界面,将Secure Boot设置为Disabled,F10保存并退出。重启计算机,出现开机画面按住F12,选择U盘启动。接下来根据提示安装ubuntu16.04,详情请参考链接: https://blog.csdn.net/lingyunxianhe/article/details/81415675。分区大小根据需求和硬件自行修改。

    2、识别不到无线网卡

    雷神新911PRO晖金二代显卡是intel WIFI6 AX201,安装ubuntu16.04后会出现无线网卡无法识别的现象,左上角没有无线图标或者没有连接wifie的选项。先通过有线安装无线网卡,无线网卡为ubuntu官方给出的linux-firmware_1.187_all.deb,详情请参考博客链接:
    https://blog.csdn.net/dieju8330/article/details/101422743.

    3、RTX2070S显卡驱动安装

    3.1、驱动下载

    从NVIDIA官网下载驱动(我安装的NVIDIA-Linux-x86_64-440.82.run),链接: https://www.geforce.cn/drivers.选择合适的版本下载,放在英文目录下,后续操作可能无法识别中文目录。

    3.2、驱动安装

    如果之前有安装驱动,需要先卸载旧版本驱动,没有就不用:
    $sudo apt-get remove nvidia-*
    $sudo apt-get autoremove (加上才能卸载干净原驱动)

    禁用Nouveau,还有一种方法是在/etc/modprobe.d/blacklist.conf的最后一行加上
    blacklist nouveau
    options nouveau modeset=0
    然后使其生效:
    $sudo update-initramfs -u
    使用这个命令看是否有输出,如果没有证明禁用成功
    $lsmod | grep nouveau

    开始安装
    输入CTRL+ALT+F1进入文本模式
    关闭显示服务:
    $sudo service lightdm stop
    $cd 文件目录
    权限:
    $chmod a+x NVIDIA-Linux-x86_64-418.43.run
    这里注意用自己的安装包名称
    $sudo ./NVIDIA-Linux-x86_64-418.43.run -no-opengl-files

    安装过程中:

    在NVIDIA驱动安装过程中,依次的选项为:

    选:accept(注:白色为选中,不是红色)

    The distribution-provided pre-install script failed … …

    选:Continue installation

    Would you like to run the nvidia-xconfig utility to automatically update your X Configuration file so set the NVIDIA X driver will be used when you restart X?

    选:NO

    Install 32-Bit compatibility libraries?

    选:NO

    启动显示服务

    $sudo service lightdm restart(将自动跳转到桌面)

    查看Nvidia驱动是否安装成功

    $nvidia-smi

    显示信息的话表示安装成功

    3、深度学习环境安装

    3.1 安装Anaconda3

    官网下载链接:
    https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh。
    下载后在Anaconda3-2020.02-Linux-x86_64.sh文件目录下开始安装

    // An highlighted block
    bash Anaconda3-2020.02-Linux-x86_64.sh

    详情可参考链接:
    https://blog.csdn.net/u012318074/article/details/77074665.

    3.2 安装tensorflow-gpu

    直接跳过cuda和cudnn的安装,通过conda install tensorflow-gpu一步到位。如果只是使用官方源的话可能会很慢,导致超时,因此需要添加其他的源,如清华提供的源:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/。更多的源可以参考https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

    // An highlighted block
    conda install tensorflow-gpu;

    3.3 深度学习环境测试

    测试程序为

    import tensorflow as tf
    import timeit
    with tf.device('/cpu:0'):
    cpu_a = tf.random.normal([10000, 1000])
    cpu_b = tf.random.normal([1000, 2000])
    print(cpu_a.device, cpu_b.device)
    with tf.device('/gpu:0'):
    gpu_a = tf.random.normal([10000, 1000])
    gpu_b = tf.random.normal([1000, 2000])
    print(gpu_a.device, gpu_b.device)
    def cpu_run():
    with tf.device('/cpu:0'):
    c = tf.matmul(cpu_a, cpu_b)
    return c
    def gpu_run():
    with tf.device('/gpu:0'):
    c = tf.matmul(gpu_a, gpu_b)
    return c
    # warm up
    cpu_time = timeit.timeit(cpu_run, number=10)
    gpu_time = timeit.timeit(gpu_run, number=10)
    print('warmup:', cpu_time, gpu_time)
    cpu_time = timeit.timeit(cpu_run, number=10)
    gpu_time = timeit.timeit(gpu_run, number=10)
    print('run time:', cpu_time, gpu_time)

    通过watch -n 1 nvidia-smi 命令实时查看GPU运行情况,运行上面程序,GPU使用情况发生变化则深度学习环境搭建成功。

    上述为个人在雷神新911PRO晖金二代win10+ubuntu16.04搭建深度学习环境所踩的坑,通过博客记录下来供以后参考和广大博友避坑。第一次写博客,若有错误望批评指正,博客内容若有侵权请联系删除

    内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
    标签: 
    相关文章推荐