1. 程式人生 > >ubuntu 同時安裝cuda8.0與cuda9.0,cuda9.1

ubuntu 同時安裝cuda8.0與cuda9.0,cuda9.1

部分程式碼需要cuda8.0,部分需要cuda9.0 於是萌生了同時安裝2個版本的想法。

0 前提:

ubuntu 16.04. x86_64

已經安裝 cuda 8.0:

nvcc –version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

1 下載 cuda 9.0:


2.  在自己的目錄下為cuda9.0新建一個資料夾,用於存放  cuda_9.0.176_384.81_linux.run

與後面的sample。

3.  生成可執行檔案

 chmod 777 cuda_9.0.176_384.81_linux.run

4. 執行:

./cuda_9.0.176_384.81_linux.run

5. 一些安裝過程:

(因為我需要保留cuda8.0 於是暫時不做軟連線 )

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: n 

Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: y

Do you wish to run the installation with 'sudo'?
(y)es/(n)o: y

Please enter your password: 
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]: 

Do you want to run nvidia-xconfig?
This will update the system X configuration file so that the NVIDIA X driver
is used. The pre-existing X configuration file will be backed up.
This option should not be used on systems that require a custom
X configuration, such as systems with multiple GPU vendors.
(y)es/(n)o/(q)uit [ default is no ]:  

Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
 [ default is /usr/local/cuda-9.0 ]: 

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: n 

Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /home/linlf ]: /home/linlf/tools/cuda9.0

5報錯:

Itappears that an X server is running. Please exit X beforeinstallation. If you're sure that X is not running, but are gettingthis error, please delete any X lock files in /tmp.


6 參考

6.1 檢視 Xpsaux | grep X

6.2 關閉X. light型別的桌面系統

      Sudo /etc/init.d/lightdm stop


6.4 接著按照第一步第方法繼續安裝cuda9.0

7  修改配置檔案:

export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
export LIBRARY_PATH="/usr/local/cuda/lib64:$LIBRARY_PATH"

8。 配置檔案生效:

source ~/.bashrc

9。然後就可以切換8.09.0了:

rm –rf /usr/local/cuda

ln -s /usr/local/cuda-9.0 /usr/local/cuda

10。若別的使用者需要使用到。同樣如上切換。

11。 最後進入 cuda9.0samplemake所有第例子.

(後續:)

12 若需要再安裝cuda9.1: 會報錯:

 15 Using built-in stream user interface
 16 -> Detected 56 CPUs online; setting concurrency level to 32.
 17 -> License accepted by command line option.
 18 -> Installing NVIDIA driver version 387.26.
 19 -> The NVIDIA driver appears to have been installed previously using a different installer. To prevent potential conflicts, it is recommended either to update the
     existing installation using the same mechanism by which it was originally installed, or to uninstall the existing installation before installing this driver. 20 
 21 Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:
 22 
 23 The package that is already installed is named nvidia-384.
 24 
 25 You can upgrade the driver by running:
 26 `apt-get install nvidia-384 nvidia-modprobe nvidia-settings`
 27 
 28 You can remove nvidia-384, and all related packages, by running:
 29 `apt-get remove --purge nvidia-384 nvidia-modprobe nvidia-settings`
 30 
 31 This package is maintained by NVIDIA ([email protected]).
 32 
 33 
 34 (Answer: Abort installation)
 35 ERROR: The installation was canceled due to the availability or presence of an alternate driver installation. Please see /var/log/nvidia-installer.log for more de
    tails.

意思是CUDA    驅動版本衝突:

CUDA8.0依賴的是384版本驅動,而CUDA9.1依賴的是387版本驅動,因此需要更新/解除安裝384驅動。

解除安裝:

sudo apt-get remove --purge nvidia-384 nvidia-modprobe nvidia-settings

解除安裝細節:

[email protected]:~/tools/cuda9.1$ sudo apt-get remove --purge nvidia-384 nvidia-modprobe n
vidia-settingsReading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-xapian-index aptitude-common cuda-command-line-tools-8-0 cuda-core-8-0
  cuda-cublas-8-0 cuda-cublas-dev-8-0 cuda-cudart-8-0 cuda-cudart-dev-8-0
  cuda-cufft-8-0 cuda-cufft-dev-8-0 cuda-curand-8-0 cuda-curand-dev-8-0
  cuda-cusolver-8-0 cuda-cusolver-dev-8-0 cuda-cusparse-8-0 cuda-cusparse-dev-8-0
  cuda-documentation-8-0 cuda-driver-dev-8-0 cuda-license-8-0 cuda-misc-headers-8-0
  cuda-npp-8-0 cuda-npp-dev-8-0 cuda-nvgraph-8-0 cuda-nvgraph-dev-8-0 cuda-nvml-dev-8-0
  cuda-nvrtc-8-0 cuda-nvrtc-dev-8-0 cuda-samples-8-0 cuda-toolkit-8-0
  cuda-visual-tools-8-0 dh-apparmor fonts-dejavu g++-4.8 g++-4.8-multilib
  gir1.2-gconf-2.0 gir1.2-gnomebluetooth-1.0 gstreamer1.0-clutter iproute
  lib32stdc++-4.8-dev libatk-wrapper-java libatk-wrapper-java-jni libavcodec54
  libavformat54 libavutil52 libboost-atomic1.54.0 libboost-chrono1.54.0
  libboost-context1.54.0 libboost-date-time1.54.0 libboost-filesystem1.54.0
  libboost-graph1.54.0 libboost-iostreams1.54.0 libboost-locale1.54.0
  libboost-log1.54.0 libboost-math1.54.0 libboost-program-options1.54.0
  libboost-python1.54.0 libboost-random1.54.0 libboost-regex1.54.0
  libboost-serialization1.54.0 libboost-signals1.54.0 libboost-system1.54.0
  libboost-test1.54.0 libboost-thread1.54.0 libboost-timer1.54.0 libboost-wave1.54.0
  libc-ares2 libcamel-1.2-45 libclutter-gst-2.0-0 libcolord1 libcolorhug1 libcr0
  libcwidget3 libdbi1 libebackend-1.2-7 libebook-1.2-14 libebook-contacts-1.2-0
  libedata-book-1.2-20 libedataserver-1.2-18 libegl1-mesa-drivers libelfg0 libept1.4.12
  libgcrypt11-dev libgdata13 libgee2 libgif4 libgnome-bluetooth11 libgnome-desktop-3-7
  libgnutlsxx27 libgphoto2-port10 libgtop2-7 libicu52 libilmbase6 libimobiledevice4
  libisl10 libjavascriptcoregtk-3.0-0 libllvm3.4 libmbim-glib0 libmysqlclient-dev
  libmysqlclient18 libopenexr6 libopenjpeg2 libopenvg1-mesa libpango1.0-0 libpci-dev
  libplist1 libpoppler44 libqmi-glib0 libqpdf13 libqt5positioning5 libqt5sensors5
  libqt5test5 librrd4 libservlet3.0-java libsigc++-2.0-0c2a libsqlite3-dev libswscale2
  libsystemd-journal0 libtorque2 libupower-glib1 libusbmuxd2 libv8-3.14.5 libvpx1
  libvte-2.90-9 libvte-2.90-common libwebkitgtk-3.0-0 libwebkitgtk-3.0-common
  libx264-142 libx32stdc++-4.8-dev libxcb-util0 libxen-4.4 libzeitgeist-1.0-1
  linux-image-3.13.0-145-generic linux-image-extra-3.13.0-145-generic
  linux-image-generic-lts-xenial linux-lts-xenial-cloud-tools-4.4.0-31
  linux-lts-xenial-tools-4.4.0-31 nvidia-prime obex-data-server php5-cli php5-common
  php5-json php5-readline python-colorama python-cups python-dbus-dev python-distlib
  python-gnomekeyring python-gobject python-html5lib python-notify python-pycurl
  python-smbc python-urlgrabber python-xapian python3-colorama python3-distlib
  python3-imaging ttf-dejavu ttf-dejavu-core ttf-dejavu-extra watershed
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  cuda* cuda-8-0* cuda-demo-suite-8-0* cuda-drivers* cuda-runtime-8-0* libcuda1-384*
  libcupti5.5* nvidia-384* nvidia-384-dev* nvidia-modprobe* nvidia-opencl-icd-384*
  nvidia-settings*
