Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GPU on OpenStack日本語版

GPU on OpenStack日本語版

日本語バージョン作りました。若干訂正も加えました。

masafumi_ohta

May 15, 2017
Tweet

More Decks by masafumi_ohta

Other Decks in Technology

Transcript

  1. K Linux OS for KVM hypervisor GPU Driver App Instance

    VMM/KVM IOMMU/Vt-d PCI Express x16 Linux/Win OS ComputeNode GPU Card GPU Card Nova Compute Nova Scheduler AMQP Nova API Linux OS ControllerNode ਤ:GPUύεεϧʔ͸Ͳ͏΍ͬͯOpenStackͰಈ͔͘ʢ໼ҹ͕Πϯελϯεൃߦϓϩηεʣ
  2. KVMϗετͷGPU ϗετͷGPUΛνΣοΫ͢Δ: lspci -nn | grep -i nvidia lspci -nn

    | grep -i nvidia 88:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:11b4] (rev a1) 88:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1) GPUͷϢχοτ͝ͱύεεϧʔ͢Δඞཁ͕͋Δ GPUϗετ͚ͩͰͳ͘HDMIͳͲϢχοτ͝ͱ੾Γ཭͢ඞཁ͋Γ Ͱͳ͍ͱVM্Ͱಈ͍ͯ͘Εͳ͍=ύεεϧʔͰ͖ͳ͍
  3. IOMMUͷηοτΞοϓ ෺ཧσόΠεΛ࢖͏ͨΊͷԾ૝γεςϜʹ͓͍ͯ IOMMU(Input/Output Memory Management Unit) ηοτΞο ϓ͸ඞਢ ΋ͪΖΜ intel

    vt-d (I/OԾ૝Խ)͸Φϯʹ (EFI/BIOS΋νΣοΫ) grubͰͷηοτΞοϓ΋ඞཁ:/etc/default/grubΛมߋهड़ GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on vfio_iommu_type1.allow_unsafe_interrupts=1”
  4. ෺ཧ͔Β੾Γ཭͢ pci-stubΛ͔ͭͬͯ෺ཧσόΠεΑΓ੾Γ཭͠VMͱ͚ͬͭ͘Δɻσ όΠεIDΛnew_idʹ௥Ճ͢Δɻ·ͨؔ࿈ࣝผࢠΛ੾Γ཭͠ɺVMͱ ͚ͬͭ͘Δɻ echo 11de 11b4 > /sys/bus/pci/drivers/pci-stub/new_id echo

    11de 0e0a > /sys/bus/pci/drivers/pci-stub/new_id echo 0000:88:00.0 > /sys/bus/pci/devices/0000:88:00.0/driver/unbind echo 0000:88:00.1 > /sys/bus/pci/devices/0000:88:00.1/driver/unbind echo 0000:88:00.0 > /sys/bus/pci/drivers/pci-stub/bind echo 0000:88:00.1 > /sys/bus/pci/drivers/pci-stub/bind ෺ཧϚγϯ͔Β੾Γ཭͞Ε͔ͨɺ’claimed’ʹͳ͍ͬͯΔ͔ௐ΂Δɻ pci-stub 0000:88:00.1: claimed by stub
  5. modprobe /etc/modprobe.d/blacklist.conf pci-stab /sys/bus/pci/drivers/pci-stub/ /sys/bus/pci/devices/$(Identifier)/driver/unbind ramfs /etc/initramfs-tools/modules GRUB /etc/default/grub modules

    /etc/modules UEFI/BIOS Vt-d ਤ:GPUύεεϧʔͰComputeNodeͷBOOTϓϩηε্Ͱઃఆ͢Δ΋ͷ B O O T ϓ ϩ η ε IOMMU IOMMU BLACK LIST BLACK LIST IOMMU BLACK LIST
  6. ෺ཧσόΠε pci-stub (Ծ૝Ͱ࢖͏) GPUϢχοτ (σόΠεશମ) GPUΛ෺ཧσόΠε͔Β੾Γ཭͠ɺ Ծ૝σόΠεʹ෇͚ସ͑Δɻ echo 11de 11b4

    > /sys/bus/pci/drivers/pci-stub/new_id echo 11de 0e0a > /sys/bus/pci/drivers/pci-stub/new_id echo 0000:88:00.0 > /sys/bus/pci/drivers/pci-stub/bind echo 0000:88:00.1 > /sys/bus/pci/drivers/pci-stub/bind echo 0000:88:00.0 > /sys/bus/pci/devices/0000:88:00.0/driver/unbind echo 0000:88:00.1 > /sys/bus/pci/devices/0000:88:00.1/driver/unbind
  7. ͞ΒʹGPUΛՃ͑Δ(1) lspciͷ݁ՌΛ֬ೝɺ2ͭͷσόΠεID͕݁Ռͱͯ͠ݟ͑Δɺ ͜ͷݟ͑ํ͸γεςϜʹґଘɻ lspci -nn | grep -i nvidia 88:00.0

    VGA compatible controller [0300]: NVIDIA Corporation Device [10de:11b4] (rev a1) 88:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1) 84:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:11b4] (rev a1) 84:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1)
  8. ͞ΒʹGPUΛՃ͑Δ(2) pci-stubΛར༻͠͞ΒʹσόΠεΛύεεϧʔ͢Δɻ echo 0000:84:00.0 > /sys/bus/pci/devices/0000:84:00.0/driver/unbind echo 0000:84:00.1 > /sys/bus/pci/devices/0000:84:00.1/driver/unbind

    echo 0000:84:00.0 > /sys/bus/pci/drivers/pci-stub/bind echo 0000:84:00.1 > /sys/bus/pci/drivers/pci-stub/bind CUDAΞϓϦΛ࢖͏্ͰಉػछͷGPUͷ௥Ճ͕ඞਢ(͕ͪ ͏΋ͷ͸ෆՄ)ɺಉ͡΋ͷͰ͋Δ͔ฉ͔ΕΔ͜ͱ͕͋Δɻ /nbody -benchmark -numdevices=2 -num bodies=65536
  9. ͞ΒʹGPUΛՃ͑Δ(3) ύεεϧʔʹ੒ޭ͢ΔͱVM্Ͱಈ͍͍ͯΔͷ͕lspciʹͯ νΣοΫͰ͖Δɻ ubuntu@guestos$ lspci -nn | grep -i nvidia

    00:07.0 VGA compatible controller [0300]: NVIDIA Corporation GK104GL [Quadro K4200] [10de:11b4] (rev a1) 00:08.0 VGA compatible controller [0300]: NVIDIA Corporation GK104GL [Quadro K4200] [10de:11b4] (rev a1)
  10. Windows as VDI Windows্ͷCUDA͸ͪΌΜͱΠϯετʔϧͰ͖Ε͹ૣ ͘ͳΔ͚Ͳ࣌ͨ·ΧΫΧΫͯ͠͠·͏ɻ vmͷdisk speedͷ໰୊ɺΤϑΣϝϥϧʹ͢ΔͳΓૣ͍σΟεΫΛ ࢖͏ͳΓͰͦͦ͜͜ղܾ͢Δ(SSD,NVMe or..etc) vm͸context

    switchͰr/wΛߦ͍ͬͯΔͷͰϔϏʔϫʔΫϩʔυ ͷCUDAͳΓ͸͜ͷΑ͏ͳΧΫΧΫঢ়ଶΛى͜͢Մೳੑ͕͋Δɻ ͜ͷ͋ͱ͸ޙ೚ʹ·͔͕ͤͨɺগ͠͸ΤϑΣϝϥϧͰվળͨ͠Β͍͠ ސ٬͸·ɺͳΜͱ͔ͳͬͨͱͱΓ͋͑ͣͷຬ଍͸΋Βͬͨɻ
  11. ϥΠϒϚΠάϨʔγϣϯ ϥΠϒϚΠΫϨʔγϣϯ͸Ͱ͖ͳ͍ɺvm͕ݹ͍ϗετͷ઀ଓ৘ ใΛ੾Γ཭ͤͳ͍ɻݹ͍ϗετͷ৘ใΛѲͬͨ··ʹͳΔɻ ϫʔΫΞϥ΢ϯυ:nova.pci_devicesͷMySQLͷDB৘ใΛফ͠ ͯɺݹ͍ϗετΛ࠶ىಈ͢Δʼҙຯͳ͠ʂ | 2016-08-11 00:54:45 | 2016-08-19

    04:58:01 | NULL | 0 | 45 | 21 | 0000:84:00.0 | 11b4 | 10de | type-PCI | pci_0000_84_00_0 | label_10de_11b4 | available | {} | NULL | NULL | 1 | <<-- old-host | 2016-08-11 00:54:45 | 2016-08-19 04:58:01 | NULL | 0 | 48 | 21 | 0000:88:00.0 | 11b4 | 10de | type-PCI | pci_0000_88_00_0 | label_10de_11b4 | available | {} | NULL | NULL | 1 | <<-- old-host