みらいテックラボ

音声・画像認識や機械学習など, 週末プログラマである管理人が興味のある技術の紹介や実際にトライしてみた様子などメモしていく.

深層学習用に低火力PCを組み立てた(2)

人工知能技術戦略会議等主催 第1回AIチャレンジコンテスト[1][2]で入賞賞品としていただいたNVIDIA GTX-1060 Founders Editionを活用しようと, 「低火力コンピューティング」のPCを組み立てた.

前回は, Ubuntuをインストールし, 2つの不具合が発生したことを紹介した.
今回は, その一つ「1) X Window Systemの描画が遅い」件について, 対策を紹介する.

関連記事:

3. 不具合1)の対策
3.1 原因
まずは, X Window Systemの起動時のログを確認.

$ less /var/log/Xorg.0.log
[     2.745]
X.Org X Server 1.18.3
Release Date: 2016-04-04
[     2.745] X Protocol Version 11, Revision 0
[     2.745] Build Operating System: Linux 3.13.0-85-generic x86_64 Ubuntu
[     2.745] Current Operating System: Linux moonlight 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64
   :
[     2.763] (II) VESA: driver for VESA chipsets: vesa
[     2.779] (EE) open /dev/dri/card0: No such file or directory
[     2.779] (WW) Falling back to old probe method for modesetting
[     2.779] (EE) open /dev/dri/card0: No such file or directory
[     2.779] (II) Loading sub module "fbdevhw"
[     2.779] (II) LoadModule: "fbdevhw"
[     2.779] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[     2.779] (II) Module fbdevhw: vendor="X.Org Foundation"
[     2.779]    compiled for 1.18.3, module version = 0.0.2
[     2.779]    ABI class: X.Org Video Driver, version 20.0
[     2.779] (**) FBDEV(1): claimed PCI slot 0@0:2:0
[     2.779] (II) FBDEV(1): using default device
[     2.779] (WW) Falling back to old probe method for vesa
[     2.779] (EE) Screen 0 deleted because of no matching config section.
   :

「/dev/dri/card0」がオープンできないといっている.
そこで, Linuxの起動ログも確認.

$ dmesg

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.0-21-generic (buildd@lgw01-21) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 (Ubuntu 4.4.0-21.37-generic 4.4.6)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-21-generic root=UUID=6effb0e1-0986-4783-bf00-a172bf725efa ro quiet splash vt.handoff=7
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
   :
[    0.597969] Console: switching to colour frame buffer device 128x48
[    0.597976] fb0: VESA VGA frame buffer device
[    0.597983] intel_idle: does not run on family 6 model 158
   :

今回使用したIntel Core i7-7700は第7世代のKaby Lake. Intel HD Graphics 630搭載.
どうも正しく認識されていなくて, ドライバの読み込みに失敗しているもよう.

3.2 Intel Graphicsドライバのアップデート
まずは, INTEL® GRAPHICS FOR LINUX*[3]Intel Graphics Update Tool for Linux* OS v2.0.2からIntel® Graphics Update Tool 2.0.2 for Ubuntu* 16.04, 64-bitをダウンロードし, ドライバのupdateを試みた.

しかし, これはインストール自体はOKだったが, その後のパッケージアップデートでFAILした.
少しトライしてみたが, 解決しそうにないので, 別の方法を探してみることに...

ubuntu forumsに「Update Intel Graphics Drivers ? 」[4]という記事があったので, 試してみた.

$ sudo add-apt-repository ppa:ubuntu-x-swat/intel-graphics-updates

$ sudo apt update

$ sudo apt upgrade

$ sudo reboot

再起動後, 起動ログを確認.

$ dmesg

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.0-91-generic (buildd@lcy01-11) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 (Ubuntu 4.4.0-91.114-generic 4.4.76)
   :
[    0.615218] Console: switching to colour frame buffer device 128x48
[    0.615225] fb0: VESA VGA frame buffer device
[    0.615233] intel_idle: MWAIT substates: 0x142120
[    0.615234] intel_idle: v0.4.1 model 0x9E
[    0.615234] intel_idle: lapic_timer_reliable_states 0xffffffff
   :

$ less /var/log/Xorg.0.log
   :
[     4.159] (II) LoadModule: "vesa"
[     4.159] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
[     4.160] (II) Module vesa: vendor="X.Org Foundation"
[     4.160]    compiled for 1.18.1, module version = 2.3.4
[     4.160]    Module class: X.Org Video Driver
[     4.160]    ABI class: X.Org Video Driver, version 20.0
[     4.160] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:
        i810, i810-dc100, i810e, i815, i830M, 845G, 854, 852GM/855GM, 865G,
        915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,
        Pineview G, 965G, G35, 965Q, 946GZ, 965GM, 965GME/GLE, G33, Q35, Q33,
        GM45, 4 Series, G45/G43, Q45/Q43, G41, B43
[     4.160] (II) intel: Driver for Intel(R) HD Graphics: 2000-6000
[     4.160] (II) intel: Driver for Intel(R) Iris(TM) Graphics: 5100, 6100
[     4.160] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics: 5200, 6200, P6300
[     4.160] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[     4.160] (II) FBDEV: driver for framebuffer: fbdev
[     4.160] (II) VESA: driver for VESA chipsets: vesa
[     4.161] (II) intel(0): Using Kernel Mode Setting driver: i915_bpo, version 1.6.0 20160425
[     4.161] (II) intel(0): SNA compiled: xserver-xorg-video-intel 2:2.99.917+git20160325-1ubuntu1.2 (Timo Aaltonen <tjaalton@debian.org>)
   :

おお, 今度はうまく認識したようだ.
しかし, 相変わらず描画が遅い.

3.3 X Window Systemの設定
Xの初期設定ファイルを確認する.
最近は, /etc/X11の下にxorg.confがないので, まずはxorg.confファイルを作成.
ctrl+alt+F1で仮想コンソールに入り, 以下の手順で作成できる.

$ sudo service lightdm stop

$ sudo Xorg -configure

$ ls -a xorg.conf.new
xorg.con.new

$ less xorg.conf.new
Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection
   :
Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"                  # [<bool>]
        #Option     "HWcursor"                  # [<bool>]
        #Option     "NoAccel"                   # [<bool>]
        #Option     "ShadowFB"                  # [<bool>]
        #Option     "VideoKey"                  # <i>
        #Option     "WrappedFB"                 # [<bool>]
        #Option     "GLXVBlank"                 # [<bool>]
        #Option     "ZaphodHeads"               # <str>
        #Option     "PageFlip"                  # [<bool>]
        #Option     "SwapLimit"                 # <i>
        #Option     "AsyncUTSDFS"               # [<bool>]
        #Option     "AccelMethod"               # <str>
        #Option     "DRI"                       # <i>
        Identifier  "Card0"
        Driver      "nouveau"
        BusID       "PCI:1:0:0"
EndSection

Linux上のnouveauグラフィックドライバが有効になっており,PCIバスが"1:0:0"に設定されている.
Intelのグラフィックドライバは使用されていない. (設定していないので当然か....)

$ lspci | grep  Intel
00:00.0 Host bridge: Intel Corporation Device 591f (rev 05)
00:01.0 PCI bridge: Intel Corporation Sky Lake PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation Device 5912 (rev 04)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1)
00:1c.7 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #8 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation Sunrise Point-H HD Audio (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)

lspciで調べると, VGA controllerは"00:02:0"になっている.
そこで, xorg.conf.newを以下のように修正し, /etc/X11/xorg.confとしてコピーする.

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"                  # [<bool>]
        #Option     "HWcursor"                  # [<bool>]
        #Option     "NoAccel"                   # [<bool>]
        #Option     "ShadowFB"                  # [<bool>]
        #Option     "VideoKey"                  # <i>
        #Option     "WrappedFB"                 # [<bool>]
        #Option     "GLXVBlank"                 # [<bool>]
        #Option     "ZaphodHeads"               # <str>
        #Option     "PageFlip"                  # [<bool>]
        #Option     "SwapLimit"                 # <i>
        #Option     "AsyncUTSDFS"               # [<bool>]
        #Option     "AccelMethod"               # <str>
        #Option     "DRI"                       # <i>
        Identifier  "Card0"
        Driver      "intel"                     # "nouveau"
        BusID       "PCI:0:2:0"                 # BusID       "PCI:1:0:0"
EndSection

rebootして確認すると, 今度は特に描画が遅いといったことはなく, 不具合は解決したようだ.

$ less /var/log/Xorg.0.log
   :
[     2.932] (==) Using config file: "/etc/X11/xorg.conf"
[     2.932] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[     2.932] (==) ServerLayout "X.org Configured"
[     2.932] (**) |-->Screen "Screen0" (0)
[     2.932] (**) |   |-->Monitor "Monitor0"
[     2.933] (**) |   |-->Device "Card0"
[     2.933] (**) |-->Input Device "Mouse0"
[     2.933] (**) |-->Input Device "Keyboard0"

次回は, 「2) NVIDIAのドライバをインストールすると, ログインループする」件の対策について紹介する.

----
参照URL:
[1] オプトDSL・DeepAnalyticsコンテスト『人工知能技術戦略会議等主催 第1回AIチャレンジコンテスト』
[2] 第1回AIチャレンジコンテスト(料理分類部門)に挑戦してみた!! (3) - みらいテックラボ
[3] Intel® Graphics for Linux* | 01.org
[4] [ubuntu] Update Intel Graphics Drivers ?




新しいLinuxの教科書

新しいLinuxの教科書



まんがでわかるLinux シス管系女子(日経BP Next ICT選書)

まんがでわかるLinux シス管系女子(日経BP Next ICT選書)