programming
play

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.


  1. Advanced Parallel Programming Overview of MPI-IO Exercises

  2. ARCHER Training Courses Sponsors

  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

  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

  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

  6. IO strategy 1: no data on workers copy copy Process 2 Process 3 data file read copy master 6

  7. IO strategy 2: incorrect data on workers copy copy Process 2 Process 3 broadcast data file read copy master 7

  8. IO strategy 3: correct but inefficient copy copy Process 2 Process 3 broadcast data file read copy master 8

  9. IO strategy 4: standard master IO Process 2 Process 3 send send data file read copy master 9

  10. IO strategy 5: vector datatype Process 2 Process 3 data read file copy master 10 MPI-IO 2: Derived Datatypes

  11. IO strategy 6: subarray datatypes Process 3 Process 2 data read file copy master 11

  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

  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

  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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend