1 / 14

Computer Science 320

Computer Science 320. Slicing and Dicing Data with Buffers. Type-Specific Buffer Classes. edu.rit.BooleanBuf edu.rit.ByteBuf edu.rit.CharacterBuf edu.rit.DoubleBuf edu.rit.FloatBuf edu.rit.IntegerBuf edu.rit.LongBuf edu.rit.ShortBuf edu.rit.ObjectBuf.

jaafar
Download Presentation

Computer Science 320

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science 320 Slicing and Dicing Data with Buffers

  2. Type-Specific Buffer Classes • edu.rit.BooleanBuf • edu.rit.ByteBuf • edu.rit.CharacterBuf • edu.rit.DoubleBuf • edu.rit.FloatBuf • edu.rit.IntegerBuf • edu.rit.LongBuf • edu.rit.ShortBuf • edu.rit.ObjectBuf These are wrappers for primitive values or objects They all implement Serializable

  3. Example: A Single Item Integer Buffer IntegerItemBufbuf = IntegerBuf.buffer(); buf.item = 42; System.out.println(buf.item);

  4. Example: An Integer Array Buffer int[] data = new int[8]; IntegerBufbuf = IntegerBuf.buffer(data);

  5. Example: An Array Slice int[] data = new int[8]; Range sliceRange = new Range(2, 4); IntegerBufbuf = IntegerBuf.buffer(data, sliceRange);

  6. Example: Range Stride > 1 int[] data = new int[8]; Range evenRange = new Range(0, 6, 2); IntegerBufbuf = IntegerBuf.buffer(data, evenRange);

  7. Example: Partitioning an Array int[] data = new int[8]; Range[] sliceRanges = new Range(0, 7).subranges(4); IntegerBuf[] sliceBufs = IntegerBuf.sliceBuffers(data, sliceRanges);

  8. Example: An Integer Matrix Buffer int[] data = new int[4][8]; IntegerBufbuf = IntegerBuf.buffer(data); Data are written to and read from the communication buffer in row-major order

  9. Example: A Matrix Row Slice int[] data = new int[4][8]; Range rowRange = new Range(2, 3); IntegerBufbuf = IntegerBuf.rowSliceBuffer(data, rowRange); Only the data values in the row range are transferred through the buffer

  10. Example: A Matrix Column Slice int[] data = new int[4][8]; Range colRange = new Range(2, 4); IntegerBufbuf = IntegerBuf.colSliceBuffer(data, colRange); Only the data values in the column range are transferred through the buffer

  11. Example: A Matrix Patch (Rows and Columns) int[] data = new int[4][8]; Range rowRange = new Range(1, 2); Range colRange = new Range(4, 5); IntegerBufbuf = IntegerBuf.patchBuffer(data, colRange); Only the data values in the matrix “patch” are transferred through the buffer

  12. Example: Matrix Partition by Rows int[] data = new int[4][8]; Range[] rowRanges = new Range(0, 3).subranges(4); IntegerBufrowBufs = IntegerBuf.rowSliceBuffers(data, rowRanges); Used as source in scatter and destination in gather operations

  13. Example: Matrix Partition by Columns int[] data = new int[4][8]; Range[] colRanges = new Range(0, 7).subranges(4); IntegerBufcolBufs = IntegerBuf.colSliceBuffers(data, colRanges); Used as source in scatter and destination in gather operations

  14. Example: Matrix Partition by Patches int[] data = new int[4][8]; Range[] rowRanges = new Range(0, 3).subranges(2); Range[] colRanges = new Range(0, 7).subranges(2); IntegerBufpatchBufs = IntegerBuf.patchBuffers(data, rowRanges, colRanges); Used as source in scatter and destination in gather operations

More Related