Skip to content

Conversation

@shanedsnyder
Copy link

  • various put/get API calls were all using the ncid rather than the varid to retrieve variable records

* various put/get API calls were all using the ncid rather than
  the varid to retrieve variable records
@shanedsnyder shanedsnyder requested a review from carns December 8, 2022 00:35
PNETCDF_VAR_PRE_RECORD();
struct pnetcdf_var_record_ref *rec_ref;
rec_ref = darshan_lookup_record_ref(pnetcdf_var_runtime->ncid_hash, &ncid, sizeof(int));
rec_ref = darshan_lookup_record_ref(pnetcdf_var_runtime->ncid_hash, &varid, sizeof(int));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd to look up varid in something called ncid_hash. Is this because the ncid_hash data structure is doing double duty to track both depending on whether it is instrumentation for the pnetcdf file module or the pnetcdf var module?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I was thinking that maybe ncid was a more general thing like a hid is in HDF5 (a hid could reference an open file, dataset, property list, etc.), but looking closer at the PnetCDF interface docs it's not. An ncid (which is just an int) refers specifically to an open file it looks like, so I see how that could get confusing. I'll change the name here to fix that up, too.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are both ncids and varids in the same hash, or does each module have its own hash table? At any rate, choosing a more generic name and putting a comment on it would probably help with readability going forward. Otherwise fix looks good.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not in the same hash. Looking closer at the code, I think it was just copying the HDF5 module where the same exact runtime structure could be used for files and datasets since everything is an hid. That works fine with the fix applied previously here, but it is confusing so I did try to fix. Maybe sanity check that 8538154 looks okay?

* `ncid_hash` name was confusing, so just add a new runtime
  structure for variables that defines a `varid_hash` instead.
Copy link

@carns carns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good deal, I like this organization with each module having it's own runtime struct with differentiated field names. Should help avoid mixups in the future.

@shanedsnyder shanedsnyder merged commit bf76fdf into main Dec 8, 2022
@shanedsnyder shanedsnyder added this to the 3.4.2 milestone Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants