Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
tesorflow-v1.0-on-ec2
Search
ryo nakamaru
February 20, 2017
Programming
1
650
tesorflow-v1.0-on-ec2
MaruLabo × JAWS-UG AI 支部 #2 用の資料です
ryo nakamaru
February 20, 2017
Tweet
Share
More Decks by ryo nakamaru
See All by ryo nakamaru
AWSで楽をするサービスメッシュ入門/appmesh-trial
pottava
1
1.3k
reinforce-2019-recap-lt
pottava
2
4.1k
ScaleShift-jp-2019-summer
pottava
1
190
Firecracker とは何か/what is Firecracker
pottava
13
5.3k
ハイブリッド並列 on Kubernetes/hybrid-parallel-program-on-kubernetes
pottava
1
410
AWS Fargate + Code 兄弟で始める継続的デリバリー / Continuous Delivery with AWS Fargate and Code brothers
pottava
12
3.1k
Singularity と NVIDIA GPU Cloud で作る ハイブリッド機械学習環境の構築 / Building a hybrid environment for Machine Learning with Singularity and NGC
pottava
3
1.2k
明日から始めるちょい足し λ / get-started-with-aws-lambda
pottava
4
2.4k
NGC と Singularity によるハイブリッド機械学習環境 / A hybrid environment for Machine Learning with NGC and Singularity
pottava
0
460
Other Decks in Programming
See All in Programming
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Quine, Polyglot, 良いコード
qnighy
4
640
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
距離関数を極める! / SESSIONS 2024
gam0022
0
280
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
役立つログに取り組もう
irof
28
9.6k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
900
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
How to train your dragon (web standard)
notwaldorf
88
5.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Why Our Code Smells
bkeepers
PRO
334
57k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Code Review Best Practice
trishagee
64
17k
Automating Front-end Workflow
addyosmani
1366
200k
GitHub's CSS Performance
jonrohan
1030
460k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Adopting Sorbet at Scale
ufuk
73
9.1k
Transcript
TensorFlow v1.0 with GPU on AWS MaruLabo × JAWS-UG AI
#2 @ 2017.02.20
@pottava SUPINF Inc.
ࠓ TensorFlow Ͱ͕͢ɺMXNet ɻ http://qiita.com/pottava/items/0d40747287ff31b8db77
DeepLeaning ͷֶशʹظ͕ߴ·Δ AWS Batchʂ https://jawsug-cli.doorkeeper.jp/events/52026
3 / 11ɺͥͻ͝ࢀՃ͍ͩ͘͞ʂʂ http://jawsdays2017.jaws-ug.jp/
ͦͦͳͥ GPU ͏ͷʁ
ʢࠓʣϋϯζΦϯ͔ͩΒͰ͢ ɾσΟʔϓϥʔχϯάͷֶशΛҰఆ࣌ؒʹऴ͍͑ͨ ɾGPU ߦྻܭࢉ͕ CPU ΑΓͣͬͱ͍ ɾֶशͷଟ͘ߦྻܭࢉ ɾGPU ͑ϋϯζΦϯΛͰ͖ΔՄೳੑ͕ߴ·Δ
ΫϥυͳΒ GPU ͷํ͕͍҆ʁʁ ɾΫϥυҰൠతʹ࣌ؒ՝ۚ ɾCPU ͩͱ 1 ͔͔࣌ؒΔॲཧɺGPU ͳΒ 45
ɹͲ͕͍ͬͪ҆ʁ ɾϓϩάϥϜنʹԠͯ͡બ͠·͠ΐ͏
ݟ͑ͳ͍ίετ ɾͰ GPU ͚ʹॻ͘ͷେมͳΜͰ͠ΐɾɾʁ ɾTensorFlow ͳͲ GPU Λҙࣝͤͣͱॻ͚Δ ɾࢼߦࡨޡ͢Δաఔ͕͍ͷຯʹετϨε ɾ͍ਖ਼ٛ
ͯ͞
Topics 1. AWS GPU Πϯελϯε & NVIDIA ͓͞Β͍ 2. g2
ܥͰ TensorFlow v1.0 Λ͏ 3 ͭͷํ๏ 3. ҆͘͏ʹ
1. AWS GPU Πϯελϯε & NVIDIA ͓͞Β͍
GPU Πϯελϯε AWS ʹ 2 छྨ͋Γ·͢ʢݱߦੈʣ g2 ܥ: NVIDIA GRID
K520 ɹɹɹɹ1,536 CUDA cores / GPU ͕ 2 ͭͰ 1 ͭͷ K520 ɹɹɹɹg2 Ͱ͑Δ GPU ຊདྷάϥϑΟοΫɾήʔϛϯά༻్ p2 ܥ: NVIDIA Tesla K80 ɹɹɹɹഒਫ਼ԋࢉ࠷େ 2.91 TFLOPSɺ୯ਫ਼ԋࢉ࠷େ 8.74 TFLOPS ɹɹɹɹ2,496 CUDA cores / GPU ͕ 2 ͭͰ 1 ͭͷ K80 ɹɹɹɹp2 ͷ GPU ൚༻ίϯϐϡʔςΟϯά༻్
EC2 Ͱ GPU Λಈ͔͢ʹ GPU υϥΠόΛΠϯετʔϧ͢Ε OKʂ ͱ͍͑ͦΕΛૢ࡞͢Δͷɾɾ ݱ࣮తʹ CUDA
Toolkit ඞཁͰ͢ɻ TensorFlow cuDNN ෦Ͱ͏ͷͰͦΕɻ
υϥΠόʁ ɾGPU ͝ͱʹ NVIDIA Driver ͕͞Ε͍ͯ·͢ ɹg2 ͳΒ GRID K520ɺp2
ͳΒ Tesla K80 ͷυϥΠό ɾυϥΠόͷόʔδϣϯ൪߸௨͠ɻ ɹྫ: ࠷৽όʔδϣϯͩͱ g2 ܥ GPU ೝࣝͰ͖ͳ͍
CUDAʁ ɾ͘ʔͩ ɾNVIDIA ࣾ GPU ͚ C ݴޠ౷߹։ൃڥ ɾίϯύΠϥͱ͔ϥΠϒϥϦͱ͔ศརπʔϧ܈ ɾTensorFlow
ͳͲ CUDA ܦ༝Ͱ GPU Λૢ࡞
CUDA ͱ NVIDIA υϥΠόͷରԠ ৽͍͠ CUDA Λ͏ʹ৽͠ΊͷυϥΠό͕ඞཁɻ https://github.com/NVIDIA/nvidia-docker/wiki/CUDA#requirements
Πϯετʔϧํ๏ 3 ͭ ɾυϥΠόΛೖΕͯɺCUDA Toolkit ΛೖΕΔ ɾCUDA ͷ Runfile ΠϯετʔϧͰυϥΠό͝ͱೖΕΔ
ɾυϥΠό͚ͩೖΕͯɺͦͷ্ Docker Λ͏
ҙ ɾυϥΠό GPU ͝ͱɺCUDA OS ͝ͱͷ༻ҙ ɾRunfile ΠϯετʔϧͰ GPU
ͱͷ߹ੑʹҙ ɾg2 ܥͱ p2 ܥ݉༻ͷ AMI Λ࡞ΔͳΒ ɹGRID K520 ͱ Tesla K80 ͲͪΒͰ͑ͯ ɹ͔ͭͳΔ͘৽͍͠υϥΠόΛ͏
ͦ͠͏
͍͠Ͱ͢
ͬͱ؆୯ʹ͑ͳ͍ͷʁ
ָ͍ͨ͠ํ ɾAWS ʹ AMI ͱ͍͏ϚγϯΠϝʔδ͕͋Γ·ͯ͠ ɹNVIDIA υϥΠό CUDA ͢Ͱʹೖͬͨͷ͕ʂ ɾNVIDIA
ެࣜ AMI → AWS Marketplace Go ɾAWS ެࣜ → “Deep Learning AMI” Ͱ୳ͤ·͢
AMI ར༻ͷώϯτ ɾଞΫϥυͰ CUDA ೖΓެࣜΠϝʔδ·ͩͳ͍ ɾNVIDIA / AWS ͍ͣΕͷ AMI
ݱঢ় CUDA 7.5 ɾࣗ࡞ͨ͠ AMI Λ Public ʹ͢Δͷɾɾ ɹɹ- NVIDIA ͷϥΠηϯε ɹɹ- υϥΠόͷΈ NVIDIA AMI + Docker ͱ͍͏ख
2. g2 ܥͰ TensorFlow v1.0 Λ ͏ 3 ͭͷํ๏
ͦͦ TensorFlow Λ͏ʹ ɾpip install ɾ./configure ͔Βͷ pip installʢࣗͰϏϧυʣ ɾnvidia-docker
run
TensorFlow v1.0 ͷґଘ GPU ൛ TensorFlow CUDA ͱ cuDNN
ʹґଘɻ v0.12 Ҏ߱ CUDA 8.0 ΛλʔήοτʹϏϧυ͞Ε͍ͯ ΔͨΊɺ8.0 ܥϥΠϒϥϦʢToolkit શମ͕ 8.0 Ͱ͋Δඞ ཁͳ͍ʣͱ 367.48 Ҏ߱ ͷ NVIDIA υϥΠό͕ඞཁɻ
ͱ͍͏͜ͱ
ҎԼͷ͍ͣΕ͔͕ඞཁ ɾґଘΛຬͨ͢Α͏ʹαʔόΛηοτΞοϓ ɾCUDA 7.5 ΛλʔήοτʹࣗͰ TF ΛϏϧυ ɾ݅Λຬͨ͢υϥΠό͚ͩೖΕͯɺDocker Ͱىಈ
g2 ܥ + CUDA 8.0
ણࡉͳυϥΠόόʔδϣϯ g2 ܥ GRID K520 ͷ࠷৽ରԠυϥΠό 367.57ɻ TensorFlow ͷϏϧυࡁΈόΠφϦ͕ཁٻ͢Δ CUDA
8.0 + NVIDIA Driver (>= 367.48) Λຬͨ͢ͷ ຯʹ͍͠ɻubuntu 16.04 + ҎԼ Runfile Ͱ OK https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/ cuda_8.0.44_linux-run
g2 ܥ + CUDA 7.5
ࣗͰϏϧυ͢ΔͳΒ Compute capability: g2 ͷ K520 3.0ɺp2 ͷ K80
3.7 TensorFlow ͷϏϧυ࣌ʹࢦఆ͠·͢ɻ https://en.wikipedia.org/wiki/CUDA#GPUs_supported
Docker Λ͏ͳΒ K520 ରԠͷ NVIDIA υϥΠό 367.57 ΛೖΕɺ nvidia-docker ΛηοτΞοϓ͢Ε
OKʂ ͘͠ AWS ެࣜͷ DeepLearning AMI ubuntu ൛Λ͑υϥΠόΠϯετʔϧ͑͞ෆཁɻ
p2 ܥʁ
جຊಉ͡ ͦͷ্ Tesla K80 ͱͳΕαʔόηοτΞοϓ ਵָʹͳΔͨΊɺׂѪ͠·͢ɻ
3. ҆͘͏ʹ
εϙοτΠϯελϯε AWS Ͱ GPU Λ͏ͳΒͥͻ͍͍ͨͱ͜Ζɻ ຊޠͷࢿྉॆ࣮͍ͯ͠ΔͷͰௐͯΈ͍ͯͩ͘͞
גࣜձࣾεϐϯϑ ΞΠσΟΞΛ͔ͨͪʹʂ +
http://prtimes.jp/main/html/rd/p/000000007.000007768.html Comfy for Docker ϓϩδΣΫτͷ Docker ಋೖɾ։ൃࢧԉɾӡ༻ࢹߦΛ͍ͨ͠·͢ɻ ʢGCP / Azure
ͪΖΜରԠ͍ͯ͠·͢ɾɾʣ https://www.supinf.co.jp/service/dockersupport/
͝૬ஊ͓ؾܰʹͪ͜Β·Ͱ.. 41 <Thank you !! https://www.supinf.co.jp/service/dockersupport/