© 2008The MathWorks, Inc. ® ® The MATLAB Low-Level HDF5 Interface John Evans.

Slides:



Advertisements
Similar presentations
Merger/Extract HDF5 Objects Peter Cao & Quincey Koziol June 16, 2005.
Advertisements

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD1 Introduction to HDF5 HDF and HDF-EOS Workshop XI November 6-8, 2007.
10/15/08HDF & HDF-EOS Workshop XII11 Introduction to HDF5 HDF & HDF-EOS Workshop XII October 15, 2008.
© 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)
The HDF Group Introduction to HDF5 Barbara Jones The HDF Group The 13 th HDF & HDF-EOS Workshop November 3-5, HDF/HDF-EOS Workshop.
University of Illinois at Urbana-ChampaignHDF Mike Folk HDF-EOS Workshop IV Sept , 2000 HDF Update HDF.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
1 of 14 Substituting HDF5 tools with Python/H5py scripts Daniel Kahn Science Systems and Applications Inc. HDF HDF-EOS Workshop XIV, 28 Sep
HDF5 Tools Update Peter Cao - The HDF Group November 6, 2007 This report is based upon work supported in part by a Cooperative Agreement.
HDF 1 HDF5 Advanced Topics Object’s Properties Storage Methods and Filters Datatypes HDF and HDF-EOS Workshop VIII October 26, 2004.
The HDF Group April 17-19, 2012HDF/HDF-EOS Workshop XV1 Introduction to HDF5 Barbara Jones The HDF Group The 15 th HDF and HDF-EOS Workshop.
1 High level view of HDF5 Data structures and library HDF Summit Boeing Seattle September 19, 2006.
HDF5 A new file format & software for high performance scientific data management.
DM_PPT_NP_v01 SESIP_0715_AJ HDF Product Designer Aleksandar Jelenak, H. Joe Lee, Ted Habermann Gerd Heber, John Readey, Joel Plutchak The HDF Group HDF.
Sep , 2010HDF/HDF-EOS Workshop XIV1 HDF5 Advanced Topics Neil Fortner The HDF Group The 14 th HDF and HDF-EOS Workshop September 28-30, 2010.
April 6, 2010GMQS Meeting1 Optional Feature Support in HDF5 Tools Albert Cheng The HDF Group.
A Metadata Based Approach For Supporting Subsetting Queries Over Parallel HDF5 Datasets Vignesh Santhanagopalan Graduate Student Department Of CSE.
February 2-3, 2006SRB Workshop, San Diego P eter Cao, NCSA Mike Wan, SDSC Sponsored by NLADR, NFS PACI Project in Support of NCSA-SDSC Collaboration Object-level.
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop VIII October 26, 2004.
April 28, 2008LCI Tutorial1 HDF5 Tutorial LCI April 28, 2008.
The HDF Group Virtual Object Layer in HDF5 Exploring new HDF5 concepts May 30-31, 2012HDF5 Workshop at PSI 1.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
The netCDF-4 data model and format Russ Rew, UCAR Unidata NetCDF Workshop 25 October 2012.
April 28, 2008LCI Tutorial1 Introduction to HDF5 Tools Tutorial Part II.
The HDF Group HDF5 Tools Updates Peter Cao, The HDF Group September 28-30, 20101HDF and HDF-EOS Workshop XIV.
HDF Dimension Scales in HDF5 HDF-EOS Workshop IX San Francisco, CA November 30 - December 2, 2005 Pedro Vicente Nunes THG/NCSA Champaign-Urbana, IL HDF.
The HDF Group October 28, 2010NetcDF Workshop1 Introduction to HDF5 Quincey Koziol The HDF Group Unidata netCDF Workshop October 28-29,
October 15, 2008HDF and HDF-EOS Workshop XII1 What will be new in HDF5?
1 N-bit and ScaleOffset filters MuQun Yang National Center for Supercomputing Applications University of Illinois at Urbana-Champaign Urbana, IL
1 HDF5 Life cycle of data Boeing September 19, 2006.
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop IX November 30, 2005.
HDF Hierarchical Data Format Nancy Yeager Mike Folk NCSA University of Illinois at Urbana-Champaign, USA
The HDF Group November 3-5, 2009HDF/HDF-EOS Workshop XIII1 HDF5 Advanced Topics Elena Pourmal The HDF Group The 13 th HDF and HDF-EOS.
EXPRESS/Binary Report David Price ISO SC4 Vico Equense March 2006.
November 30, 2005HDF & HDF-EOS Workshop IX Peter Cao, NCSA November 30, 2005 HDF5 Tools.
1 Error Handling Interface HDF-EOS Workshop IX Quincey Koziol and Ray Lu 30 Nov 2005.
September 9, 2008SPEEDUP Workshop - HDF5 Tutorial1 Introduction to HDF5 Command-line Tools.
The HDF Group Introduction to netCDF-4 Elena Pourmal The HDF Group 110/17/2015.
HDF5 Q4 Demo. Architecture Friday, May 10, 2013 Friday Seminar2.
Parallel I/O Performance Study and Optimizations with HDF5, A Scientific Data Package MuQun Yang, Christian Chilan, Albert Cheng, Quincey Koziol, Mike.
The HDF Group HDF5 Chunking and Compression Performance tuning 10/17/15 1 ICALEPCS 2015.
The HDF Group Single Writer/Multiple Reader (SWMR) 110/17/15.
May 30-31, 2012 HDF5 Workshop at PSI May Partial Edge Chunks Dana Robinson The HDF Group Efficient Use of HDF5 With High Data Rate X-Ray Detectors.
March 9, th International LCI Conference - HDF5 Tutorial1 HDF5 Advanced Topics.
The HDF Group 10/17/15 1 HDF5 vs. Other Binary File Formats Introduction to the HDF5’s most powerful features ICALEPCS 2015.
Intro to Parallel HDF5 10/17/151ICALEPCS /17/152 Outline Overview of Parallel HDF5 design Parallel Environment Requirements Performance Analysis.
MATLAB's HDF5 Updates John Evans Image and Scientific Data Formats.
The HDF Group 10/17/151 Introduction to HDF5 ICALEPCS 2015.
Parallel I/O Performance Study and Optimizations with HDF5, A Scientific Data Package Christian Chilan, Kent Yang, Albert Cheng, Quincey Koziol, Leon Arber.
1 Introduction to HDF5 Programming and Tools Boeing September 19, 2006.
The HDF Group Single Writer/Multiple Reader (SWMR) 110/17/15.
The HDF Group Introduction to HDF5 Session 7 Datatypes 1 Copyright © 2010 The HDF Group. All Rights Reserved.
RSI at the HDF & HDF-EOS Workshop VI October 26, 2004 – Aurora, CO.
- 1 - Overview of Parallel HDF Overview of Parallel HDF5 and Performance Tuning in HDF5 Library NCSA/University of Illinois at Urbana- Champaign.
The HDF Group Introduction to HDF5 Session Three HDF5 Software Overview 1 Copyright © 2010 The HDF Group. All Rights Reserved.
1 January 11-13, 2010ESRF Workshop – Introduction to HDF5 Introduction to HDF5 Francesc Alted Consultant and PyTables creator.
HDF and HDF-EOS Workshop XII
Parallel HDF5 Introductory Tutorial
Introduction to HDF5 Session Five Reading & Writing Raw Data Values
Matlab Training Session 4: Control, Flow and Functions
Introduction to HDF5 Tutorial.
Tools to Build Clients.
MATLAB, netCDF, and OPeNDAP
What NetCDF users should know about HDF5?
Introduction to HDF5 for HDF4 users
Peter Cao The HDF Group November 28, 2006
Introduction to HDF5 Mike McGreevy The HDF Group
Hierarchical Data Format (HDF) Status Update
Dimension Scales in HDF-EOS2 & HDF-EOS5
Presentation transcript:

