R-GPU计算记录-Nvidia-driver, CUDA, gputools配置篇

系统环境

  • Ubuntu 20(非虚拟机)
  • Nvidia
  • Ubuntu 可视化界面API lightdm

1. Nvidia 显卡安装

方法很多,直接上出错率最低的方法

1.1 查看系统显卡配置

系统推荐nvidia-driver-495

#Ubuntu 20 查看显卡
ubuntu-drivers devices

driver   : nvidia-driver-465 - third-party non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-495 - third-party non-free recommended
driver   : nvidia-driver-455 - third-party non-free
driver   : nvidia-driver-470 - third-party non-free
driver   : nvidia-driver-450 - third-party non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-460-server - distro non-free
driver   : nvidia-driver-460 - third-party non-free
driver   : xserver-xorg-video-nouveau - distro free builtin
1.2 去Nvidia官网下载对应Nvidia-driver

Nvidia-driver-linux64传送门

su root
cd /usr/local
wget https://download.nvidia.com/XFree86/Linux-x86_64/495.46/NVIDIA-Linux-x86_64-495.46.run
1.3 关闭可视化界面 lightdm更新显卡驱动

关闭前请提前查好自己的系统登陆名

sudo service lightdm stop

关闭可视化界面后 Ctral+Alt+F2进入 termial 界面,一路跟着指引完成安装。完成后,reboot重启。

su root
cd /usr/local
sudo sh NVIDIA-Linux-x86_64-495.46.run
reboot

2. CUDA环境配置

CUDA 下载链接
找到对应版本CUDA下载链接并下载,安装时勾选去掉显卡驱动

su root
cd /usr/local
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
sudo sh cuda_11.0.2_450.51.05_linux.run

export PATH=/usr/local/cuda-11.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.5/lib64\
                         ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

sudo vi ~/.bashrc
#最后添加
export PATH=/usr/local/cuda-11.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.5/lib64\
                         ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}

3. 安装gpuR 和gputools

gpuR在完成配置CUDA 后可直接从github安装,本文着重讲gputools的安装

3.1 下载gputools的tar.gz 安装包

由于gputools已无法通过install.packages安装,需要通过调整源码进行安装。

su root
cd /usr/local
wget http://cran.r-project.org/src/contrib/gputools_0.28.tar.gz
tar -zxvf gputools_0.28.tar.gz
3.2 修改gputools中的Makefile

更新Makefile 中的代码如下

vi gputools/src/Makefile
NVCC := $(CUDA_HOME)/bin/nvcc -gencode arch=compute_60,code=sm_60
3.3 修改gputools中的config.mk

更新config.mk 中的代码如下

vi gputools/src/config.mk 
R_INC := /usr/share/R/include
3.4 压缩gputools包为tar.gz

完成压缩后,直接通过包在R中安装

tar -zcvf gputools.tar.gz gputools

参考博客
CUDA 安装
gputools安装

你可能感兴趣的:(R-GPU计算记录-Nvidia-driver, CUDA, gputools配置篇)