Ubuntu 操作系统
<p><span style="font-size:16px"><strong>Debian方式安装</strong></span></p>
<p><span style="font-size:16px"><strong>操作步骤</strong></span></p>
<p>1. 安装存储库元数据,安装GPG密钥,更新apt-get缓存并安装CUDA:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> $ sudo dpkg --install cuda-repo-<distro>-<version>.<architecture>.deb</p>
<p> $ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/<distro>/<architecture>/7fa2af80.pub</p>
<p> $ sudo apt-get update</p>
<p> $ sudo apt-get install cuda</p>
</td>
</tr>
</tbody>
</table>
<p>2. 重启系统加载NVIDIA驱动。</p>
<p>3. 修改PATH和LD_LIBRARY_PATH变量来设置开发环境:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> $ export PATH = / usr / local / cuda- 9.2 / bin $ {PATH:+:$ {PATH}}</p>
<p> $ export LD_LIBRARY_PATH = / usr / local / cuda- 9.2 / lib64 \</p>
<p> $ {LD_LIBRARY_PATH:+:$ {LD_LIBRARY_PATH} }</p>
</td>
</tr>
</tbody>
</table>
<p>4. 构建并运行: </p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> $ cuda-install-samples- 9.2 .sh~</p>
<p> $ cd~ / NVIDIA_CUDA- 9.2 _Samples / 5_Simulations / nbody</p>
<p> $ make</p>
<p> $ ./nbody</p>
</td>
</tr>
</tbody>
</table>
<p> </p>
<p><span style="font-size:16px"><strong>Runfile方式安装</strong></span></p>
<p><span style="font-size:16px"><strong>操作步骤</strong></span></p>
<p>1. 禁用Nouveau驱动程序:</p>
<p>(1)创建一个文件 /etc/modprobe.d/blacklist-nouveau.conf,具有以下内容:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> blacklist nouveau</p>
<p> options nouveau modeset = 0</p>
</td>
</tr>
</tbody>
</table>
<p>(2)重新生成内核initramfs:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px"> $ sudo update-initramfs -u</td>
</tr>
</tbody>
</table>
<p>2. 在系统内核引导参数的末尾添加<strong>3</strong>和<strong>nomodeset</strong>,重启系统。</p>
<p>3. 以静默方式运行安装程序:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px"> $ sudo sh cuda_ <version> _linux.run --silent</td>
</tr>
</tbody>
</table>
<p>4. 创建一个xorg.conf 文件:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px"> $ sudo nvidia-xconfig</td>
</tr>
</tbody>
</table>
<p>5. 重启系统加载图形界面。</p>
<p>6. 通过修改PATH和LD_LIBRARY_PATH变量来设置开发环境:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> $ export PATH = / usr / local / cuda- 9.2 / bin $ {PATH:+:$ {PATH}}</p>
<p> $ export LD_LIBRARY_PATH = / usr / local / cuda- 9.2 / lib64 \</p>
<p> $ {LD_LIBRARY_PATH:+:$ {LD_LIBRARY_PATH} }</p>
</td>
</tr>
</tbody>
</table>
<p>7. 构建并运行:</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:702px">
<tbody>
<tr>
<td style="background-color:#ededed; width:696px">
<p> $ cuda-install-samples- 9.2 .sh~</p>
<p> $ cd~ / NVIDIA_CUDA- 9.2 _Samples / 5_Simulations / nbody</p>
<p> $ make</p>
<p> $ ./nbody</p>
</td>
</tr>
</tbody>
</table>
<p> </p>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!