+ All Categories
Home > Documents > Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron...

Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron...

Date post: 01-Mar-2021
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
35
Improving Scalability of OpenMP Applications on Multi-core Systems Using Large Page Support Ranjit Noronha and Dhabaleswar K. Panda Network Based Computing Laboratory (NBCL) The Ohio State University
Transcript
Page 1: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Improving Scalability of OpenMP Applications on

Multi-core Systems Using Large Page Support

Ranjit Noronha and Dhabaleswar K. Panda

Network Based Computing Laboratory (NBCL)

The Ohio State University

Page 2: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Outline of the talk• Introduction and Motivation

• Potential Issues

• Experimental Evaluation

• Conclusions and Future Work

Page 3: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Page Table Architecture

Other unrelatedPMD PageFrames

pgd_offset pgd_t

mm_struct−>pgd Only 1pgd_tPageFrame

pmd_offset

pte_offset

pte_t

FramePage

pte_t

Other unrelated

FramesPTE Page

unrelated

Frames

Other

Data

Page FrameWith User Data

pgd_index

pmd_t PageFrame

Process PGD PMD Page FrameOffset within

PTE Page FrameOffset within

Offset within data frame

Linear (virtual) address

pmd_t

Offset within

•Page walk may take up to two memory accesses

•May be a substantial overhead

•TLB misses may be expensive

Page 4: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Processor Large Page Support

• Traditional page size is 4KB• Other page sizes

– 2MB, 4MB supported by Intel and AMD processors– Itanium supports a variety of sizes

• Benefits of large pages– Fewer TLB misses– Larger memory coverage

• Drawbacks of large pages– Fewer TLB entries– Page misses are more expensive

Page 5: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

TLB Coverage• TLB Entries for 4KB pages and

2MB are • generally separate

– Eg. Xeon has 128 entries for 4KBpages and 32 entries for 2MB pages

• Memory region under TLB coverage is affected

• For contiguous regions, large pages might provide benefit

• For non-contiguous regions, there might be increased TLB misses for large pages

010203040506070

Size

(MB

)Xeon Opteron

Processor

4KB 2MB

Page 6: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Introduction to OpenMP• OpenMP is a language specification

– Annotation of sequential C, C++ and Fortran programs. Annotations produce:

• Creation of thread teams• Execution in parallel

• Primitives for synchronization• Locks• Critical sections• Single threaded regions

• Primitives for variable sharing– Private or Shared– Variable initialization for Parallel Regions

Page 7: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

OpenMP and Large Pages• Loop Level Parallelism

– May use an array as a data structure– Large arrays may potentially span several 4KB pages– Each thread may work on a different portion of the array– More complicated access patterns

• Strided access such as FFT• Array of structures

– Access locality– Threads might experience several TLB misses– TLB misses are expensive

• DTLB and ITLB are shared in SMT’s– But large pages have fewer TLB entries

Page 8: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Motivation• Potential Strategies for providing large pages to

memory allocations to OpenMP applications• Are static or dynamic page allocations strategies

more appropriate• Are large pages beneficial for instruction footprints• Are large pages beneficial for application data

footprint• What is the impact of large pages on application

scalability on different processor architectures• Is there an impact of large pages when the TLB is

shared between hyperthreads

Page 9: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Potential Strategies for providing large pages

• OpenMP applications– Assumption of shared memory– Stack and heap variables allocations shared on a node– Stack and heap variables should use large pages

• Using large pages for stack variables– Need to modify the compiler

• Employing large pages for heap variables– Modify libc

• Deploy a memory mapped file– Allocate space for stack and heap variables from the memory mapped

file– Translate stack allocations to heap allocations – Omni/SCASH Cluster OpenMP performs this translation– Disable all Cluster OpenMP coherency features– Memory mapped file uses hugetlbfs for large pages

Page 10: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Page Allocation Strategies• Studies for large page allocation

– On demand– Contention from many processes

• Characteristics of OpenMP applications– Parallel codes– Likely to be only application on the node– Some OpenMP applications use only stack variables

(eg. NAS)– Static reservation of a pool of large pages likely an

acceptable tradeoff– Reduce complexity and latency of memory allocation

Page 11: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Outline of the talk• Introduction and Motivation

