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.4k
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
Go の GC の不得意な部分を克服したい
taiyow
3
850
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
380
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
460
快速入門可觀測性
blueswen
0
420
Jakarta EE meets AI
ivargrimstad
0
290
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
660
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.5k
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.8k
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
400
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
Zoneless Testing
rainerhahnekamp
0
120
testcontainers のススメ
sgash708
1
130
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Rails Girls Zürich Keynote
gr2m
94
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
460
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/