optimizing memory layout of hyperplane ordering for vector ...€¦ · the proposed method involves...

24
Optimizing Memory Layout of Hyperplane Ordering for Vector Supercomputer SX-Aurora TSUBASA MCHPC’19: Workshop on Memory Centric High Performance Computing Osamu Watanabe 1,2 Yuta Hougi 1 Kazuhiko Komatsu 1 Masayuki Sato 1 Akihiro Musa 1,2 Hiroaki Kobayashi 1 1 Tohoku University, 2 NEC Corporation 18 th November, 2019

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Optimizing Memory Layout of Hyperplane Orderingfor Vector Supercomputer

SX-Aurora TSUBASA

MCHPC’19: Workshop on Memory Centric High Performance Computing

Osamu Watanabe1,2

Yuta Hougi1

Kazuhiko Komatsu1

Masayuki Sato1

Akihiro Musa1,2

Hiroaki Kobayashi1

1Tohoku University, 2NEC Corporation

18th November, 2019

Page 2: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

CONTENTS2

• INTRODUCTION

• NUMERICAL TURBINE CODE ON SX-Aurora TSUBASA

• OPTIMIZING MEMORY-ACCESS PATTERN OF 3D HYPERPLANE ORDERING METHOD

• PERFORMANCE EVALUATION

• CONCLUSIONS

Page 3: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

INTRODUCTION

3

Page 4: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

4

Various phenomena can be reproduced more realistically by large-scale simulations using supercomputer systems.

Backgrounds

There are still many issues to be addressed, and the impact of problems with social infrastructures (ex. gas and steam turbines) on our society is immeasurable.

Page 5: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

5

• Complex wet-steam flow field analysis is required, but

• the cost for experiments is expensive.

Numerical Turbine code using NEC SX-Aurora TSUBASA is the best solution.

http://www.mhi-global.com/

Demand for High Performance Turbine Simulation

Necessary to conduct a numerical simulationof a turbine using a supercomputer to simulate various phenomena occurring in the turbine in order to predict failures in advance.

Page 6: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

NUMERICAL TURBINE CODE ON SX-Aurora TSUBASA

6

Page 7: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

7Numerical TurbineHigh Performance Turbine Design Code on SX Systems

Numerical Turbine developed by Prof. Yamamoto of Tohoku University• is a simulation code realizing High-performance and High-reliable Future Turbines and• has been accelerated on the SX series of Cyberscience Center at Tohoku University.

Only Numerical Turbine has achieved the following simulations in the world.• Unsteady flows with wetness and shocks in actual gas turbines and steam turbines• Full annulus simulation for resolving unsteady wet-steam and moist-air flows in actual

turbines and compressorsResolving such complex flows is crucial for developing high-performance and high-reliable turbines

Gas turbine for plants Gas turbine for airplanes Steam turbine

Unsteady shocks generated in turbine stages

Unsteady wetness in full annuals turbine stages

Unsteady wet-steam flow in turbine stages

Page 8: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

• Space Difference of Convective and Pressure Terms• Roe’s Approximate Riemann Solver

( P.L.Roe, J.Comp.Phys., 1981 )• Compact MUSCL

( S.Yamamoto and H.Daiguji, Computer & Fluids, 1993)

• Viscous and Diffusion Terms• Second-order Central Difference

• Time Integration• LU-SGS Scheme

( S.Yoon and A.Jameson, AIAA Jurnal, 1988 )

• Turbulence Model• SST Turbulence Model

( F.R.Menter, AIAA Journal, 1994 )

Numerical Schemes8

Calculation of unknown variables

Updating of unknown variables

ITERATION START

Done?No

Space difference scheme

Physical models

Time integration

Boundary conditions(Data communications)

Yes

Flowchart of the Iteration Loop

Page 9: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

9

Hardware Specification of NEC SX-Aurora TSUBASA

core core

core core

core core

core core

LLC

8MB

LLC

8MB

HBM

2 I/

FH

BM2

I/F

HBM

2 I/

F

HBM

2 I/

FH

BM2

I/F

HBM

2 I/

F

HBM2

HBM2

HBM2

HBM2

HBM2

HBM2

PCIe

Vector Engine (VE) x86 Processor (Xeon)

Vector Engine Type 10BVector Cores 8

Frequency 1.4 GHz

Performance/core 537.6 GF (SP), 268.8 GF (DP)

Performance/processor 4.30 TF (SP), 2.15 TF (DP)

Cache Capacity 16 MB (shared)

Mem. Bandwidth 1.2 TB/s

Mem. Capacity 48 GB (HBM2 8GB x 6)

Long vector loop length is exploit the high performance of SX-Aurora TSUBASA.

Page 10: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

10

IMPLICIT2

EXPLICIT

BUNDSLID

TBMDL2

RESULT

VISCOUS

OTHERS

Calculation of unknown variables

Updating of unknown variables

ITERATION START

Done?No

Space difference scheme

Physical models

Time integration

Boundary conditions(Data communications)

Yes

Flowchart of the Iteration Loop Cost Distribution