• Potential Issues

• Experimental Evaluation

• Conclusions and Future Work

Page 12: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Experimental Setup• Platform 1

– Dual dual-core (4-cores) Opteron 270 processors– 4GB memory– 2.0 GHz

• Platform 2– Dual dual-core (4-cores) Xeon based platform – Hyperthreading enabled (2threads/core or 8 threads totally)– 12GB memory– 3.2 GHz

• Applications– NAS OpenMP codes CG, SP, MG, FT and BT– Class B

Page 13: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Application Memory Footprint

884MB1.4MBMG (B)

387MB1.6MBSP (B)

2.4GB1.4MBFT (B)

725MB1.4MBCG (B)

371MB1.6MBBT (B)DataInstruction

•Instruction binary footprint are all less than 2MB•Data footprint much larger•ITLB coverage for instruction data is large with 4KB pages•Instruction locality high (most time spent in parallel loops)

Page 14: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Instruction TLB Misses

00.050.1

0.150.2

0.250.3

0.350.4

0.45

BT CG FT SP MGApplication

ITLB

Mis

ses/

Sec

ond

•ITLB misses/second of application time under 0.45 misses/sec•Not likely to a substantial source of overhead•We do not use large pages for instruction binaries

Page 15: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

System Scalability (CG)

050

100150200250300350400450

One Core Two Cores Four Cores EightHyperthreads

Number of threads

Tim

e (s

econ

ds)

Opteron-4KB Opteron-2MB Xeon-4KB Xeon-2MB

•25% improvement in performance at 4 threads (Opteron)

0

0.2

0.4

0.6

0.8

1

Opteron

DataTLB Misses

Page 16: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

System Scalability (SP)

0100200300400500600

One Core Two Cores Four Cores EightHyperthreads

Number of threads

Tim

e (s

econ

ds)

Opteron-4KB Opteron-2MB Xeon-4KB Xeon-2MB

• 20% improvement in performance at 4 threads on Opteron

0

0.2

0.4

0.6

0.8

1

Opteron

DataTLB Misses

Page 17: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

System Scalability (MG)

0

5

10

15

20

25

30

35

40

45

One Core Two Cores Four Cores EightHyperthreads

Number of threads

Tim

e (s

econ

ds)

Opteron-4KB Opteron-2MB Xeon-4KB Xeon-2MB

•17% improvement in performance at four threads on Opteron

0

0.2

0.4

0.6

0.8

1

Opteron

DataTLB Misses

Page 18: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

System Scalability (FT, BT)FT

050

100150200250

One Core Two Cores Four Cores EightHyperthreads

Number of threads

Opteron-4KB Opteron-2MB Xeon-4KB Xeon-2MB

BT

0

100

200

300

400

500

600

700

800

One Core Two Cores Four Cores EightHyperthreads

Number of threads

Opteron-4KB Opteron-2MBXeon-4KB Xeon-2MB

0

0.2

0.4

0.6

0.8

1

Opteron

•No significant impact from large pages

•Mainly because of the data distribution 0

0.2

0.4

0.6

0.8

1

Opteron

Page 19: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Data TLB Misses

00.10.20.30.40.50.60.70.80.9

1

BT CG FT SP MG

4KB2MB

Application

Page 20: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Conclusions and Future Work• Explored using large pages for OpenMP codes• 25% improvement at 4 threads on Opteron• Large Pages Improve Scalability of some NAS

OpenMP applications• Contention and Memory Bandwidth Limit with

hyperthreading limit improvement on the Intel Xeons• Explore using a mix of small and large pages• Use large pages for Cluster OpenMP applications

Page 21: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

21

Acknowledgements

Our research is supported by the following organizations

• Current Funding support by

• Current Equipment support by

Page 22: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

http://nowlab.cse.ohio-state.edu/

NBC home page

Web Pointers

[email protected]

Page 23: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Backup Slides

Page 24: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Introduction to OpenMP• OpenMP is a language specification

– Annotation of sequential C, C++ and Fortran programs. Annotations produce:

• Creation of thread teams• Execution in parallel

• Primitives for synchronization• Locks• Critical sections• Single threaded regions

• Primitives for variable sharing– Private or Shared– Variable initialization for Parallel Regions

Page 25: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Multi-core Architectures

Courtesy: Richard McDougall and James Laudon, “multi-core microprocessorsare here”, ;login: The USENIX Magazine, November 2006

•Dual-core AMD OpteronProcessors (type B)

•Sun UltraSPARC IV, Intel Woodcrest Processors (type C)

•Sun UltraSPARC T1 (type D)

Page 26: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Multi-threaded Processors• Coarse Grained

– Thread Owns the Pipeline– Switched out on a stall– Easy to implement (low complexity)– Poor performance

• Simultaneous Multithreading (SMT)– Instructions from multiple threads issued in a single clock cycle– Hyperthreading

• Vertical Threading (VT)– Instructions from the same thread issued in a single clock cycle– Sun UltraSPARC T1

Page 27: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Page Table Architecture

Other unrelatedPMD PageFrames

pgd_offset pgd_t

mm_struct−>pgd Only 1pgd_tPageFrame

pmd_offset

pte_offset

pte_t

FramePage

pte_t

Other unrelated

FramesPTE Page

unrelated

Frames

Other

Data

Page FrameWith User Data

pgd_index

pmd_t PageFrame

Process PGD PMD Page FrameOffset within

PTE Page FrameOffset within

Offset within data frame

Linear (virtual) address

pmd_t

Offset within

•Page walk may take up to two memory accesses

•May be a substantial overhead

•TLB misses may be expensive

Page 28: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Intra-node Communication• Reductions, barriers, etc.

– Need communication buffers– Buffers are small (typically < 1KB)

• SCASH uses Myrinet (through Score) for communication– Only need to use intra-node – Can be implemented through a shared buffer– Use 4KB pages (small communication)– Requires a copy– Communication queue depth of 32 1KB messages

Page 29: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Memory Protection• SCASH DSM uses page protection for coherency• Uses memory faults/handler to trap accesses• We only use Omni/SCASH on an intra-node system• Underlying hardware responsible for coherency• Setting memory protections and servicing the

handler adds considerable overhead• Not needed for an OpenMP application on a shared

memory system• Memory Protections disabled in our design

Page 30: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Processor TLB Sizes and Coverage

16MB64MBL2DTLB (2MB) Coverage

128KB512KBL2DTLB (4KB) Coverage--L2DTLB (2MB)

512-L2DTLB (4KB) Size

832L1DTLB (2MB) Size

32128L1DTLB (4KB) Size32128ITLB (4KB) SizeOpteronXeon

Page 31: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Scalability - FTFT

050

100150200250

One

Cor

e

Two

Cor

es

Four

Cor

es

Eigh

tH

yper

thr

eads

Number of threads

Tim

e (s

econ

ds)

Opteron-4KB Opteron-2MBXeon-4KB Xeon-2MB

Page 32: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Fork/Join Model

nested parallelism

0 master thread

farm ofthreads

0 1 2

n1n0 n2

n

0 implicit barrier

fork for parallel section

join

Page 33: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Improving the Scalability of OpenMP Applications

• Multi-core architectures are being widely deployed

• Chip level Multi-threading (CMT)– Opteron, Intel Xeon, Sun Niagra

• Simultaneous Multi-threading (SMT)– Intel Xeon and Sun Niagra

• CMT+SMT– Intel Xeon and Sun Niagra

Page 34: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

Application Memory Footprint

884MB1.4MBMG(B)

387MB1.6MBSP (B)

2.4GB1.4MBFT (B)

725MB1.4MBCG (B)

371MB1.6MBBT (B)DataInstruction

•Instruction binary footprint are all less than 2MB•Data footprint much larger•ITLB coverage for instruction data is large with 4KB•Instruction locality high (most time spent in parallel loops)

Page 35: Improving Scalability of OpenMP Applications on Multi-core … · 2014. 2. 7. · 0.6 0.8 1 Opteron DataTLB Misses. System Scalability (SP) 0 100 200 300 400 500 600 One Core Two

FT

050

100150200250

One

Cor

e

Two

Cor

es

Four

Cor

es

Eigh

tH

yper

thre

ads

Number of threads

Tim

e (s

econ

ds)


Recommended