NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-java] JNA Based NetCDF Access

Hi All,

I have successfully activated the JNA based C-library bridge by including
package: ucar.nc2.jni.netcdf , particularly these files: JniIosp.java,
NCLibrary.java . Thanks for the head start John. I have also tested on
Linux and Mac since the current code only loads DLL's by adding load calls
for .so and .dylibs as below.

            String osName = System.getProperty("os.name");
            boolean isWin = osName != null
                    && osName.toLowerCase().contains("win");
            boolean isMacOS = osName != null
                    && osName.toLowerCase().contains("mac");
            boolean isLinux = osName != null
                    && osName.toLowerCase().contains("linux");
            if(isWin)
            {
                String dir = "C:/dev/tds/thredds/lib/binary/win32/";
                System.setProperty("jna.library.path", dir);
    
                System.load(dir + "zlib1.dll");
                System.load(dir + "szlibdll.dll");
                System.load(dir + "hdf5dll.dll");
                System.load(dir + "hdf5_hldll.dll");
            }
            else if(isMacOS)
            {
                String dir = "/opt/local/lib/";
                System.setProperty("jna.library.path", dir);
                System.load(dir + "libz.dylib");
                System.load(dir + "libsz.dylib");
                System.load(dir + "libhdf5.dylib");
                System.load(dir + "libhdf5_hl.dylib");
            }
            else if(isLinux)
            {
                String dir = "/usr/lib/";
                System.setProperty("jna.library.path", dir);
                System.load(dir + "x86_64-linux-gnu/libz.so");
            }

The timing benchmarks indicate that the access is faster across the board
than pure Java for sub 1GB files, you can read details of the benchmark
here: http://forum.worldwindcentral.com/showpost.php?p=97182&postcount=6 .
I am hoping that the JNA bindings to the C-library will move from
experimental to testing to production soon.

Cheers,

Tisham.




  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: