22
The Use of GPUs for Reservoir Simulation Mark Wakefield ECLIPSE Development Manager, Schlumberger Contributors: Garf Bowen & Arnaud Desitter, Schlumberger John Appleyard & Jeremy Appleyard, Polyhedron Software

The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

  • Upload
    vannhan

  • View
    220

  • Download
    4

Embed Size (px)

Citation preview

Page 1: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

The Use of GPUs for

Reservoir Simulation

Mark Wakefield

ECLIPSE Development Manager,

Schlumberger

Contributors:

Garf Bowen & Arnaud Desitter, Schlumberger

John Appleyard & Jeremy Appleyard, Polyhedron Software

Page 2: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

2

© 2011 Schlumberger. All rights reserved.

An asterisk is used throughout this presentation to denote a mark of Schlumberger.

Other company, product, and service names are the properties of their respective

owners.

Page 3: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Schlumberger Abingdon Tech. Center

Based 8 miles from Oxford, UK

~200 employees involved in developing oilfield software

~50 people involved in commercial simulator development

– ECLIPSE*: Established FORTRAN/MPI code focusing on high

end physics

– INTERSECT*: New to market C++/MPI code focusing on

scalability and large model workflows

Page 4: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

GPU Technology Evaluation

Have been evaluating GPU technology for the past 2+ years,

particularly the NVIDIA CUDA architecture

1. How can GPUs be used in existing commercial products

2. Considerations for algorithm design

3. Considerations for software engineering

Page 5: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Simulator Overview

Evolutionary, timesteps from an initial state

Solves a set of non-linear conservation equations

Solved implicitly due to fast propagating pressure transients

Newton iteration requires solution of linear system

Solution of linear system is critical to performance but not

naturally parallel

Models routinely have 10^4 – 10^7 grid blocks

Page 6: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Timestep Loop to Find Solution x at t + Δt

Source / Sinks

)(x w(x) f(x) t

c (x) r compcomp

comp

comp

Accumulation Flux

1) Property calculations from x

δxxr, xδxx

r

2) Residual and Jacobian assembly

3) Linear solve to find solution increment

Source

Page 7: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Suitable Components to Migrate to GPU

Component % run time & % code

base

Type of algorithm

Property

calculations

15-30% run time

15+15% code base

Ratio ~ 1

Largely independent cell calculations

for fluid properties. Also includes well

model. Many branches depending on

model

Matrix Assembly

15 – 20% run time

1% code base

Ratio ~ 15

Independent assembly of governing

equations for each cell

Linear Solver

50 – 70% run time

2% code base

Ratio ~ 30

Most potential but also the most

sequential part of the code

Page 8: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

GPU Linear Solver Components

0

10

20

30

40

50

60

70

80

500 5000 50000

GB

/s

Number of Threads

CUDA memory bandwidth

Product

Factor

Solve

Guide

0

5

10

15

20

25

30

500 5000 50000

Gfl

op

s

Number of Threads

CUDA FP performance

Product

Factor

Solve

Guide

Page 9: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Should We Write a GPU Linear Solver?

0.1

1

10

100

1 10 100 1000 10000 100000

Mill

isec

on

ds

Number of threads

OpenMP vs CUDA

OpenMP Product

OpenMP Factor

OpenMP Solve

CUDA Product

CUDA Factor

CUDA Solve

Intel Xeon X5482 & NVIDIA Tesla C1060

Page 10: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Potential Demonstrated

Ideas evolved into the Massively Parallel Nested

Factorization (MPNF) algorithm

Presented at the 2011 SPE RSS

– Accelerating Reservoir Simulators using GPU Technology,

John R. Appleyard and Jeremy D. Appleyard, Polyhedron

Software, and Mark A. Wakefield and Arnaud L. Desitter,

Schlumberger (SPE-141402-PP)

Results generated on an Intel Xeon X5550 with a NVIDIA

Tesla C2050

