Programming Overview of MPI-IO Exercises ARCHER Training Courses - - PowerPoint PPT Presentation

programming
SMART_READER_LITE
LIVE PREVIEW

Programming Overview of MPI-IO Exercises ARCHER Training Courses - - PowerPoint PPT Presentation

Advanced Parallel Programming Overview of MPI-IO Exercises ARCHER Training Courses Sponsors Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License.


slide-1
SLIDE 1

Advanced Parallel Programming

Overview of MPI-IO Exercises

slide-2
SLIDE 2

ARCHER Training Courses

Sponsors

slide-3
SLIDE 3

Reusing this material

This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_US

This means you are free to copy and redistribute the material and adapt and build on the material under the following terms: You must give appropriate credit, provide a link to the license and indicate if changes were made. If you adapt or build on the material you must distribute your work under the same license as the original. Note that this presentation contains images owned by others. Please seek their permission before reusing these images.

3

slide-4
SLIDE 4

Stand-Alone Exercise

  • We will
  • compile some existing source
  • run it on one and many processors (on the front-end and the back-end)
  • implement master IO for reading into a block decomposition
  • using global broadcast then copy-back on individual processes
  • by copying appropriate data to a buffer on the master and sending
  • Later on
  • extend this to using appropriate datatypes to avoid data copying
  • use above datatypes to achieve same result with MPI-IO
  • extend to do general block-cyclic decompositions with MPI-IO
  • Input and output data files can be viewed as pictures
  • to make debugging easier!
  • See PDF exercise sheet for full details

4

slide-5
SLIDE 5

MSc Students: Extending MPP Coursework

  • Probably more interesting to put MPI-IO into your own code
  • e.g. your 2D-decomposed MPP coursework exercise
  • Issues
  • file formats are different: must replace pgmread and pgmwrite with

ioread and iowrite

  • need special programs to view the files: cioview or fioview
  • must have specific names to be visualised: use creatfilename
  • See additional exercise sheet mpiio-mpp.pdf for details

5

slide-6
SLIDE 6

IO strategy 1: no data on workers

6

copy

master

read

Process 2 Process 3

copy

data file

copy

slide-7
SLIDE 7

IO strategy 2: incorrect data on workers

7

master

read

Process 2 Process 3

broadcast

data file

copy copy copy

slide-8
SLIDE 8

IO strategy 3: correct but inefficient

8

copy copy

master

read

Process 2 Process 3

broadcast

data file

copy

slide-9
SLIDE 9

IO strategy 4: standard master IO

9

copy

master

read

data file Process 2 Process 3

send send

slide-10
SLIDE 10

IO strategy 5: vector datatype

10

MPI-IO 2: Derived Datatypes

copy

master

read

data file Process 2 Process 3

slide-11
SLIDE 11

IO strategy 6: subarray datatypes

11

master

read

data file Process 2 Process 3

copy

slide-12
SLIDE 12

Using MPI-IO

  • Pass your derived datatypes to appropriate MPI-IO calls
  • use subarrays with disp = 0
  • or a vector with non-zero values of disp

12

slide-13
SLIDE 13

Template Code (Fortran)

! define subarray datatype for this process INTEGER(KIND=MPI_OFFSET_KIND) disp disp = 0 call MPI_File_open(…, fh, ierr) call MPI_File_set_view(fh, disp, MPI_REAL, subarray, ‘native’, MPI_INFO_NULL, ierr) call MPI_File_read_all(fh,buf,count,MPI_REAL,…) call MPI_File_close(fh, ierr)

13

slide-14
SLIDE 14

Template Code (C)

/* define subarray datatype for this process */ MPI_File fh; MPI_File_open(…, &fh); MPI_File_set_view(fh, 0, MPI_FLOAT, subarray, “native”, MPI_INFO_NULL); MPI_File_read_all(fh, buf, count, MPI_FLOAT, …) MPI_File_close(&fh);

14