安装 NVIDIA 驱动与配置 CUDA 开发环境

Nvidia 驱动

1
2
3
4
5
sudo add-apt-repository ppa:graphics-drivers/ppa    
sudo apt-get update
sudo apt-get install nvidia-390 #此处要适当更改
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev

测试驱动是否安装成功:nvidia-smi ,若输出显卡信息则成功。

CUDA

官方文档:NVIDIA CUDA Installation Guide for Linux

VS Code 配置,安装 vscode-cudacpp 插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
//CUDA
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "support.function.cuda-cpp",
"settings":{
"foreground": "#56b6c2"
}
},
{
"scope": "keyword.function.qualifier.cuda-cpp",
"settings":{
"foreground": "#56b6c2"
}
}
]
}
}