More Related Content Similar to TenforFlow Internals (20) TenforFlow Internals3. TensorFlow LOC
Module LOC ๋น ๊ณ
core 211,610 C++ ๋ก ์์ฑ๋ TensorFlow ์ฝ์ด ์ฝ๋
stream_executor 28,056 GPU CUDA ๊ด๋ จ ์ฝ๋
python 103,113 Python ํ๊ฒฝ ์ง์์ ์ํ ํ์ด์ฌ ์ฝ๋
etc 68,368 contrib, models, tensorbard, tools, user_ops
total 411,147
commit : 005386dc198220601293d4821e6de63246527b0c
4. ๋ด ์ฉ
โข ํ๊ณ ์ ํ๋ ๊ฒ
โข ์ฝ๋ ๋ ๋ฒจ์์์ TensorFlow ๋์ ๋ฐฉ์์ ์ดํด๋ณด๋ ค๊ณ ํฉ๋๋ค.
โข ํ์ง ์๋ ๊ฒ
โข ๋ฅ๋ฌ๋ ์ด๋ก ์์ฒด๋ฅผ ๋ค๋ฃจ์ง ์์ต๋๋ค.
โข TensorFlow ์ฌ์ฉ๋ฒ์ ๋ค๋ฃจ์ง ์์ต๋๋ค.
5. Simple Neural Network
๐ป = ๐
๐๐ฟ๐(๐ค1 ๐ฅ)
๐ฆ = ๐ ๐๐๐ก๐๐๐ฅ(๐ค2 ๐ป)
โ ๐ฆ = ๐ ๐๐๐ก๐๐๐ฅ(๐ค2 ๐
๐๐ฟ๐(๐ค1))
๐
๐๐ฟ๐ ๐ง = max(0, ๐ง)
๐ ๐๐๐ก๐๐๐ฅ ๐ง =
exp(๐ง๐)
๐ exp(๐ง๐)
input : MNIST
x1
x2
x3
y1
y2
y3
w1 w2
ReLU
Softmax
6. ์ผ๋ฐ์ ์ธ ๊ตฌํ ์คํ์ผ (with Torch)
Net
Li near Layer
ReLU Layer
Li near Layer
Wei ght
Wei ght
Gr ad
Gr ad
scor e [ cr i t ]
i nput
updat er
8. TensorFlow Language
โข Python
โข ๊ทธ๋ํ ๊ตฌ์ฑ์ Python API ๋ฅผ ์ด์ฉํ์ฌ ์์ฑํ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
โข ์ด ์ธ์๋ TensorFlow ๋ฅผ ์์ฝ๊ฒ ์ฌ์ฉํ๊ธฐ ์ํ ๊ธฐ๋ฅ๋ค์ ์ ๊ณตํฉ๋๋ค.
โข C++
โข ์ฑ๋ฅ์ ์๊ตฌํ๋ ์ค์ ์ฐ์ฐ ์์
์ ๋ชจ๋ C++ ํ๊ฒฝ์ผ๋ก ์์ฑ๋ฉ๋๋ค.
9. Python API ๋ก ํ๋ ์ผ
โข ๊ทธ๋ํ๋ฅผ ์์ฑํฉ๋๋ค. โข Session ์ ๊ด๋ฆฌํฉ๋๋ค.
10. ๊ทธ๋ํ ์์ฑ
โข Python ๊ตฌ๋ฌธ์ ์ด์ฉํ์ฌ ์ฐ์ฐ์ ์ฌ์ฉํ ๊ทธ๋ํ๋ฅผ ๊ตฌ์ฑํฉ๋๋ค.
โข ํจ์๊ฐ ํธ์ถ๋๋ ์ฆ์ ๋ด๋ถ ์ฐ์ฐ์ด ์ํ๋๋ ๊ฒ์ ์๋๋๋ค.
โข ์ค๋ก์ง ์ฐ์ฐ ๊ทธ๋ํ๊ฐ ์์ฑ๋๋ ๊ณผ์ ์ ๊ฑฐ์น๊ฒ ๋ฉ๋๋ค.
11. Session์ ์ญํ
โข Session์ TensorFlow ๊ทธ๋ํ ์ฐ์ฐ์ ์ํํ๊ธฐ ์ํ ์ฌ์ฉ์ ์ธํฐํ์ด์ค ์
๋๋ค.
โข Graph๋ฅผ ์์ฑํ๊ณ Operation์ ์ํํ๋ฉฐ Tensor๋ฅผ ํ๊ฐ(eval)ํฉ๋๋ค. (C++ Session)
โข tf.Session ์ ๋ฐ๋์ ํ ๊ฐ์ tf.Graph ๊ฐ์ฒด๋ฅผ ํฌํจํฉ๋๋ค.
โข ํน์ tf.Graph ๋ฅผ ๋ช
์ํ์ง ์์ ๊ฒฝ์ฐ default graph ๊ฐ ์ฌ์ฉ๋ฉ๋๋ค.
13. Google Protocol buffer
โข ์์ ๋ณธ ๋ด์ฉ์์๋ tf.Graph ์ ๋ณด๋ฅผ C++๋ก ๋๊ธฐ๋ ๋ถ๋ถ์ด ์์ต๋๋ค.
โข tf.Graph ๋ํ Python ๊ฐ์ฒด์ด๋ฏ๋ก ๋ฐ๋ก C++ ์ ๋ฌ์ ๋ถ๊ฐ๋ฅํฉ๋๋ค.
โข tf.Graph ๋ฅผ Protocol Buffer ํ์
์ ์๋ฃํ์ผ๋ก ๋ณํํ ๋ค ์ ๋ฌํ๊ฒ ๋ฉ๋๋ค.
โข ๊ทธ๋ํ ๊ตฌ์ฑ ์์ฒด๋ฅผ ๊ธฐ์ ํ ์ ๋ณด๊ฐ Serialize๋ ๋ฐ์ดํฐ๋ผ๊ณ ์๊ฐํ์๋ฉด ์ฝ์ต๋๋ค.
14. Overview (in C++)
Session ๊ทธ๋ํ ์ฐ์ฐ ์์
๊ด๋ฆฌ
Device ๋๋ฐ์ด์ค ์ ๋ณด๋ฅผ ๋ด๊ณ ์๋ ๊ฐ์ฒด
Graph ์ฐ์ฐ(op)๊ณผ ๊ฐ(tensor)์ ๊ทธ๋ํ ๊ตฌ์กฐ๋ก ์ ์ฅ
Executor ๊ทธ๋ํ ์ฐ์ฐ์ ์ค์ ๋ก ์ํ
OpKernel ๊ทธ๋ํ ๋
ธ๋์ ์ง์ ๋ ์ฐ์ฐ (Functor)
15. Session
โข ์ฌ์ฉ์๊ฐ ์์ฒญํ๊ทธ๋ํ ์ฐ์ฐ์
์ค์ ๋ก ์ํํ๋ ๊ฐ์ฒด์
๋๋ค.
โข ํ์ฌ 2๊ฐ์ง Session์ด ์ ๊ณต๋ฉ๋๋ค.
โข ๋ก์ปฌ ํ๊ฒฝ : DirectSession
โข ๋ถ์ฐ ํ๊ฒฝ : GrpcSession
โข ๋จผ์ ๋ก์ปฌ ํ๊ฒฝ๋ถํฐ ์ดํด๋ด
์๋ค.
Di r ect Sessi on
Sessi on
Gr pcSessi on
Di r ect Sessi on
Fact or y
Gr pcSessi onFact or y
Fact or y
new( ) new( )
Sessi onFact or y
17. Session : ๊ทธ๋ํ ์์ฑ
โข Session::Run() ํธ์ถ์ ๊ฐ์ฅ ๋จผ์ GraphDef ๋ฅผ Graph ๊ฐ์ฒด๋ก ๋ณํํฉ๋๋ค.
20. Node์ device ์ค์ ํ๊ธฐ
โข ๊ทธ๋ฐ๋ฐ TensorFlow ๋ GPU ํ๊ฒฝ์์ ๋๋ ค๋ณผ ์ ์๋์?
โข ๋ง์ ๋ฅ๋ฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ Process ๋จ์ CPU/GPU ๋ชจ๋๋ฅผ ์ ๊ณตํฉ๋๋ค.
โข ํ์ง๋ง TensorFlow ์์๋ Node ๋จ์๋ก Device๋ฅผ ์ ํํ ์ ์์ต๋๋ค.
โข Node ๋จ์ ์คํ์ ์ํด Graph ๊ฐ์ฒด๋ ๋ถํ ๋ ์ ์์ต๋๋ค.
21. Node์ device ์ค์ ํ๊ธฐ (Contโd)
โข ์ฌ์ฉ์๊ฐ ๋ช
์์ ์ผ๋ก ์ฝ๋ ์์์ device๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
โข ์ด๋ฐ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ๋ฉด ํด๋น Node์ device ์ ๋ณด๊ฐ ๊ธฐ๋ก๋ฉ๋๋ค.
โข Node์ device ์ ๋ณด๊ฐ ์๋ ๊ฒฝ์ฐ TensorFlow๊ฐ ์์์ device๋ฅผ ์ง์ ํฉ๋๋ค.
22. Device ํ ๋น ์ ์ฝ ์ฌํญ
โข Node์ device๋ฅผ ์ง์ ํ ๋์ ์ ์ฝ ์ฌํญ์
๋๋ค.
1. ์ฌ์ฉ์๊ฐ ์ฝ๋ ์์ ๋ช
์์ ์ผ๋ก device ๋ฅผ ๊ธฐ์ ํ ๊ฒฝ์ฐ
โข ๋ฐ๋์ ํด๋น device ๋ก ๋
ธ๋๋ฅผ ํ ๋นํด์ผ ํฉ๋๋ค.
2. ์ด๋ค ๋
ธ๋๊ฐ ๋ค๋ฅธ ๋
ธ๋์ ์ฐธ์กฐ ํ์
์ผ๋ก ์์ฑ๋ ๊ฒฝ์ฐ
โข ์ด ๊ฒฝ์ฐ ๋ ๋
ธ๋๋ ๋์ผํ device ๋ก ํ ๋นํด์ผ ํฉ๋๋ค.
3. A์ B๋
ธ๋๊ฐ ์ฃผ์ด์ง๊ณ B๋
ธ๋์ @A์ ๊ฐ์ colocation์ด ์ฌ์ฉ๋ ๊ฒฝ์ฐ
โข ์ด ๊ฒฝ์ฐ๋ A์ B ๋
ธ๋๋ ๋์ผํ device ๋ก ํ ๋น๋์ด์ผ ํฉ๋๋ค.
23. SimplePlacer
Di r ect Sessi on
Gr aphSi mpl ePl acer
Devi ceSet
devi ce_set
devi ces
Devi ce
devi ces
Devi ceMgr
LookupDevi ce( )
Li st Devi ces( )
devi ces devi ce_mgr
24. SimplePlacer (Contโd)
โข ์ด๋ฆ๋๋ก ๊ฐ๋จํ ๋ฐฉ์์ผ๋ก ์์
ํฉ๋๋ค.
โข TensorFow White Paper ์ ๋ฐ๋ฅด๋ฉด,
โข ๋
ธ๋ ํ ๋น์ Cost ๊ธฐ๋ฐ ํ ๋น์ ์ํํ๋ค๊ณ ๋์ด ์์ต๋๋ค.
โข ํ์ง๋ง ํ์ค์ ?
โข ์ผ๋จ device๋ฅผ ํ ๋นํ ๋
ธ๋๋ ๋ถ๋ชจ ๋
ธ๋์ device ์ ๋ณด๋ฅผ ์ป์ด ์์ ์ device ์ ๋ณด๋ก ์ฌ์ฉํฉ๋๋ค.
โข ์ด ๋ ๋ถ๋ชจ ๋
ธ๋์ device๊ฐ ์ง์ ๋์ด ์์ง ์์ ๊ฒฝ์ฐ, ์ฌ์ ๊ณ ๋ ค๋ ์์์ ๋ฐ๋ผ ํ ๋น๋ฉ๋๋ค.
โข ๋ฐ๋ผ์ GPU ์ฅ๋น๊ฐ ์ค์น๋์ด ์๋ ์ฅ๋น์ ๊ฒฝ์ฐ ๋๊ฐ GPU:0 ์ด ํ ๋น๋ฉ๋๋ค.
โข ์ฆ, ํ ๋น ์ ์ฑ
์ ํํธ์๋ค๋ ๋ป์
๋๋ค. (์ดํ์ ๋ ์ข์ Placer ๊ฐ ๋์ฌ๊ฑฐ๋ผ ์๊ฐํฉ๋๋ค.)
GPU: 0 GPU: 1
CPU: 0
i mage
hddn
w1
ReLU
w2
scor e
pr ob
l oss
l abel
25. Graph partitioning
โข Device ๋จ์๋ก ํํฐ์
๋์ ์ํํฉ๋๋ค.
โข ๊ทธ๋ํ ๋ถํ ์ ์๋ฃํ๊ธฐ ์ํด์๋ ์ถ๊ฐ ์์
์ด ํ์ํฉ๋๋ค.
โข ์ ์ ์ด ๋๋ ๋
ธ๋์ recv, send ๋
ธ๋๋ฅผ ์ถ๊ฐํ์ฌ ๊ทธ๋ํ ๋ถํ ์ ์์ฑํฉ๋๋ค.
โข ์ด ๋ ์๋ธ๊ทธ๋ํ์์ recv๊ฐ ์ฌ๋ฌ ๋
ธ๋์์ ์ฌ์ฉ๋๋ค๋ฉด ํ๋๋ก ์นํํฉ๋๋ค.
GPU: 0 GPU: 1
CPU: 0
i mage
hddn
w1
ReLU
w2
scor e
pr ob
l oss
l abel
send
r ecv send r ecv
send
r ecv
27. Executor
โข Executor๋ ์๋ธ-๊ทธ๋ํ ํ๋๋ง๋ค ์์ฑ๋ฉ๋๋ค.
โข Executor๋ ๊ฐ๋ณ์ ์ธ Thread ์์
์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค.
โข Executor๋ ์๋ธ-๊ทธ๋ํ์ ์์ ๋
ธ๋๋ฅผ ์ฐพ์ ๊ทธ๋ํ ์ฐ์ฐ์ ์ํํฉ๋๋ค.
โข ๋ชจ๋ Executor์ ์์
์ด ๋๋ ๋๊น์ง ExecutorBarrier๊ฐ ๋ง์์ค๋๋ค.
โข Executor๊ฐ ํ๋ ์ผ์ ์ข ๋ ๋ณต์กํ์ง๋ง ์ด ์ ๋๋ง ์๊ณ ๋์ด๊ฐ์๋ค.
28. ๋๋ฐ๋ทฐ (Rendezvous)
โข ์๋ธ-๊ทธ๋ํ ์ฌ์ด์ send์ recv ๋
ธ๋ ๋ฐ์ดํฐ๋ฅผ ๋๊ธฐํํ๋ ๊ฐ์ฒด์
๋๋ค.
โข ๊ฐ Executor ๋ค์ ์์ ์ ์๋ธ ๊ทธ๋ํ ๋ด์ send์ recv ๊ฐ์ฒด๋ฅผ Rendezvous ๊ฐ์ฒด์ ๋ฑ๋กํฉ๋๋ค.
โข Send()
โข send ๋
ธ๋์ ์ํ Tensor ๋ฐ์ดํฐ๋ฅผ ๋ค๋ฅธ ๊ทธ๋ํ๋ก ๋ณด๋ด์ค ๋ ์ฌ์ฉํฉ๋๋ค.
โข Send() ํธ์ถ์ ์ด๋ฏธ ๋ค๋ฅธ Executor ๊ฐ ํด๋น ๋
ธ๋์ ๋ฐ์ดํฐ๋ฅผ ์๊ตฌํ ์ฌ์ค์ด ์๋ค๋ฉด ๋ฐ๋ก ๋ฐ์ดํฐ๋ฅผ ์ ๋ฌํฉ๋๋ค.
โข RecvAsync()
โข recv ๋
ธ๋์ ์ํ Tensor ๋ฐ์ดํฐ๋ฅผ ๋ค๋ฅธ ๊ทธ๋ํ๋ก๋ถํฐ ์ป์ด์ฌ ๋ ์ฌ์ฉํฉ๋๋ค.
โข RecvAsync() ํธ์ถ์ ์ด๋ฏธ ๋ค๋ฅธ Executor ๊ฐ ํด๋น ๋
ธ๋๋ฅผ ๋ฑ๋กํด ๋์๋ค๋ฉด ๋ฐ๋ก ๋ฐ์ดํฐ๋ฅผ ์ป์ด์ต๋๋ค.
I nt r aPr ocess
Rendezvous
Send( )
RecvAsync( )
l ocal
Local RendezvousI mpl Rendezvous
Send( )
RecvAsync( )
30. Device ์ฌ์ด์ ๋ฐ์ดํฐ ์ ๋ฌ
โข ์์ ์ดํด๋ณด์์ง๋ง ๊ฐ๊ฐ์ ๊ทธ๋ํ๋ device ๋จ์๋ก ๋๋์ด์ง๋๋ค.
โข ๊ทธ๋ํ๊ฐ ์๋ก ์ฃผ๊ณ ๋ฐ๋ ๋ฐ์ดํฐ๋ send์ recv ๋
ธ๋์ ์ํ Tensor ํ์
์ ์๋ฃ๊ตฌ์กฐ์
๋๋ค.
โข ์ฌ๊ธฐ์ Tensor๋ ์ฐจ์(dimension) ์ ๋ณด๋ฅผ ๊ฐ์ง ๋ฉ๋ชจ๋ฆฌ ๋ฐ์ดํฐ ๋ธ๋ก์
๋๋ค.
โข ์๋ก ๋ค๋ฅธ device ์ฌ์ด์ ๋ฐ์ดํฐ ๋ณต์ฌ๋ ์ด๋ป๊ฒ ํด์ผ ํ ๊น์?
โข Device ๋ผ๋ ๊ฐ์ฒด์๋ ์์ ์ Device ํ์
๊ณผ ๋ฉ๋ชจ๋ฆฌ ํ ๋น์ฉ Allocator๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
โข InterProcessRendezvous ๊ฐ์ฒด์์ Device ํ์
์ ์กฐํํ์ฌ ์ ์ ํ Copy ํจ์๋ฅผ ํธ์ถํด ์ค๋๋ค.
CPU GPUCPU CPU GPUGPU
31. ์๋ธ ๊ทธ๋ํ์ ์คํ
โข Executor๊ฐ Graph๋ฅผ ์คํํ๋ค๊ณ ํ๋๋ฐ ๋๋์ฒด ๋ญ ์คํ์ํค๋ ๊ฑธ๊น์?
โข ์ฌ์ค ํ๋์ ๋
ธ๋๋ ํ๋์ Operation์ ์๋ฏธํ๊ฒ ๋ฉ๋๋ค.
โข ๊ทธ๋ฆฌ๊ณ ์ด Operation์๋ ์ ์ ํ ์ฐ์ฐ๋ค์ด ์ ์๋์ด ์์ต๋๋ค.
โข ์
์ถ๋ ฅ ๋ฐ์ดํฐ๋ Operation์ ์ค์ ๋ Tensor ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
โข ๋์ผํ ์ฐ์ฐ์ด๋ผ๋ Device ์ ๋ฐ๋ผ ๊ตฌํ์ด ๋ฌ๋ผ์ง ์ ์์ต๋๋ค.
โข ์๋ก CPU ์ GPU ํ๊ฒฝ์์ add ์ฐ์ฐ์ ๊ตฌํ์ ๋ค๋ฆ
๋๋ค.
32. Operation
โข ๋
ธ๋์ ์ค์ ๋ ์ค์ ์คํํด์ผ ํ ์์
์
๋๋ค.
โข ์ฌ์ฉ์๊ฐ ์ง์ Operation ์ ์ถ๊ฐํ ์๋ ์์ต๋๋ค. (TensorFlow Tutorial ์ฐธ๊ณ )
โข ์ํฉ์ ๋ฐ๋ผ Device ๋ณ Operation์ ์์ฑํด์ผ ํ๋๊ฒ ์ผ๋ฐ์ ์
๋๋ค.
โข ๊ทธ๋ฆฌ๊ณ ํน์ ํ Device ์์๋ง ๋์ํ๋ Operation ์ Kernel ์ด๋ผ๊ณ ํฉ๋๋ค.
โข Op๋ Math ์ฐ์ฐ์ ์ํ Op์ Control Flow๋ฅผ ์ํ Op๋ก ๋๋ ์ ์์ต๋๋ค. (์ฌ์ค์ ๋ ์์ด์.)
โข ์ด ์ค Math์ฐ์ฐ์ ์ํ ๊ธฐ๋ฅ์ TensorFlow๋ ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํฉ๋๋ค.
โข CPU : ์ ํ๋์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ Eigen์ ์ฌ์ฉํฉ๋๋ค.
โข GPU : Cuda ๋ผ์ด๋ธ๋ฌ๋ฆฌ (Cublas/CuDNN/CuFFT ํน์ Cuda Kernel)๋ Eigen ์ ์ฌ์ฉํฉ๋๋ค.
34. TensorFlow ๋ถ์ฐ ๋ฒ์
โข 2016๋
3์์ TensorFlow ๋ถ์ฐ ๋ฒ์ ์ด์์ด ๊ณต๊ฐ๋์์ต๋๋ค.
โข gRPC๋ฅผ ์ด์ฉํ ๋ถ์ฐ ๋ฒ์ ์
๋๋ค.
โข ์์ง ์ด๊ธฐ ๋ฒ์ ์ด๋ผ ๋ณ๊ฒฝ ์ฌํญ์ด ์์ฃผ ๋ง์ต๋๋ค.
โข ์ฌ๊ธฐ์๋ ์์ฃผ ๊ฐ๋ต์ ์ธ ๊ฐ๋
๋ง์ ์ดํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
35. gRPC
โข ๊ตฌ๊ธ์ด ๋ง๋ RPC ํ๋กํ ์ฝ์
๋๋ค. (http://www.grpc.io/)
โข ๊ธฐ์กด RPC ๋ฐฉ์๊ณผ๋ ์ฝ๊ฐ ๋ค๋ฆ
๋๋ค.
โข ์
์ถ๋ ฅ ์๋ฃํ์ผ๋ก protocol buffer ๋ฐ์ดํฐ ํ์
์ ๋ฐ์ต๋๋ค.
โข ํจ์ ์ ์ธ์ protocol buffer message ๋ก ์ ์ํฉ๋๋ค.
โข ์ค์ ๋คํธ์ํฌ ํ๋กํ ์ฝ์ SPDY (HTTP2.0)๋ฅผ ์ฌ์ฉํฉ๋๋ค.
37. GrpcServer
โข GrpcServer๋ ๊ทธ๋ํ ์ฐ์ฐ Process ์์ ์ ์ ์ด๋ฏธ ๊ฐ ์ฅ๋น์์ ๊ตฌ๋๋์ด ์์ด์ผ ํฉ๋๋ค.
โข Binary ๋ช
๋ น์ด๋ก ์คํํ ์๋ ์๊ณ , python ์ฝ๋๋ก๋ ๊ตฌ๋ ๊ฐ๋ฅํฉ๋๋ค. (Binary ๋ ์จ๊ฒจ์ ธ ์์ด์.)
Mast er
ser vi ce
Mast er St ubRPC Wor ker St ub RPC
Wor ker
ser vi ce
Gr pcSer ver
Local Devi ce I nf o
38. Distributed Computation Graph
โข Client : Master๋ก GraphDef ๊ฐ์ฒด๋ฅผ ์ ์กํฉ๋๋ค.
โข Master : Graph ๊ฐ์ฒด๋ฅผ ๊ตฌ์ฑํ๊ณ ๋ถํ ํ์ฌ Worker์๊ฒ ์ ๋ฌํฉ๋๋ค.
โข Worker : ๋ก์ปฌ ๋จธ์ ์์ ์ฒ๋ฆฌํ ๊ฒ๊ณผ ๋์ผํ๊ฒ Graph ๋ฅผ ์ฐ์ฐํฉ๋๋ค.
Cl i ent
Gr pcRemot eMast er
st ub
Mast er 0
Gr pcMast er Ser vi ce
st ubRPC
Gr aphDef
Mast er Sessi on
gr pc_sessi on Wor ker 0
Gr pcRemot eWor ker
st ub
Gr pcWor ker Ser vi ce
st ub
Wor ker 1
Gr pcWor ker Ser vi ce
st ub
RPC
RPC
Gr aphDef
Gr aphDef
Gr aphDef
39. Cluster example
ember
Gr pcSer ver
ember 0: : 2222
/ j ob: ember / t ask0
pol y
Gr pcSer ver
pol y0: 2222
/ j ob: pol y/ t ask0
ember cpu: 0
gpu: 0
gt x980
gpu: 1
gt x980
pol y cpu: 0
gpu: 0
t i t an x
gpu: 1
t i t an x
41. ๊ทธ๋ํ ์ ๋ฌ
[๋ง์คํฐ ์๋ฒ]
1. SimplePlacer๋ก ๊ฐ ๋
ธ๋์ ๋๋ฐ์ด์ค ํ ๋น
2. Task ์๋ฒ ๋จ์ ํํฐ์
๋ (recv, send ์์)
3. ์์ฑ๋ GraphDef ๋ฅผ ๊ฐ task ์๋ฒ์ ์ ๋ฌ
[์์ปค ์๋ฒ]
1. Task ์๋ฒ์์๋ ๊ฐ ๊ทธ๋ํ ๊ฐ๋ณ ์คํ
2. ๊ฒฐ๊ณผ ๋ฐํ
44. ๋ค์์ ๋ ๋ง๋์ : Replicated Training
Synchronous data parallelism Asynchronous data parallelism Shared variables between different graphs