© 2008The MathWorks, Inc. ® ® The MATLAB Low-Level HDF5 Interface John Evans

2 ® ® Introduction Two Solutions Provided “High Level” Interface: HDF5READ, HDF5WRITE, HDF5INFO mex-files. Provides “one-stop-shopping” to reading and writing HDF5 files. Easy introduction, but not flexible. “Low Level” Interface: Over 200 functions that correspond to the HDF5 C API. Far more flexible, but the user needs to know the C API.

3 ® ® How We Differ From the C API C API for H5Aread: herr_t H5Aread (hid_t attr_id, hid_t mem_type_id, void * buf );

4 ® ® How We Differ From the C API C API for H5Aread: herr_t H5Aread (hid_t attr_id, hid_t mem_type_id, void * buf ); MATLAB API buf = H5A.read(attr_id,mem_type_id);  No “herr_t” returns values.  OUTPUTs on the left, INPUTs on the right.

5 ® ® Help for H5A.read >> help H5A.read H5A.read HDF5 H5Aread library function attr = H5A.read(attr_id, dtype_id) reads the attribute specified by attr_id. dtype_id specifies the attribute's memory datatype. The memory datatype may be 'H5ML_DEFAULT', which specifies that MATLAB should determine the appropriate memory datatype. To use this function, you must be familiar with the information about the Attribute Interface contained in the User's Guide and Reference Manual for HDF5 version This documentation may be obtained from the National Center for Supercomputing Applications (NCSA) at or The HDF Group at. For more help on the Attribute Interface functions, type: help

6 ® ® What's with the dot in “H5A.read”? The MATLAB HDF5 functions are divided into “classes” that correspond to the HDF5 interfaces. One such class is “ H5A ”, which has “ read ” as a member function. H5, H5A, H5D, H5E, H5F, H5G, H5I, H5ML(??), H5P, H5R, H5S, H5T, H5Z. H5ML is a special MATLAB “helper” class.

7 ® ® Example 1: Opening a file >> file_id = H5F.open('example.h5','H5F_ACC_RDONLY','H5P_DEFAULT'); >> whos Name Size Bytes Class Attributes file_id 1x1 H5ML.id >> H5F.close(fid)‏ >> mode = H5ML.get_constant_value('H5F_ACC_RDONLY')‏ mode = 0 >> file_id = H5F.open('example.h5',0,'H5P_DEFAULT'); >> H5F.close(file_id);

8 ® ® Example 2: Creating a 2x3 Dataset file_id = H5F.create('tst.h5','H5F_ACC_TRUNC','H5P_DEFAULT','H5P_DEFAULT'); dims = [2 3]; space_id = H5S.create_simple(2,dims,[]); dset_id = H5D.create(file_id,'foo','H5T_STD_I32LE',space_id,'H5P_DEFAULT'); data = [1 3 5; 2 4 6]; data = int32(data); H5D.write(dset_id,'H5T_NATIVE_INT','H5S_ALL','H5S_ALL','H5P_DEFAULT',indata); H5D.close(dset_id); H5F.close(file_id); file_id = H5F.open('tst.h5','H5F_ACC_RDONLY','H5P_DEFAULT'); dset_id = H5D.open(file_id,'/foo'); outdata = H5D.read(dset_id,'H5ML_DEFAULT','H5S_ALL','H5S_ALL','H5P_DEFAULT'); H5D.close(dset_id); H5F.close(file_id);

9 ® ® Example 1: Output DATASET "foo" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 2, 3 ) / ( 2, 3 ) } DATA { (0,0): 1, 2, 3, (1,0): 4, 5, 6 }

10 ® ® Example 1: Output data = outdata =

11 ® ® MATLAB Uses Column-Major Ordering So What Should One Do? Users can transpose their data before read, after write. This works, but inflicts a performance penalty. Other option is “flip” the dataspace... No performance penalty here, but the user must remember that the dimensions will look reversed from the C API.

12 ® ® Example 2: flipping the dataspace data = [1 3 5; ]; data = int32(data); dims = [2 3]; space_id = H5S.create_simple(2,fliplr(dims),[]); dset_id = H5D.create(file_id,'foo',... 'H5T_STD_I32LE',space_id,'H5P_DEFAULT'); H5D.write(dset_id,'H5T_NATIVE_INT',... 'H5S_ALL','H5S_ALL','H5P_DEFAULT',data);

13 ® ® Example 2: Output of h5dump HDF5 "tst.h5" { GROUP "/" { DATASET "foo" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 1, 2, (1,0): 3, 4, (2,0): 5, 6 }

14 ® ® Example 3: Compression dims = [ ]; data = int32(zeros(2000,3000)); % Remember to flip the dataspace. space_id = H5S.create_simple(2,fliplr(dims),[]); dcpl_id = H5P.create('H5P_DATASET_CREATE'); H5P.set_deflate(dcpl_id,6); % Flip the chunking as well! H5P.set_chunk(dcpl_id,fliplr([ ])); dset_id = H5D.create(file_id,'foo','H5T_NATIVE_INT',space_id,dcpl_id); H5D.write(dset_id,'H5T_NATIVE_INT','H5S_ALL','H5S_ALL','H5P_DEFAULT',data);

15 ® ® Compounds HDF5 "tst.h5" { GROUP "/" { DATASET "ArrayOfStructures" { DATATYPE H5T_COMPOUND { H5T_STD_I32LE "a"; H5T_IEEE_F64LE "c"; H5T_IEEE_F32LE "b"; } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): { 0, 1, 0 }, (1): { 1, 0.5, 1 },...

16 ® ® Compounds: continued >> d = h5varget('tst.h5','/ArrayOfStructures')‏ d = a: [10x1 int32] c: [10x1 double] b: [10x1 single] >> d.a ans =

17 ® ® References  Mathworks:  HDF5 Tools: google “matlab hdf5tools”