Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran,...

26
www.metoffice.gov.uk © Crown Copyright 2018, Met Office Dealing with I/O performance issues within the Unified Model SIG-IO-UK - Wed June 6th, 2018 Adam Voysey, HPC Optimisation Team

Transcript of Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran,...

Page 1: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

www.metoffice.gov.uk © Crown Copyright 2018, Met Office

Dealing with I/O performance issues within the Unified ModelSIG-IO-UK - Wed June 6th, 2018

Adam Voysey,

HPC Optimisation Team

Page 2: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

A Quick introduction to I/O in the Unified Model

Page 3: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

The UM

The Unified Model (UM) is a numerical model of the

atmosphere used for both weather and climate

applications. It is in continuous development by the Met

Office and its partners, adding state of the art understanding of atmospheric processes to new releases.

For more information see:

https://www.metoffice.gov.uk/research/modelling-systems/unified-model

Page 4: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Two Key I/O Components

I/O Server (Remote I/O)

• Written in Fortran

• OpenMP + MPI Parallelism

• Multiple “Roles”

Portio (Local I/O)

• Written in C

• Serial Code*

• Multiple “Layers”

Common Interface allows

these to be tied together

Page 5: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Two Key I/O Components

I/O Server (Remote I/O)

• Written in Fortran

• OpenMP + MPI Parallelism

• Multiple “Roles”

Portio (Local I/O)

• Written in C

• Serial Code*

• Multiple “Layers”

MPI-IO

Page 6: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Fieldsfiles Fixed Length Header

Field

Field

Secondary Records

• Bespoke format (inspired by early GRIB)

• Common “Fixed Length Header”

• Secondary records include constants

table, lookup table…• Fields can be compressed –

e.g. WGDOS Packing

Page 7: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Fieldsfiles

WGDOS Packing

Row Header Row Data

WGDOS Header

Fixed Length Header

Secondary Records

WGDOS Header

WGDOS Packed Field

WGDOS Packed Field

Page 8: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

NetCDF

• Can also output in NetCDF

• Not as commonly used

• Not start dumps

• Some ancillary input uses NetCDF files

Page 9: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

Why is I/O a Problem?

Page 10: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Have to deal with:

• Performance

• I/O can be serial bottleneck

• Even where we can parallelise, scaling may be poor/limited

• Significant chunk of runtime

• Cost

• Archive tapes are expensive!

• Increasing resolution is making this worse

Page 11: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Inter-cycle file use

T+0 T+3 T+6

Dump File Dump File

Archive Archive

Page 12: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

What Have We Done So Far?

Page 13: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Portio Layers• Internal Buffering

• Lustre integration

• ‘Helper’ threads

• Add debugging layers

Read Buffering. (+ pre-loading)

Support for e.g. striping

Accelerate e.g. buffering

Trace, Time, Throttle, Blackhole

Page 14: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

All-to-All DumpReading

• Read dump fields in parallel;

Use MPI_Alltoall to distribute

• Based on work done by Cray

• Example timings shown for three runs of an operational-style n1280 global

model.

Page 15: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

MPI-IO in IO Server• Write output in parallel

• Based on work done by Dale Roberts (Australian National University)

• Gather fields onto IO Server ranks; write in parallel (mpi_file_write_at_all)

• Complications from packed fields

WGDOS Packed Field WGDOS Packed Field

fragments

exchange

Page 16: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Other Optimisations• Namelists read by only one rank

• Reduction of enquiry functions

• Ensure only one rank opens files in serial case

• Ensure correct compiler flags. (No debug symbols with Cray Compiler)

Page 17: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

Current Challenges

Page 18: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

I/O Stalls On Lustre• Usually get good performance

• However, occasionally see a long stall (maybe ~10x I/O time)

• Stalls are infrequent, but not negligibly rare

• Mechanism not properly understood, but…• Hypothesis that stalls are related to Lustre response

• When they occur, stall time is consistent.

• More probable when higher frequency of transactions

• … when we have more threads

• … when we have smaller block sizes• Episodic

Page 19: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

What Do We Still Need To Do?

Page 20: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

I/O Server• Work on queues

• Want to ensure I/O server is responsive and does not block overlapping

computation

Page 21: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Portio• Enable write helper thread

• Add new layers for other file-system architectures?

• (Migrate to Shumlib)

Page 22: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Other Changes• Extend All-to-All method to other files – IAU, LBCs

• Alternative compression?

Page 23: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Shumlib• SHared UM LIBrary

• Provides bindings in Fortran, Python, and C

• High level Fieldsfile manipulation API

• And low level I/O API• 3-Clause BSD licence

• (Plus other non-IO related code)

Shumlib

UM

Shumlib

Post Processing

Shumlib

Mule

File

Page 24: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

Conclusions

Page 25: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

© Crown Copyright 2018, Met Officewww.metoffice.gov.uk

Conclusions• Taken some steps to deal with I/O performance in the UM

• Can now have parallel reads and writes of most important files

• This is most important for operational runs

• But still need to do more – e.g. can extend to other files• We still need to do work to understand fully the low level details

• Why do we get stalls?

Page 26: Dealing with I/O performance issues within the Unified Model · • Provides bindings in Fortran, Python, and C • High level Fieldsfile manipulation API • And low level I/O API

www.metoffice.gov.uk © Crown Copyright 2018, Met Office

ThanksAny Questions?