More Related Content Similar to 박기헌 NDC12 초보 클라이언트 프로그래머의 병렬 프로그래밍 도전기 Similar to 박기헌 NDC12 초보 클라이언트 프로그래머의 병렬 프로그래밍 도전기 (20) 박기헌 NDC12 초보 클라이언트 프로그래머의 병렬 프로그래밍 도전기4. 왜 멀티가 코어가 대세인가?
- “2011년에는 10GHz CPU가 나올 것!”
- 하지만 소비 전력과 발열 문제로 인해 현실적인 한계에 부딪힘.
결국 코어를 늘리는 방법으로 선회.
5. 멀티 코어의 성능은?
- 싱글 스레드의 성능 향상은
한계에 달했다.
- 매년 2배씩 성장하던 성능은
2000년 초반을 기준으로
이제는 5년간 2배 향상도 간당
간당 하다.
11. CORE1 CORE2 CORE3 CORE4
DATA1 DATA2 DATA3 DATA4
DATA
15. Single Instruction Single Data
Load A1 Load A3
Load B1 Load B3
C1 = A1 + B1 C3 = A3 + B3
Store C1 Store C3
Load A2
Load B2
C2 = A2 + B2
Store C2
21. Main Thread Loader Thread
Resource List Resource Queue Load From Disk
30. 직렬 루프 / 병렬 루프 FPS 비교(Debug)
180
160
140
120
100
FPS
80 직렬
병렬
60
40
20
0
1042 3516 6510 9547
개체수
31. 직렬 루프 / 병렬 루프 FPS 비교( Release )
300
250
200
FPS
150
직렬
병렬
100
50
0
1042 3516 6510 9547
개체수
32. 직렬 루프 / 병렬 루프 FPS 비교( Release )
25
20
15
FPS
직렬
10
병렬
5
0
1042 3516 6510 9547
개체수
35. 어떤 결과가 나올지 예측하기 힘들다
Thread 1 t=x u=x t=x
(x=0) (x=0) x=t+1
t=x u=x t=x (x=1)
x=t+1 x=u+2 x=t+1 u=x
( x = 2) ( x = 1) x=u+2
x=t+1 x=u+2 ( x = 3)
Thread 2
(x=1) (x=2)
u=x
x=u+2
40. for( int i = 0; i < N; ++i )
A[ i ] = A[ i ] + 1;
A[ 0 ] = A[ 0 ] + 1;
A[ 1 ] = A[ 1 ] + 1;
A[ 2 ] = A[ 2 ] + 1;
A[ 3 ] = A[ 3 ] + 1;
A[ 4 ] = A[ 4 ] + 1;
.
.
.
42. for( int i = 1; i < N; ++i )
A[ i ] = A[ i - 1 ] + 1;
A[ 1 ] = A[ 0 ] + 1;
A[ 2 ] = A[ 1 ] + 1;
A[ 3 ] = A[ 2 ] + 1;
A[ 4 ] = A[ 3 ] + 1;
A[ 5 ] = A[ 4 ] + 1;
.
.
.
48. 사용되지 않은
데이터 캐싱
캐시 미스
iCache - 600 m_vPosition - 600 m_fMod - 600 Cal - 20 m_vDirection - 100
iCache - 600 m_vPosition - 600 m_fMod - 600 Cal - 20 m_vDirection - 100
7680 Cycles
iCache - 600 m_vPosition - 600 m_fMod - 600 Cal - 20 m_vDirection - 100
iCache - 600 m_vPosition - 600 m_fMod - 600 Cal - 20 m_vDirection - 100
51. iCache - 600 pAimData->vPosition - 600 pAimData->fMod - 600 Cal - 20 fDirection - 100
Cal - 20
Cal - 20
1980 Cycles
Cal - 20
57. GameObject Hama
GameObejct Data
Renderable
Renderable Data
Movable Data
Movable Tree
Hama Data
Hama Crow
59. Hama
GameObject
Renderable Physics
Component
Movable StabKnife
Targetable
60. Movable Comp Manager
Movable Comp Movable Comp Movable Comp …
Targetable Comp Manager
Targetable Targetable Targetable
…
Comp Comp Comp
Physics Comp Manager
Physics Comp Physics Comp Physics Comp …
.
.
.
69. Special Thanks
꽃미남 포프님, 대마왕님, 개불형, 오즈형, 창희형, 달땡땡, 끼로, 퐁퐁퐁, 레아횽, H님, 진짜 선생님,
죠쉬형, 비토님, 민영님, 여고생 프로그래머 진주, 프로그래머 남편 구한다는 진아와 팬클럽 회장 재원
71. 참조
• 프로그래머가 몰랐던 멀티코어 CPU 이야기 by 김민장 저
• Intel Threading Building Block Documents
• Multiprocessor Game Loops Uncharted 2 by NaughtyDog 발표 자료
• Practical SPU Programming in God of War 3 by Sony Santa Monica
• BattleField 3 by Dice 발표 자료
• A Look Back at Single-Threaded CPU Performance
• 병렬 프로그래밍, 어디까지 왔나?
• Matrix-vector multiplication
• MLAA: Efficiently Moving Antialiasing from the GPU to the CPU
• Introduction to Parallel Computing
• Pitfalls of Object Oriented Programming by SCEE
…and Google Image Search