Changes between Version 1 and Version 2 of Reading/XenG/cuda


Ignore:
Timestamp:
Apr 16, 2009, 2:19:08 PM (15 years ago)
Author:
rider
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Reading/XenG/cuda

    v1 v2  
    1818
    1919== 步驟一: 連線到遠端主機 ==
    20 # 以下兩種連線方式擇一使用. [[BR]]
     20'''# 以下兩種連線方式擇一使用.''' [[BR]]
    2121rider@cloud:~$ ssh 140.xxx.xxx.xxx [[BR]]
    2222rider@cloud:~$ vncviewer 140.xxx.xxx.xxx [[BR]]
    2323
    2424== 步驟二: 產生一台虛擬機器來使用 CUDA ==
    25 
    26 # 設定你想要怎樣規格的虛擬機器
     25'''# 設定你想要怎樣規格的虛擬機器.'''
    2726rider@cloud:~$ sudo vim /etc/xen-tools/xen-tools.conf [[BR]]
    2827{{{
     
    4847rider@cloud:~$ sudo xen-create-image --hostname nvidia --ip 140.XXX.XXX.XXX [[BR]]
    4948
    50 == 步驟三: 設定你的虛擬機器 ==
     49== 步驟三: 查看你的顯卡資訊 ==
     50rider@cloud:~$ lspci -vv
     51{{{
     5201:00.0 VGA compatible controller: nVidia Corporation GeForce 9800 GT (rev a2)
     53        Subsystem: ASUSTeK Computer Inc. Device 82a0
     54        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
     55        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
     56        Latency: 0
     57        Interrupt: pin A routed to IRQ 16
     58        Region 0: Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
     59        Region 1: Memory at d0000000 (64-bit, prefetchable) [size=256M]
     60        Region 3: Memory at fa000000 (64-bit, non-prefetchable) [size=32M]
     61        Region 5: I/O ports at dc80 [size=128]
     62        [virtual] Expansion ROM at fea00000 [disabled] [size=128K]
     63        Capabilities: <access denied>
     64        Kernel driver in use: pciback
     65        Kernel modules: nvidia, nvidiafb
     66}}}
     67
     68== 步驟四: PCI Frontend Configuration 設定你的 DomU ==
    5169rider@cloud:~$ sudo vim /etc/xen/nvidia.cfg [[BR]]
    5270{{{
     
    5674memory      = '1024'
    5775vcpus       = '4'
     76
     77# 配置你的 PCIE 顯示卡
    5878pci         = ['01:00.0']
    5979
     
    7898}}}
    7999
     100== 步驟五: PCI Backend Configuration 設定你的 Dom0 ==
     101rider@cloud:~$ sudo su - [[BR]]
     102'''# Hide the device from dom0 so pciback can take control.''' [[BR]]
     103root@cloud:~$ echo -n "0000:01:00.0" > /sys/bus/pci/drivers/nvidia/unbind [[BR]]
    80104
    81 == 步驟四:  ==
     105'''# Give the dev_ids to pciback, and give it a new slot then bind.''' [[BR]]
     106root@cloud:~$ echo -n "0000:01:00.0" > /sys/bus/pci/drivers/pciback/new_slot [[BR]]
     107root@cloud:~$ echo -n "0000:01:00.0" > /sys/bus/pci/drivers/pciback/bind [[BR]]
    82108
    83 == 步驟五:  ==
     109root@cloud:~$ cat /sys/bus/pci/drivers/pciback/slots [[BR]]
     110{{{
     1110000:01:00.0
     112}}}
    84113
    85 == 步驟六:  ==
     114'''# Caution: Make sure that the device is not controlled by any driver: there should be no driver symlink for nvidia.''' [[BR]]
     115{{{
     116PATH: /sys/bus/pci/devices/0000:01:00.0/
     117driver -> ../../../../bus/pci/drivers/nvidia ---> This symlink shouldn't exist.
     118}}}
     119
     120== 步驟六: 硬體直接存取設定 ==
     121
     122=== Permissive Flag ===
     123
     124rider@cloud:~$ sudo vim /etc/xen/xend-pci-permissive.sxp [[BR]]
     125{{{
     126(unconstrained_dev_ids
     127     #('0123:4567:89AB:CDEF')
     128     ('0000:01:00.0')
     129)
     130}}}
     131
     132=== User-space Quirks ===
     133
     134rider@cloud:~$ sudo vim /etc/xen/xend-pci-quirks.sxp [[BR]]
     135{{{
     136(pci_ids
     137   # Entries are formated as follows: 
     138   #     <vendor>:<device>[:<subvendor>:<subdevice>]
     139
     140   ('10de:0605'   # NVIDIA 9800GT
     141   )
     142)
     143}}}
     144
     145== 步驟七: 啟動並登入你的虛擬機器 DomU ==
     146'''說明: 用 root 免密碼先登入,然後建立自己的帳號. 改用自己的帳號登入(亦可用 root 登入 , 不新建帳號 ):''' [[BR]]
     147@ Dom0 [[BR]]
     148rider@cloud:~$ sudo xm create -c nvidia.cfg [[BR]]
     149
     150@ DomU [[BR]]
     151root@nvidia:~# adduser username [[BR]]
     152root@nvidia:~# vim /etc/sudoers [[BR]]
     153{{{
     154username    ALL=(ALL) ALL
     155}}}
     156
     157== 步驟八: 設定你的 DomU ==
     158'''# 設定 locales (系統語系)''' [[BR]]
     159rider@nvidia:~$ sudo vim /etc/profile [[BR]]
     160{{{
     161# Locale
     162export LANGUAGE="en_US.UTF-8"
     163export LC_ALL="en_US.UTF-8"
     164export LANG="en_US.UTF-8"
     165}}}
     166rider@nvidia:~$ source /etc/profile [[BR]]
     167rider@nvidia:~$ sudo dpkg-reconfigure locales [[BR]]
     168rider@nvidia:~$ sudo apt-get update [[BR]]
     169rider@nvidia:~$ sudo apt-get install wget [[BR]]
     170'''# 更新 PCI ID Database''' [[BR]]
     171rider@nvidia:~$ sudo update-pciids [[BR]]
     172'''# 查看顯卡資訊有無正常顯示''' [[BR]]
     173rider@nvidia:~$ lspci [[BR]]
     174{{{
     17500:00.0 VGA compatible controller: nVidia Corporation GeForce 9800 GT (rev a2)
     176}}}
     177'''# 查看顯卡資源有無順利分配到 DomU''' [[BR]]
     178rider@nvidia:~$ dmesg | grep pci
     179{{{
     180pcifront pci-0: Installing PCI frontend
     181pcifront pci-0: Creating PCI Frontend Bus 0000:00
     182pciback 0000:00:00.0: probing...
     183pciback: pcistub_init_devices_late
     184}}}