Cost Distribution of Main Iteration Routines

The time integration routine (LU-SGS)is the most dominant.

Page 11: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Data Dependency on the LU-SGS Scheme11

q(i,j,k)

q(i,j,k-1)

q(i-1,j,k)q(i,j-1,k)

ij

k

• Numerical Turbine adopts the LU-SGS scheme for time-integration• Data dependency of q(i,j,k) on q(i-1,j,k), q(i,j-1,k) and q(i,j,k-1)

Multi-dimensional hyperplane method resolves this data dependency.

Page 12: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

2D and 3D Hyperplane Ordering12

2D Hyperplane 3D Hyperplane

Vector Length Memory Access2D Hyperplane Short Direct Access3D Hyperplane Long Indirect Access

The sum of i, j, and k (in case of 2D-HP, the sum of I and j) of each grid point on a hyperplane is the same value.

Page 13: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

13

2D Hyperplane vs. 3D Hyperplane

0

50

100

150

200

250

31 41 51 61 71 81 91 101 111 121 131 141

Ave

rage

vec

tor l

engt

h

Grid size

● 2D Hyperplane● 3D Hyperplane

Vector LengthPerformance on SX-Aurora TSUBASA

0

10

20

30

40

50

60

70

80

90

31 41 51 61 71 81 91 101 111 121 131 141

Perf

orm

ance

(GFL

OP/

s)

Grid size

● 2D Hyperplane● 3D Hyperplane

• Latency of the indirect accesses is high.• Some blips downward in performance occurs due to bank-conflict.

Need to reduce indirect memory accesses in order to extract more performance from SX-Aurora TSUBASA.

3D hyperplane provides long vector lengths. However…The method is accompanied by a high memory load with indirect memory accesses.

Page 14: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

OPTIMIZINGMEMORY-ACCESS PATTERN OF3D HYPERPLANE ORDERING METHOD

14

Page 15: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Changing 3D Data Layout to 1D Data Layout15

Direction of hyperplanes 計算方向

メモリアクセス方向

Direction of hyperplanes

Direction of memory access

Original 3D Data Layout Proposed 1D Data Layout

Indirect memory accesses

Sequential memory accesses

Page 16: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

1D Data Layout and Each Plane Number16

Original 3D Data Layout Proposed 1D Data Layout

When storing grid points in each 1D array, it is necessary to store the grid points on the boundary area on each hyperplane.

Direction of hyperplanes

Page 17: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

17

Source Code Image of Changing the Data Layout

Original 3D Hyperplane Proposed 3D Hyperplane

Vector Gather op. 228 162

Vector Scatter op. 20 0

DO LHP=1,LIST_3DC(M,L)I = LIST_3DI(LHP,M,L)J = LIST_3DJ(LHP,M,L)K = LIST_3DK(LHP,M,L)IM = LIST_3DA(I-1,J,K,L)…AIM = (A(M-1)%ARRAY(IM)*A(M)%ARRAY(LHP))*0.5D0…

ENDDO

DO LHP=1,LIST_3DC(M,L)I = LIST_3DI(LHP,M,L)J = LIST_3DJ(LHP,M,L)K = LIST_3DK(LHP,M,L)…AIM = (A(I-1,J,K)*A(I,J,K))*0.5D0…

ENDDO

Indirect Access

Indirect Access

Sequential Access

Code of Original 3D Data Layout

Code of Proposed 1D Data Layout

Number of Gather/Scatter Operations in Calculation Part

Reducing indirect memory accesses

Page 18: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

PERFORMANCE EVALUATION

18

Page 19: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Performance of The Proposed Method19

Perforance evaluation using Time-integration kernel codes.

Average: 1.27xMax : 2.77x faster than original 3D Hyperplane

Some blips downward in performance are reduced.

Page 20: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Cost Distribution of Data-copy and Calculation20

● Data copy time

● Calculation time

Calculation part performance: 123 ~146 Gflop/s

The proposed method involves data-copies (3D layout ⇔ 1D layout).

Reducing the data-copy time can further improve the performance.

Page 21: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Performance Improvement of Full App.21

• Numerical Turbine execution with 636 mpi• 91x91x181 grid points for each stator and rotor passage

0

200

400

600

800

1000

Original 2D-HP Original 3D-HP Proposed 3D-HP

Exec

utio

n Ti

me

(sec

)

IMPLICIT2 Others

1.32x faster

1.12x faster

1.66x faster

1.22x faster

Expandingvector length

Reducingindirect accesses

Page 22: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

CONCLUSIONS

22

Page 23: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

Conclusions and Future Work23

• The 3D Hyperplane ordering method is suitable for SX-Aurora TSUBASA because the method can provide long vector lengths.

• Our proposed 3D Hyperplane ordering method further improves the performance by reducing indirect memory accesses.

• Future work: examine the effect of the method on other applications and major SIMD architectures.

Page 24: Optimizing Memory Layout of Hyperplane Ordering for Vector ...€¦ · The proposed method involves data-copies (3D layout ⇔1D layout). Reducing the data-copy time can further improve

24

Thank you for your kind attention!