The HDF Group Introduction to HDF 5 Session

  • Slides: 14
Download presentation
The HDF Group Introduction to HDF 5 Session Four Java Products Copyright © 2010

The HDF Group Introduction to HDF 5 Session Four Java Products Copyright © 2010 The HDF Group. All Rights Reserved 1 www. hdfgroup. org

HDF 5 Java Products HDF Java Wrapper Copyright © 2010 The HDF Group. All

HDF 5 Java Products HDF Java Wrapper Copyright © 2010 The HDF Group. All Rights Reserved Object Package Viewer Editor 2 www. hdfgroup. org

Java Wrapper or Native Library? Pure Java Library HDF JNI Net. CDF-Java library HDF

Java Wrapper or Native Library? Pure Java Library HDF JNI Net. CDF-Java library HDF Copyright © 2010 The HDF Group. All Rights Reserved a programming framework that allows Java code to call and be called by applications and libraries written in other languages 3 www. hdfgroup. org

Pure Java Library • Pros: • True platform independence • Direct access to file

Pure Java Library • Pros: • True platform independence • Direct access to file (no data conversion between C and Java) Pure Java Library • Cons: HDF - Substantial amount of work to support existing features in the C library. - Duplicates development effort in C Copyright © 2010 The HDF Group. All Rights Reserved 4 www. hdfgroup. org

HDF JNI • Pros: HDF • Easy to implement • Easy to keep up

HDF JNI • Pros: HDF • Easy to implement • Easy to keep up with the library changes • Cons: HDF - Requires data conversion between C and Java - The JNI is platform dependent Copyright © 2010 The HDF Group. All Rights Reserved 5 www. hdfgroup. org

Java Wrapper Java C HDF C Native Impl. H 5. java h 5 Imp.

Java Wrapper Java C HDF C Native Impl. H 5. java h 5 Imp. c Copyright © 2010 The HDF Group. All Rights Reserved 6 www. hdfgroup. org

Java Wrapper: File Open in Java and C Java public static native int H

Java Wrapper: File Open in Java and C Java public static native int H 5 Fopen ( String name, int flags, int access_id); Copyright © 2010 The HDF Group. All Rights Reserved C hid_t H 5 Fopen ( const char *name, unsigned flags, hid_t access_id ); 7 www. hdfgroup. org

Java Wrapper: Reading Data A very simple example. int fid, did, sid, tid, rank;

Java Wrapper: Reading Data A very simple example. int fid, did, sid, tid, rank; Is there an easy way? long dims[], max. Dims[]; Object the. Data; fid = H 5 Fopen( fname, HDF 5 Constants. H 5 F_ACC_RDWR, HDF 5 Constants. H 5 P_DEFAULT); did = H 5 Dopen(fid, dname); sid = H 5 Dget_space(did); tid = H 5 Dget_type(did); rank = H 5 Sget_simple_extent_ndims(sid); dims = new long[rank]; max. Dims = new long[rank]; H 5 Sget_simple_extent_dims(sid, dims, max. Dims); the. Data = allocate. Array(tid, dims); H 5 Dread( did, tid, HDF 5 Constants. H 5 S_ALL HDF 5 Constants. H 5 P_DEFAULT, the. Data); H 5 Sclose(sid); H 5 Tclose(tid); H 5 Dclose(did); H 5 Fclose(fid); Copyright © 2010 The HDF Group. All Rights Reserved 8 www. hdfgroup. org

Object Package: The easy way… the. Data = Dataset. read(); For application developers: •

Object Package: The easy way… the. Data = Dataset. read(); For application developers: • Less function calls • Easy to extend for specific needs Copyright © 2010 The HDF Group. All Rights Reserved 9 www. hdfgroup. org

Object Package: Basic Classes File Group Dataset Datatype Attribute http: //www. hdfgroup. org/hdf-java-html/hdf-object/ Copyright

Object Package: Basic Classes File Group Dataset Datatype Attribute http: //www. hdfgroup. org/hdf-java-html/hdf-object/ Copyright © 2010 The HDF Group. All Rights Reserved 10 www. hdfgroup. org

HDFView Copyright © 2010 The HDF Group. All Rights Reserved 11 www. hdfgroup. org

HDFView Copyright © 2010 The HDF Group. All Rights Reserved 11 www. hdfgroup. org

Limitations of HDF-Java Products • No support for HDF 5 API routines with callbacks

Limitations of HDF-Java Products • No support for HDF 5 API routines with callbacks • Some HDF 5 datatype features not supported: • Unsigned integer datatypes • Nested compound datatype creation • JVM resource limits can restrict operations • Some “low priority” C API routines not covered: • http: //www. hdfgroup. uiuc. edu/RFC/HDF 5/hdf-java/ • “High level” C API routines not covered: • Dimension scales, Images, Tables, etc. Copyright © 2010 The HDF Group. All Rights Reserved 12 www. hdfgroup. org

Multiple Dimensions in Java • 1 -D arrays map directly from Java to C

Multiple Dimensions in Java • 1 -D arrays map directly from Java to C • float a = new float[1000] • Multi-Dimensional arrays ( > 1 D) are arrays of objects • float b = new float[100] • Allowed, but very slow currently • Suggest using 1 -D array for I/O and mapping to multi-D in application Copyright © 2010 The HDF Group. All Rights Reserved 13 www. hdfgroup. org

Stretch Break Copyright © 2010 The HDF Group. All Rights Reserved 14 www. hdfgroup.

Stretch Break Copyright © 2010 The HDF Group. All Rights Reserved 14 www. hdfgroup. org