preliminary experiences with the uintah framework on on ... · preliminary experiences with the...

30
Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project (97-10), DOE NETL, DOE NNSA NSF for funding via SDCI and PetaApps Thanks to: TACC Team for early access to Stampede J. Davison de St. Germain, Justin Luitjens and Steve Parker Qingyu Meng, Alan Humphrey, John Schmidt, Martin Berzins

Upload: others

Post on 29-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Preliminary Experiences withthe Uintah Framework on

on Intel Xeon Phi and Stampede

DOE for funding the CSAFE project (97-10), DOE NETL, DOE NNSANSF for funding via SDCI and PetaApps

Thanks to: TACC Team for early access to StampedeJ. Davison de St. Germain, Justin Luitjens and Steve Parker

Qingyu Meng, Alan Humphrey, John Schmidt, Martin Berzins

Page 2: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Current and Past Uintah Applications

Shaped ChargesFires

Explosions

Foam Compaction

Angiogenesis

Sandstone Compaction

CPU pins

Coal Boiler

Virtual Soldier

Gas mixing

Page 3: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Example: MPM-ICE AlgorithmMetal containers embedded in large hydrocarbon fires.

• ICE is a cell-centered finite volume method for Navier Stokes equations• ICE now handles fast and slow flows (2009)

• MPM is a novel method that uses particles and nodes• Cartesian grid used as a common frame of reference

•MPM (solids) and ICE (fluids) exchange data several times per timestep, not just boundary condition exchange.

Container with PBX explosive

Page 4: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Structured Grid(Flows) + Particles System(Solids)Patch-based Domain Decomposition for Parallel ProcessingAdaptive Mesh RefinementDynamic Load Balancing

Profiling + Forecasting ModelParallel Space Filling CurvesData Migration

Uintah uses both data and task parallelism

Grid and Patches(Physical Domain)

Uintah Parallelism (Data)

Page 5: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah Parallelism (Task)

Uintah Task – serial code w/o MPI/thread on a generic patch

Require Variable(s) with ghost cellsCompute Variable(s)Call-back Function

Separation of user code and parallelism Framework automatically generate MPI messagesEasy to switch/combine multiple algorithms

Tasks (Simulation Methods)

Uintah uses both data and task parallelism

Page 6: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

How Uintah Works

TG Compile(when needed)

Run Time(each timestep)

xml

Parallel I/O

Page 7: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah Task GraphIntermediate representation for Uintah runtime systemDistributed: only creates detailed tasks on local and neighboring patchesCompiled by the framework Internal dependencies->Edges

External dependencies->MPI message tags4 patches single level ICE task graph

Page 8: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah Runtime System:How Uintah Runs Tasks

Memory Manager: Uintah Data Warehouse (DW)Variable dictionary (hashed map from: Variable Name, Patch ID, Material ID keys to memory)Provide interfaces for tasks to– Allocate variables – Put variables into DW – Get variables from DW

Automatic Scrubbing (garbage collection)Checkpointing & Restart (data archiver)

Task Manager: Uintah schedulersDecides when and where to run tasksDecides when to process MPI

Page 9: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Hybrid Thread/MPI Scheduler (De-centralized)

No control thread: All threads directly pull tasks from task queues, thread-safety required for all data structureFully Overlapping: All threads process MPI sends/receives/collective and execute tasks, mpi_thread_multiple, multiple communicators requiredUse lock-free data structure to avoid locking overhead

Running Task

Netw

ork

Lock-freeData

Warehouse

PUT

GET

Running Task

Running Taskcompleted task

Task Queuessatisfied task

completed task

Threads

Shared Data

Ready task

sends

receives

TaskGraph

PUT

GET

MPIData ready

Page 10: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah Scalability

16 32 64 128 256 512 1K 2K 4K 8K 16K 32K 64K 128K256K10

0

101

Mea

n T

ime

Per

Tim

este

p (s

) Cores

AMR MPMICE: Scaling

StrongWeak

• Ability to run large simulations (MPI-only runs out-of-memory) • Achieve much better CPU Scalability • 95% weak scaling efficiency on 256K cores on Titan

Page 11: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah Scaling on Titan, Mira, Stampede

2-Level RMCRT AMR MPMICE

Page 12: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Emergence of Heterogeneous Systems

Motivation - Accelerate Uintah ComponentsUtilize all on-node computational resourcesUintah’s asynchronous task-based approach well suited for Co-processors and Accelerator designs

TACC Stampede1000s of Xeon Phi Coprocessors

DOE Titan1000s of GPUs

Xeon Phi

Multi-core CPU

+

GPU

Page 13: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Unified Heterogeneous Scheduler (GPU offload)

Running CPU Task

Netw

ork

CPUData

Warehouse

PUT

GET

Running CPU Task

Running CPU Task

CPU Task QueuesInternal ready tasks

CPU Threads

SharedScheduler

Objects(host MEM)

MPI DataReady

MPI sends

MPI recvs

TaskGraph

PUT

GET

GPUData

Warehouse

H2Dstream

D2Hstream

Running GPU Task

GPU Task Queues

Running GPU Taskco

mpl

eted

task

s

stream events

GPU Kernels

GPU-enabled tasks

ready tasks GPU ready tasks

Page 14: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Performance and Scaling ComparisonsUintah strong scaling results when using:

Multi-threaded MPIMulti-threaded MPI w/ GPU

GPU-enabled RMCRTAll-to-all communication100 rays per cell 1283 cellsNeed port Multi-level CPU tasks to GPU

Cray XK-7, DOE Titan Thread/MPI: N=16 AMD Opteron CPU coresThread/MPI+GPU: N=16 AMD Opteron CPU cores + 1 NVIDIA K20 GPU

Page 15: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Xeon Phi Execution Models

Page 16: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah on Stampede: Host-only Model

Intel MPI issues beyond 2048 cores (seg faults)

MVAPICH2 required for larger core counts

Using Hypre with a conjugate gradient solver Preconditioned with geometric multi-gridRed Black Gauss Seidel relaxation - each patch

Incompressible turbulent flow

Page 17: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah on Stampede: Native Model

Compile with –mmiccross compiling

Need to build all Uintah required 3p libraries

libxml2zlib

Run Uintah natively on Xeon Phi within 1 day

Single Xeon Phi Card

Page 18: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Unified Heterogeneous Scheduler & RuntimeOffload Model

Running CPU Task

Netw

ork

DataWarehouse

(variables)

PUT

GET

Running CPU Task

Running CPU Task

CPU Task QueuesInternal ready tasks

CPU Threads

SharedScheduler

Objects(host MEM)

MPI DataReady

MPI sends

MPI recvs

TaskGraph

PUT

GET

DeviceData

Warehouse

H2Dcopy

D2Hcopy

Running Device Task

Device Task Queues

Running Device Task PUT

GETC

ompl

eted

ta

sks

Signals

MIC Kernels

Device-enabled tasks

ready tasks Device ready tasks

Page 19: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah on Stampede: Offload ModelUse compiler directives (#pragma)

Offload target: #pragma offload target(mic:0)OpenMP: #pragma omp parallel

Find copy in/out variables from task graph

Functions called in MIC must be defined with __attribute__((target(mic)))

Hard for Uintah to use offload mode Rewrite highly templated C++ methods with simple C/C++ so they can be called on the Xeon PhiLess effort than GPU port, but still significant work for complex code such as Uintah

Page 20: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Running Task

Netw

ork

HostData

Warehouse

(variables directory)

PUT

GET

Running Task

Running Taskcompleted task

Task QueuesNew tasks

completed taskHostThreads

HostMemory

Ready task

sends

receives

TaskGraph

PUT

GET

Unified Heterogeneous Scheduler (MIC symmetric)

Running Task Device

Netw

ork

DeviceData

Warehouse

(variables directory)

PUT

GET

Running Task

Running Taskcompleted task

Task QueuesNew tasks

completed task

DeviceThreads

DeviceMemory

Ready task

receives

TaskGraph

PUT

GET

PC

I-E

Page 21: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah on Stampede: Symmetric ModelXeon Phi directly calls MPI

Use Pthreads on both host CPU and Xeon Phi:1 MPI process on host – 16 threads1 MPI process on MIC – up to 120 threads

Currently only Intel MPI supportedmpiexec.hydra -n 8 ./sus – nthreads 16 : -n 8./sus.mic –nthreads 120

Challenges: Different floating point accuracy on host and co-processor

Result ConsistencyMPI message mismatch issue: Control related FP operations

Page 22: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Example: Symmetric Model FP Issuep=0.421874999999999944488848768742172978818416595458984375c=0.0026041666666666665221063770019327421323396265506744384765625b=p/c

b=162

161 162 163 164

b=162

Rank0: CPU

b=162

Rank1: CPU

Host-only Model

Symmetric Model

MPI SizeMismatch

b=161.99999999999999

MPI OK

Rank0: CPU

Rank1: MIC

Control related FP operations must use consistent accuracy model

161 162 163 164

161 162 163 164

161 162 163 164

Page 23: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Scaling Results on Xeon Phi

Multi MIC Cards (Symmetric Model)

Xeon Phi card: 60 threads per MPI process, 2 MPI processes

host CPU :16 threads per MPI process, 1 MPI processes

Issue: load imbalance - profiling differently on host and Xeon Phi Multiple MIC cards

Page 24: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Current and Future WorkLoad Balancer

Cannot treat all MPI ranks uniformlyProfile CPU and Xeon Phi separatelyNeed separate forecast model for each

Address different cache sizesNew regridder to generate large patches for CPU and small patches for Xeon Phi

Explicitly use long vectorAsynchronous offload model

_Offload_signaled(mic_no, &c)

Page 25: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Questions?

Software Homepage http://www.uintah.utah.edu/Alstom Clean Coal Boiler Simulation: RMCRT offloaded, Flow simulation on CPU

Science Track Talk: Jacqueline Beckvermit, Wednesday, 5:00-5:30pm The Influence of an Applied Heat Flux on the Violence ofReaction of an Explosive Device

Page 26: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Graph Based Applications1:1

1:2

1:3

1:4

2:2

2:3

2:4

2:2

2:3

2:4

3:3

3:4

3:3

Charm++: Object-based Virtualization

Intel CnC:new language for graph based parallelism Plasma (Dongarra):

DAG based Parallel linear algebra software

Page 27: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Software Model for ExascaleSilver model for Exascale software which must:

Directed dynamic graph executionLatency hidingMinimize synchronization and overheadsAdaptive resource scheduling Heterogeneous processing

Graph-based asynchronous-task work queue model

(DARPA software report, 2009)

Page 28: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Structured Grid Variable (for Flows)• Cell Centered, Node Centered, Face Centered

Unstructured Points (for Solids)• Particles• Atoms

Uintah Patch and Variables

Page 29: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Uintah on StampedeHost OnlyNative

Compile with –mmic (cross compiling)Third-party libs (zlib, libxml2)Single Xeon Phi Card

OffloadUse compiler directives (#pragma)Functions called in MIC must be defined with __attribute__((target(mic))) Need rewrite simple C/C++

SymmetricBest fits current Uintah modelXeon Phi directly calls MPIDifferent floating point accuracy

Page 30: Preliminary Experiences with the Uintah Framework on on ... · Preliminary Experiences with the Uintah Framework on on Intel Xeon Phi and Stampede DOE for funding the CSAFE project

Performance Comparison

Cray XE6 node, 32 AMD Opteron cores

AMR MPMICE withMPI-onlyPthread & lock-based DWPthread & lock-free DW

2.4X speed up( Pthread with lock-free DW Vs MPI-only)