Dr M Rajasekhara Babu Vellore Institute of Technology (VIT) Vellore-632014, Tamil Nadu, India Outline Session objectives
Guided Schedule syntax
Model to assign iterations to each thread
When to use which scheduling clause?
Summary
Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 2
Objectives To provide knowledge on Guided scheduling clause
To understand working model
of Guided scheduling clause to assign iterations to each thread
To explore the context to used
type of scheduling clause
Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 3
List of Scheduling Clauses Schedule clauses • The three main scheduling clauses that are used to assign iterations to threads in the team are: – Static – Dynamic – Guided
Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 4
List of Schedule Clauses The Guided Schedule: Syntax The Guided Schedule • The syntax for the dynamic scheduling clause is: #prgma omp parallel for schedule(Guided [,chunk]) • The guided scheduling clause initially assigns iterations larger than the chunk size. • It starts with large blocks and assigns them to threads dynamically. • The assigned chunk size is decreased exponentially with each succeeding assignment until it reaches the chunk size specified. • The default chunk size is 1 Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 5 List of Schedule Clauses The Guided Schedule: Syntax, Model The Guided Schedule • For guided scheduling, partitioning of loop is done based on the following formula with a start value of α = number of loop iterations. • Where N is the number of thread, denotes the size of Kth chunk and denotes the size of remaining unscheduled loop iteration while computing the size of Kth chunk. 2 N • Where N is the number of thread • denotes the size of Kth chunk • denotes the size of remaining unscheduled loop iteration while computing the size of Kth chunk.
Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 6
List of Schedule Clauses The Guided Schedule: Syntax, Model The Guided Schedule • Where N is the number of thread, denotes the size of Kth chunk and denotes the size of remaining unscheduled loop iteration while computing the size of Kth chunk. • For example =800, N=2 and S=80, where S is chunk size. • The loop partition is T0200 (800/(2*2)), T1150 (600/(2*2)), T1113(450/((2*2)), T285(337/(2*2)), T180……….. Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 7 List of Schedule Clauses Which Schedule when to Use? The Guided Schedule: Syntax, Model Which schedule to use Scheduling Clause When to Use
Predictable and similar work per
Static iteration
Unpredictable, highly variable work
Dynamic per iteration
Special case of dynamic to reduce
Guided scheduling overhead
Scheduling decision to be made at
Runtime run time Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 8 Summary • List of Schedule Clauses – Static, Dynamic and Guided • The Guided Schedule – Syntax • #pragma omp paralle for schedule(Guided [,chunk]) 2 N
• Where, N is the number of threads
• denotes the size of Kth chunk • denotes the size of remaining unscheduled loop iteration while computing the size of Kth chunk – Iterations are then assigned to threads in a Guided manner • Which Schedule when to Use? Dr M Rajasekhara Babu, Vellore Institute of Technology (VIT)-Vellore Slide.# 9