35
Accelerating Applications using HPC Server 2008 Ming Xu Principal Program Manager Microsoft Corporation SVR01

Accelerating Applications using HPC Server 2008

  • Upload
    malini

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

SVR01. Accelerating Applications using HPC Server 2008. Ming Xu Principal Program Manager Microsoft Corporation. Serial vs. Scale-out Execution 3 minutes vs. 7 seconds. video. Session Objectives and Take- aways. Objectives Categorize HPC Application Patterns & Solutions - PowerPoint PPT Presentation

Citation preview

Page 1: Accelerating Applications using HPC Server 2008

Accelerating Applications using HPC Server 2008

Ming XuPrincipal Program ManagerMicrosoft Corporation

SVR01

Page 2: Accelerating Applications using HPC Server 2008

Serial vs. Scale-out Execution3 minutes vs. 7 seconds

video

Page 3: Accelerating Applications using HPC Server 2008

Session Objectives and Take-aways> Objectives

> Categorize HPC Application Patterns & Solutions

> Introduce HPC SOA Programming Model> Leverage HPC Server 2008 to scale-out

workstation applications

> Take-aways> HPC Server reduces time-to-solution> Application performance model and fine-

tune skills

Page 4: Accelerating Applications using HPC Server 2008

Asian Option Price Spreadsheet

// From Simon Benninga’s Book// “Financial Modeling” for (col = 0; col < 10; col++) for (row = 0; row < 10; row++) { Cell[row, col] = PriceAsianOption(…); Calculate average/stddev }

10rows

10 columns

PriceAsianOptions(…) contains 1,000,000 * 20 calculations

NoInter-loopdependency

Page 5: Accelerating Applications using HPC Server 2008

Asian Option Pricing algorithm

Asian Option• 20 periods’ pay-off• stock’s up/down determined by mean and volatility

• u – up price jump• d - down price

jump 

Asian Option Pricing Algorithm Stock price

1. Using Monte-carlo simulation

to generate sample paths for a

stock S, P is the probability for

the stock to go down•   rand var > P: S up• rand var<= P: S

down

2. Calculate payoff• up: payoff += S * u• down: payoff -= S* d

3. Repeat 1 and 2 1M times and calculate the average payoff

4. Use risk-neutral rate to discount the Asian Option payoff: price = payoff / Rn

Page 6: Accelerating Applications using HPC Server 2008

Asian Option Pricing Algorithm1. Using Monte-carlo

simulation to generate sample paths for a stock S, P is the probability for the stock to go down

•   rand var > P:S up

• rand var<= P: S down

2. Calculate payoff• up: payoff += S *

u• down: payoff -=

S* d3. Repeat 1 and 2 N

times and calculate the average and payoff

4. Use risk-neutral rate to discount the Asian Option payoff:

price = payoff / Rn

Code: Monte Carlo Pricing// Randomly generate 1000,000 pathsfor (int index = 0; index < 1000000; index++){ double sumPricePath = initial; // generate a path of 20 periods for (int i = 1; i <= 20; i++){ pricePath[0] = initial; double rn = rand.NextDouble(); if (rn > pidown){ pricePath[i] = pricePath[i - 1] * up; } else{ pricePath[i] = pricePath[i - 1] * down; } sumPricePath += pricePath[i]; } priceAverage = sumPricePath / (periods + 1); callPayOff = Math.Max(priceAverage-exercise, 0);  temp += callPayOff;}temp /= runs; // average payoffreturn temp / Math.Pow(interest, periods);

Page 7: Accelerating Applications using HPC Server 2008

Monte Carlo Serial App

Ming XuPrincipal Program ManagerHPC

demo

Page 8: Accelerating Applications using HPC Server 2008

Windows HPC Server 2008• Complete and integrated platform for computational

clustering• Built on top of the proven Windows Server 2008

platform• Integrated development environment, Visual StudioWindows Server

2008 HPC Edition

• Secure, Reliable, Tested

• Support for high performance hardware (x64, high-speed interconnects)

HPC Pack 2008

• HPC SOA Platform• Job Scheduler• Cluster Management• Message Passing

Interface

Microsoft Windows HPC Server 2008

• Integrated Solution out-of-the-box

• Leverages investment in Windows administration and tools

• Makes cluster operation easy as a single box

Available from http://www.microsoft.com/hpc

Page 9: Accelerating Applications using HPC Server 2008

Parallel Programming Concepts

> Tightly Coupled

> Loosely-coupled

> Compute-driven/loop parallelfor (i = 0; i< 1000, i++)

{ … }> Data-driven/data-

parallelvar results = from baby in babies

where baby.Name == queryName &&

baby.State == queryState &&

baby.Year >= yearStart &&

baby.Year <= yearEnd orderby baby.Year ascending select baby;

Relationship amongProcessing Elements

Program Structure

Page 10: Accelerating Applications using HPC Server 2008

HPC Application Patterns

Tightly-coupled Loosely-coupledRelationship

AmongProcessingElements

ProgramStructure

Data-drivendata-parallel

Compute-drivenLoop-parallel

SearchData-mining

Seismic

CrashSim

Structure Analysis

Weather

SolutionsPLINQ (Multi-core)Dryad-LINQ (Scale-out)

SolutionsTPL (Multi-core)HPC SOA (Scale-out)Parametric Sweep jobs (Scale-out)

SolutionsOpenMP (Multi-core)MPI (Scale-out)

Focus of this session

Real-timeRiskVaR

Excel UDF

Actuarialprocessing

DerivativeProduct pricing

DCC RenderingGenetic algorithms

Gene Sequencing

Page 11: Accelerating Applications using HPC Server 2008

HPC SOA API

Excel Calculation Scale-out

Asian Option Pricing Algorithm1. Using Monte-carlo simulation to

generate sample paths for a stock S, P is the probability for the stock to go down

•   rand var > P: S up• rand var<= P: S down

2. Calculate payoff• up: payoff += S * u• down: payoff -= S* d

3. Repeat 1 and 2 N times and calculate the mean payoff

4. Use risk-neutral rate to discount the Asian Option payoff:

price = payoff / Rn

Parallel invocations

Visual Studio Tools for Office

Page 12: Accelerating Applications using HPC Server 2008

FAQs

1. Which distributed computing framework to use?2. How to host the calculation logic on the compute

nodes?3. How do I invoke the calculation remotely?4. How do I debug my services on the compute nodes,

printf()?5. Remote invocations incur high overhead, do you

have any performance tips?6. When I move to the cloud, do I have to use a new

API?

Page 13: Accelerating Applications using HPC Server 2008

Windows Communication Foundation

Client Service

MessageABC A B C

A B C

Address Binding Contract(Where) (How) (What)

Page 14: Accelerating Applications using HPC Server 2008

Scenario: build to run

Visual Studio

Build Deploy

Client

Service DLLs

Package Run

Developers Administrators

Dev / Testenvironment

Production environment

Users

Install

CopyService DLLs

Register

Service

Service Deployment

Page 15: Accelerating Applications using HPC Server 2008

Options for Service Deployment

service

DLLs

service

DLLs

service

DLLs

service

DLLs

service

DLLs

文件服务器

Local DeploymentService DLLs on the local drives

High PerfHard to update

Often used for ISV apps

Central DeploymentService DLLs on central file servers

Easy to updatePerf limited to the file server scalability

Often used for in-house apps

service

DLLs

File server

service

DLLs

Hybrid DeploymentFrequently updated dlls on central serverOther dlls on local drives

Often used for apps that use ISV’s services as well as in-house services

File server

service

DLLs

service

DLLs

service

DLLs

Page 16: Accelerating Applications using HPC Server 2008

A Hello-world example

Ming XuPrincipal Program ManagerHPC

demo

Page 17: Accelerating Applications using HPC Server 2008

Coding SummaryIt’s Easy>Established SOA Platform – WCF & tools

support>Add service reference makes service data

types & methods available to an application with just a few clicks

>Streamlined debugging>Yes, I don’t have to worry about where

these services run or how to talk to them individually

Page 18: Accelerating Applications using HPC Server 2008

Client

Broker Node

Compute

Node

Compute

Node

Compute

Node

Head Node

Architecture Overview

JobScheduler

NodeMgr

. . .

NodeMgr

NodeMgr

ServiceInstanc

e

ServiceInstanc

eServiceInstanc

e

ServiceInstanc

eServiceInstanc

e

ServiceInstanc

e

1. Create Session

2. Launch Services

2. Launch Broker

Broker3. Service Calls

Future: Service instances in the cloud

Page 19: Accelerating Applications using HPC Server 2008

Scale-out Asian Option Pricing Application

Ming XuPrincipal Program ManagerHPC

demo

Page 20: Accelerating Applications using HPC Server 2008

Broker

How can the solution span code developed in different languages and frameworks?

HTTPNetTcp

Custom

HpcServiceHost

WCF Wrappper Service

Native DLL

CustomService

Page 21: Accelerating Applications using HPC Server 2008

A Performance Problem DiscussionCustomer: how come my HPC SOA application doesn’t

perform? The machines’ utilization is less than 80%

Solution Specialist: what’s the message size per service call, what’s the measured throughput?

Customer: about 16k & 700 msgs/secSolution Specialist: What’s the service call duration?Customer: 2 secondsSolution Specialist: how many cores are you

requesting?Customer: 2000 Solution Specialist: let me do the math…oh, you’ve

exceeded your sustainable service instances (SSI)Customer: what’s S.S.I?

Page 22: Accelerating Applications using HPC Server 2008

Round-trip latency

1 2 4 8 16 32 64 128

256

51210

2420

4840

9681

9216

384

00.20.40.60.8

11.21.41.6

SOA Pingpong, Small Message Latency

WSDIPoIBGige

Message Size ( bytes )

Roun

d Tr

ip L

aten

cy (

ms

)

Page 23: Accelerating Applications using HPC Server 2008

Service Call ProfilingNumber ofServiceInstances

Call Duration )

N

1

The Nth service instance: Start processing 1st call

End processing 1st callStart processing 2nd call

End processing 2nd callThe sloperepresentsthe throughput(# msgs / sec)

Determined by

1. Client/Broker node capability2. Message size

time

234

Page 24: Accelerating Applications using HPC Server 2008

Sustainable Service InstancesNumber ofServiceInstances (N)

Call Duration

SustainableServiceInstances ( S )

N <= SHigh Node Utilization

N > SLow Node Utilization

time

S = throughput * call_duration

Page 25: Accelerating Applications using HPC Server 2008

How to explain the customer’s problem?The measured throughput for 16k messages on customer’s

broker machine:

Throughput = 700 msgs / second

Call duration = 2 secondsSustainable Service Instances = 700 * 2 = 1,400 The session requests 2,000 cores

The session uses (1400 / 2000 = 0.7) 70% of the allocated cores

Buying a faster broker node can be a solution but

are there any other options?

Page 26: Accelerating Applications using HPC Server 2008

Scalability Tips> Increase call granularity> Reduce message size

> Call-by-reference> Only send pointers to the data NOT the data

itself> Let services (with bigger pipes) load the data

> Avoid sending common, shared data per service call> Use Data Cache Servers to store forward large

data

Page 27: Accelerating Applications using HPC Server 2008

An Example Architecture

Page 28: Accelerating Applications using HPC Server 2008

What’s new in HPC Server 2008 R2> In Beta 1 now!

http://connect.microsoft.com> New fire-and-recollect programming

model> Service finalization hooks> Improved Java interoperability> Automatic restart and failover of

broker nodes> Improved management, monitoring,

diagnostics and debugging

Page 29: Accelerating Applications using HPC Server 2008

File & Recollect // Service Application

[ServiceContract] public interface IService1 { [OperationContract] string Echo(string); }  class Service1 : IService { public string Echo (string input) { return Environment.MachineName + ":" + input; } }

InteractiveConnectedapplicatio

ns

request

response

Client Process (Send

requests)

request

Client Process

(Get responses

)response

HPCSvr 2008

R2

Request &reply

Fire &Recollect

Come to our booth and we’ll show you a demo

Page 30: Accelerating Applications using HPC Server 2008

Summary Which Distributed Computing Framework to use?

WCF – the framework and tools support How do I host service on compute nodes

HPC Service deployment (compute-node, central and hybrid modes)

How to invoke remove methods? Async method invocation or SendRequests()/GetResponses() –

new in R2 How to debug services on the compute nodes

Using VS HPC SOA debugger add-in Remote invocation is higher, do you have any performance tips

Use SSI to measure your performance goal Right granularity, reduce message sizes

Do I have to use a new API when moving to the cloud? No, we preserve your investment in HPC Server

Page 31: Accelerating Applications using HPC Server 2008

Parallel Computing and PDC09> Overview

> FT07: The State of Parallel Programming> WKSP08: Patterns of Parallel Programming

> Managed code in Visual Studio 2010> FT03: Manycore and .NET 4: A Match Made in Visual Studio 2010> FT21: PLINQ: LINQ, but Faster!> FT20: F# for Parallel and Asynchronous Programming

> Native code in Visual Studio 2010> SVR18: Developing Applications for Scale-Up Servers Running Windows Server 2008 R2> SVR10: Lighting up Windows Server 2008 R2 Using the ConcRT on UMS> FT19: C++ Forever: Interactive Applications in the Age of Manycore

> HPC Server> SVR01: Accelerating Applications Using Windows HPC Server 2008

> Research and Incubation> VTL02: Axum: A .NET Language for Safe and Scalable Concurrency> VTL32: Concurrency Fuzzing & Data Races> SVR17: Data-Intensive Computing on Windows HPC Server with DryadLINQ> VTL04: Rx: Reactive Extensions for .NET> FT36: Future of Garbage Collection

Page 32: Accelerating Applications using HPC Server 2008

Track Resources> This session on Video

> http://channel9.msdn.com/shows/The+HPC+Show/ Look for “Windows HPC WCF Integration Part 1-4

> Microsoft HPC 2008 R2 Web site – download Today!> http://connect.microsoft.com

> Windows HPC Community site> http://www.windowshpc.net

> Windows Server x64 information> http://www.microsoft.com/x64/

> Windows Server System information> http://www.microsoft.com/windowsserver

> Get the Facts Web site> http://www.microsoft.com/getthefacts

Page 33: Accelerating Applications using HPC Server 2008

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 34: Accelerating Applications using HPC Server 2008

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 35: Accelerating Applications using HPC Server 2008