HDFGroup / hdf5-tutorial

A tutorial for new and intermediate HDF5 users (of all ages)
11 stars 6 forks source link

Update 06-LibHDF5-to-HSDS.ipynb #30

Closed gheber closed 5 months ago

gheber commented 6 months ago

This issue depends on the resolution of #28 .

gheber commented 5 months ago

We have HSDS baked into the codespace (See here.)

We need to update the notebook in the following ways:

  1. Check out and build an HDF5 1.14.x version.
  2. Check out and build the REST VOL.
  3. Modify the C++ example to use the REST VOL.
  4. Polish the multi-dataset example.

Questions?

gheber commented 5 months ago

I got your example to work. See e0df211.

gheber commented 5 months ago

I modified the C++ theme to use the REST VOL. See 6971107. Building the REST VOL is a mess. How do you build it? I find the installation instructions more confusing than helpful.

gheber commented 5 months ago

When building the REST VOL, I'm getting these warnings:

/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_attr.c: In function ‘RV_attr_open’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_attr.c:658:63: warning: passing argument 2 of ‘RV_parse_response’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  658 |             if (0 > RV_parse_response(response_buffer.buffer, (const void *)&loc_params->loc_data.loc_by_idx,
      |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_attr.h:14,
                 from /workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_attr.c:18:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol.h:694:53: note: expected ‘void *’ but argument is of type ‘const void *’
  694 | herr_t RV_parse_response(char *HTTP_response, void *callback_data_in, void *callback_data_out,
      |                                               ~~~~~~^~~~~~~~~~~~~~~~
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol.c: In function ‘H5_rest_url_encode_path’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol.c:1542:12: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
 1542 |     path = (char *)_path;
      |            ^
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_dataset.c: In function ‘RV_dataset_write’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_dataset.c:924:63: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  924 |         transfer_info[i].buf                                = (void *)buf[i];
      |                                                               ^
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_dataset.c:1095:30: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1095 |                 buf_to_write = (const void *)((const char *)buf_to_write + (size_t)offset * dtype_size);
      |                              ^
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_file.c: In function ‘RV_iterate_copy_hid_cb’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_file.c:993:40: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘ssize_t’ {aka ‘long int’} may change the sign of the result [-Wsign-conversion]
  993 |         if ((containing_filename_len = H5Fget_name(obj_id, NULL, 0)) < 0)
      |                                        ^~~~~~~~~~~
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_object.c: In function ‘RV_object_get’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_object.c:608:47: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  608 |                                               (void *)&loc_params->loc_data.loc_by_idx, &found_object_name,
      |                                               ^
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_link.c: In function ‘RV_link_get’:
/workspaces/hdf5-tutorial/build/rest-vol/src/rest_vol_link.c:639:52: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  639 |             by_idx_data.idx_p                      = &loc_params->loc_data.loc_by_idx.n;
      |                                   

Is there something we can do about that?

gheber commented 5 months ago

I'm happy with this first draft. Please review if the commentary makes sense.

mattjala commented 5 months ago

I modified the C++ theme to use the REST VOL. See 6971107. Building the REST VOL is a mess. How do you build it? I find the installation instructions more confusing than helpful.

I use the build script build_vol_cmake.sh with a prebuilt HDF5 installation. Which parts of the installation instructions were confusing? The instructions do need an update pass to remove some outdated information about HDF Kita and old branches - we can take the opportunity to make them easier to understand as well.

The warnings are fixed in a PR that's waiting on review (HDFGroup/vol-rest#85).

The commentary on the CPP program makes sense. The comment Write the sample paths to an HDF5 file using the HDF5 REST VOL! could be changed to say write to an HSDS domain instead to make the difference from normal library operation more obvious, but this could be confusing to people who don't know or care how HSDS stores HDF5 file information. It's probably fine as-is.