0 upgraded, 0 newly installed, 12 to remove and 56 not upgraded.
After this operation, 375 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 219065 files and directories currently installed.)
Removing cuda (8.0.61-1) ...
Removing cuda-8-0 (8.0.61-1) ...
Removing cuda-demo-suite-8-0 (8.0.61-1) ...
Removing cuda-runtime-8-0 (8.0.61-1) ...
Removing cuda-drivers (384.111-1) ...
Removing libcupti5.5:amd64 (5.5.22-3ubuntu1) ...
Purging configuration files for libcupti5.5:amd64 (5.5.22-3ubuntu1) ...
Removing libcuda1-384 (384.111-0ubuntu1) ...
Purging configuration files for libcuda1-384 (384.111-0ubuntu1) ...
Removing nvidia-opencl-icd-384 (384.111-0ubuntu1) ...
Purging configuration files for nvidia-opencl-icd-384 (384.111-0ubuntu1) ...
Removing nvidia-384-dev (384.111-0ubuntu1) ...
Removing nvidia-384 (384.111-0ubuntu1) ...
Removing all DKMS Modules
Done.
update-alternatives: using /usr/lib/nvidia-384-prime/ld.so.conf to provide /etc/ld.so.con
f.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto modeupdate-alternatives: using /usr/lib/nvidia-384-prime/ld.so.conf to provide /etc/ld.so.con
f.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto modeupdate-alternatives: using /usr/lib/nvidia-384-prime/alt_ld.so.conf to provide /etc/ld.so
.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto modeupdate-alternatives: using /usr/lib/nvidia-384-prime/alt_ld.so.conf to provide /etc/ld.so
.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto modeupdate-alternatives: using /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf to provide /etc/ld.s
o.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto modeupdate-alternatives: using /usr/lib/x86_64-linux-gnu/mesa-egl/ld.so.conf to provide /etc/
ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto modeupdate-initramfs: deferring update (trigger activated)
Purging configuration files for nvidia-384 (384.111-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)
Removing nvidia-modprobe (384.111-0ubuntu1) ...
Removing nvidia-settings (384.111-0ubuntu1) ...
Purging configuration files for nvidia-settings (384.111-0ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for initramfs-tools (0.122ubuntu8.11) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-124-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...

13. 繼續安裝cuda

安裝細節:

Installing the NVIDIA display driver...
Installing the CUDA Toolkit in /usr/local/cuda-9.1 ...
Installing the CUDA Samples in /home/linlf/tools/cuda9.1 ...
Copying samples to /home/linlf/tools/cuda9.1/NVIDIA_CUDA-9.1_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Installed
Toolkit:  Installed in /usr/local/cuda-9.1
Samples:  Installed in /home/linlf/tools/cuda9.1

Please make sure that
 -   PATH includes /usr/local/cuda-9.1/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-9.1/lib64, or, add /usr/local/cuda-9.1/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.1/bin
To uninstall the NVIDIA Driver, run nvidia-uninstall

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.1/doc/pdf for detailed information on setting up CUDA.

Logfile is /tmp/cuda_install_31995.log

14 最後,如果想更改cuda版本成9.1:

rm –rf /usr/local/cuda

ln -s /usr/local/cuda-9.1 /usr/local/cuda

參考: https://blog.csdn.net/u010821666/article/details/79957071

相關推薦

ubuntu 同時安裝cuda8.0cuda9.0,cuda9.1

部分程式碼需要cuda8.0,部分需要cuda9.0 於是萌生了同時安裝2個版本的想法。0 前提:ubuntu 16.04. x86_64已經安裝 cuda 8.0:nvcc –version nvcc: NVIDIA (R) Cuda compiler driver Cop

Ubuntu16.04下同時安裝CUDA8.0和CUDA7.0

首先可以說明一點的是,在ubuntu16.04環境下CUDA8.0和CUDA7.0可以共存。筆者自己先安裝的是CUDA8.0,然後再安裝的CUDA7.0,安裝完CUDA8.0發現安裝CUDA7.0一直不成功,後面發現是16.04系統預設版本的GCC、g++版本過

Ubuntu安裝CUDA8.0及nvidia驅動(詳細教程)

1. 選擇對的系統安裝nvidia驅動為什麼說對的系統呢,這是因為在多次嘗試後發現,如果使用ubuntu14安裝顯示卡驅動會出現無法進入系統,一直在迴圈在登入介面,而ubuntu16則不會出現這個問題,所以說最好升級一下吧,畢竟14有點太老了。重要的一點是不要在安裝或安裝後升

ubuntu安裝pyenv+anaconda3-5.3.0+cuda

1.pyenv 按照GitHub上的教程: 安裝之前要限安裝curl 和git-core: sudo apt-get install curl git-core 接著開始正式安裝: $ curl -L https://raw.githubusercontent.com/yy

Debian安裝JDK1.7Tomcat7.0

一、安裝jdk 下載官方jdk: 當前版本是7u25 wget -c http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-i586.tar.gz (使用這個命令下載的檔案不正確,會是一個網頁。所以我是把jdk-7u25

ubuntu解除安裝wine穩定版3.0.2

裝了wine發現執行TIM全都亂碼,於是手動解除安裝wine: ~/.wine ~/.local/share/applications /usr/lib/wine 然後查了以下有關wine的軟體包: dpkg -l | grep wine* 發現了4個相關結果

同時安裝cuda8cuda9

dep ecc 這就是 mount guide select edi domain ext 轉載自:https://blog.csdn.net/lovebyz/article/details/80704800 為了使用tensorflow目標檢測API的所有算法,所以打算

vue1.0 Vue2.0的一些區別 及用法

alert 支持 troy body 模板 標記 title ava pla 1.Vue2.0的模板標記外必須使用元素包起來; eg:Vue1.0的寫法 <!DOCTYPE html> <html> <head> <meta

UiAutomator1.0 UiAutomator2.0

developer clas 之前 logcat -s obj 自動 evel 進行   在使用2.0之前,對android自動化框架也做過一些了解《Android 自動化測試框架》。使用UiAutomator2.0也有一段時間,這裏將1.0與2.0進行一個對比總結。

微服務1.02.0

微服務1.0時代 Dubbo本質上只能算是一個服務治理框架,而不能算是一個微服務框架。雖然在未來的Dubbo 3.0中會提供對Spring Cloud,以及對Service Mesh的支援,但是單憑Dubbo仍然是無法搭建一個完整的微服務體系結構。Spring Cloud則是通過整合眾多的元件的形式實現了相

Ubuntu同時安裝OpenCV2和OpenCV3

Ubuntu下檢視linux版本 pkg-config --modversion opencv sudo apt-get install build-essential libgtk2.0-dev

Jedis 2.9.1、2.10.0 3.0.0 釋出,Redis 的 Java 客戶端

   Jedis 2.9.1、2.10.0 與 3.0.0 釋出了,Jedis 是 Redis 的 Java 客戶端,它易於使用,與 Redis 2.8.x 和 3.x.x 完全相容。 2.9.1 與 2.10.0 更新: JedisCluster 掃描 bug 修復&nb

position:fixed的top:0bottom:0配合的妙用(固定導航欄)

幾乎每個專案都會有導航欄,橫向的導航欄定位在頂部很常見也很好實現,但是側邊的導航欄也不少,實現起來相對沒那麼容易,主要是側邊導航欄的高度問題,我最開始製作側邊導航欄是,當導航欄內容不夠整屏高度時,導航欄高度就會缺失。 我第一想法是js動態賦值高度及min-height的

關於IBM MQ6.0MQ8.0的通訊問題

在網路,業務,業務量都沒有增長的情況下,MQ8的批量傳送通道突然就掛掉了,變成retrying狀態了,訊息全都堵在傳輸佇列裡了,死信佇列無訊息。實時通道正常,排除網路原因導致的通道問題。採取的措施有簡單的重置通道,通道狀態沒變化,然後進行 STOP CHANN

判斷語句內 i=0 i==0 的區別

int MainPageDemo() {     int ch;     scanf("%d",&ch);     return ch; } int main() {     int *p;   &

從讀取視訊程式比較opencv1.02.0以上版本

opencv入門的那本經典教材《學習opencv》上關於讀取視訊程式碼是基於1.0版本寫的,筆者在2.4.9版本上改寫了一下。 //《學習opencv》基於1.0版本讀取視訊原始碼 #include"highgui.h" int main(int argc, char**argv) { cv

Intel FFT library 6.010.0的區別

10.0的話,語法有相當大的改變,此外相對於6.0在做IFFT的時候還要提前設定scale因子,一般為1/n. 1.   在6.0中,申請3*n大小的變數wsave,然後進行傅立葉變換即可:       CFFT1DC(rr, ri, n, 0, wsave);     

C語言中的 (void*)0 (void)0

前幾天看到一個巨集, 它大概是這樣的:    #define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__))  程式碼的含意簡單, 關鍵是那個 (void)0 的用法, 我還是第一次見到(別笑).

ubuntu安裝R語言Rstutio

新增新的源 sudo gedit /etc/apt/sources.list 儲存(trusty為Ubuntu的版本號)ubuntu14 deb http://cran.stat.ucla.edu/bin/linux/ubuntu/ trusty/ 2.2在命令列執行: s

AFN3.02.0分別做了哪些處理

AFN2.0: 1.對NSURLSession的封裝,2.對AFURLConnection的封裝,3.對HTTPS網路安全請求做了一個包裝,4.做了一個網路連線管理的一個包裝, AFN3.0: 1&g