Page 11: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Solve Mx = r, constructing the solution in terms of a small

number of basis vectors (v)

Performance depends on the ability to generate good v’s

Preconditioner N is an easy to invert approximation to M

N often a factorization (LU) which is essentially a serial algorithm

Iterative Linear Solver Essentials

rxMvi~ x~ i

M

1NError in x Error in r

Page 12: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

A GPU Based Preconditioner

B

R

B

R

B

R

B

R

s

s

y

y

EI

BAI

r

r

s

s

DC

A 1

Color order grid so that columns are independent

All columns in a color can be factored in parallel. Solve Ny=r as

B

C

A

D

Page 13: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

GPU Linear Solver Performance

Compared with serial CPU solver on a suite of 30 models

with up to 900k grid blocks

All models ran to completion with comparable results

50% more linear iterations

10% non-linear iterations & 10% more timesteps

Due to trade off between parallelization and accuracy of

preconditioner.

Page 14: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Speed-up for Linear Solver Only

0.01

0.10

1.00

10.00

100.00

1E+0 1E+1 1E+2 1E+3 1E+4 1E+5 1E+6

So

lver

Sp

eed

-up

Number of Grid Blocks

Want to be

operating here

but GPU memory

is a constraint

Page 15: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Overall Speed-up with GPU Linear Solver

0

1

2

3

4

5

6

7

8

9

10

1.00E+05 1.00E+06

Ove

rall

Sp

eed

-up

Number of grid blocks

Page 16: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Next Step – Assembly on the GPU

0

2

4

6

8

10

12

1.00E+05 1.00E+06

Ove

rall

spee

d-u

p

Number of grid blocks

GPU Solver

GPU Solver and assembly

0

2

4

6

8

10

12

14

16

1.00E+05 1.00E+06

Ass

emb

ly s

pee

d-u

p

Number of grid blocks

Page 17: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

GPU Technology Evaluation Conclusions

1. How can GPUs be used in existing commercial products

– With modest effort we can achieve a ~3x speed-up

2. Considerations for algorithm design

3. Considerations for development/architecture frameworks

Page 18: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Algorithm Design - Linear Solver Scalability (I)

Problem size fixed, increase number of GPUs

MPNF is algorithmically unchanged by a domain decomposition

layer:

Process same color simultaneously across all domains

corrections between colors are passed both within and

between domains

Same iteration count whether on one machine, or a cluster

Under exploration

Page 19: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Algorithm Design - Linear Solver Scalability (II)

Problem size increasing, fixed number of GPUs

MPNF has shown good scalability but GPU memory is a

constraint on testing

MPNF is not as recursive as a multi-grid algorithm.

SLB currently working on massively parallel recursive

algorithms that might exhibit better scalability on very large

problems

Page 20: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Software Engineering – Past Experiences

Scientific code can have a long life time

Clients still run old versions & models

Working with non-proprietary standards has

enabled ECLIPSE* to adapt to:

OS changes

Hardware changes

Interconnect changes

Page 21: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

Software Engineering - Past Experiences

Simulator developers are not generally Computer Scientists so need an effective environment where performance comes naturally

Developers swap projects – need a productive environment

Continue to explore pros/cons of other solutions:

Alternative hardware targets - Intel ArBB

Platform neutral approaches - Oxford Parallel Library (OP2)

Higher level implementations - CUDA Thrust

Page 22: The Use of GPUs for Reservoir Simulation - Oil and Gas …static.og-hpc.org/Rice2011/Workshop-Presentations/OG-HPC PDF-4-W… · The Use of GPUs for Reservoir Simulation Mark Wakefield

GPU Technology Evaluation Conclusions

1. How can GPUs be used in existing commercial products

– With modest effort we can achieve a ~3x speed-up

2. Considerations for algorithm design

– Have demonstrated that existing algorithms can be adapted.

Massively parallel algorithms still an area of internal research.

3. Considerations for software engineering

– Not yet obvious - but we know the cores are coming!