[Nexus] Trouble with HDF5 under Nexus3.0
tieman
tieman at aps.anl.gov
Mon Dec 4 19:02:21 GMT 2006
Freddie,
Turns out it was definitely an issue with HDF5 and not the Nexus
wrapper. The code must be compiled with "_HDF5USEDLL_" defined if one
is calling the HDF5 dlls on windows. I'm still not sure if/where this
appears in the documentation--maybe if I started reading from the
beginning :) but I remember something similar with HDF4. Once I started
tracing through the header definitions, this was easy to find and
resolve. It's just odd that the majority of the calls appear to work
just fine without the define...
Brian
Akeroyd, FA (Freddie) wrote:
> Brian,
>
> I can create HDF5 files OK with the windows install kit at
> http://download.nexusformat.org/kits/windows/ ... though this kit is
> based on a more recent revision of the NeXus source code than 3.0.0
> looking at
> http://svn.nexusformat.org/viewvc/NeXusCode/trunk/src/napi5.c?view=diff&
> r1=721&r2=548&diff_format=h suggests no major changes to napi5.c between
> this version and 3.0.0 that could cause an issue with H5Pcreate()
>
> >From my understanding of the HDF5 manual H5Pcreate() should just create
> you a new property list object, so I'm not sure why it should return you
> an error as it looks like HDF5 is installed correctly on your computer.
> Which compiler are you using?
>
> The window install kit mentioned above contains an executable
> napi_test-hdf5.exe ... are you able to run that on your computer (it
> should produce a file NXtest.h5)?
>
> Regards,
>
> Freddie
>
> -----Original Message-----
> From: nexus-bounces at nexusformat.org
> [mailto:nexus-bounces at nexusformat.org] On Behalf Of tieman
> Sent: 30 November 2006 16:51
> To: Nexus List
> Subject: [Nexus] Trouble with HDF5 under Nexus3.0
>
> Hello all!
>
> I'm trying to update all my Nexus code to Nexus3.0 specifically so I can
>
> make use of HDF5. I've been able to get HDF4 and XML to work fine, but
> I get errors whenever I try and create an HDF5 file.
>
> Specifically, the problem appears to be in this portion of the code from
>
> the routine NX5open:
>
> /* start HDF5 interface */
> if (am == NXACC_CREATE5) {
> fapl = H5Pcreate(H5P_FILE_ACCESS);
>
> iRet=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
> rdcc_nbytes=(size_t)nx_cacheSize;
> iRet =
> H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
> /*
> setting the close degree is absolutely necessary in HDF5
> versions > 1.6. If you use a lessere version and the compiler
> complains, comment it out but keep this in mind.
> */
> H5Pset_fclose_degree(fapl,H5F_CLOSE_STRONG);
> am1 = H5F_ACC_TRUNC;
> pNew->iFID = H5Fcreate (filename, am1, H5P_DEFAULT, fapl);
> } else {
>
> H5Pcreate (H5P_FILE_ACCESS) returns -1 which later causes H5Fcreate to
> fail and I get a "cannot open file" error.
>
> If I simply execute the code:
>
> hid_t file_id; /* file identifier */
> herr_t status;
>
> /* Create a new file using default properties. */
> file_id =
> H5Fcreate("C:\\Development\\CBuilder2006\\NexusLibraryV5.0\\hdf5_test_fi
> le.hdf",
> H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
>
> /* Terminate access to the file. */
> status = H5Fclose(file_id);
>
> taken from the HDF5 tutorial, I get an HDF5 file without problem. So I
> believe I'm linked to HDF5 OK.
>
> Any suggestions? I'm using the same routine to create files for HDF4,
> HDF5 and XML. HDF4 and XML work fine--just HDF5 fails. I'm using
> Nexus3.0 and HDF5-1.65.
>
> Thanks in advance for any help!
>
> Brian Tieman
> Advanced Photon Source
> Argonne National Laboratory
> _______________________________________________
> NeXus mailing list
> NeXus at nexusformat.org
> http://lists.nexusformat.org/mailman/listinfo/nexus
>
> _______________________________________________
> NeXus mailing list
> NeXus at nexusformat.org
> http://lists.nexusformat.org/mailman/listinfo/nexus
>
More information about the NeXus
mailing list