Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report optimizations #191

Merged
merged 2 commits into from
Nov 16, 2017
Merged

Report optimizations #191

merged 2 commits into from
Nov 16, 2017

Conversation

hernando
Copy link
Contributor

No description provided.

The code has been unreachable for years because only URIs with .h5
or .hdf5 extension were accepted for the report plugin.
@bbpbuildbot
Copy link

Build finished.

@@ -45,16 +45,34 @@ class CompartmentReportInitData : public PluginInitData
* @param gids the neurons of interest in READ_MODE
* @version 1.4
*/
explicit CompartmentReportInitData(const URI& uri,
const int accessMode = MODE_READ,
explicit CompartmentReportInitData(const URI& uri, const int accessMode,
Copy link
Contributor

Choose a reason for hiding this comment

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

no explicit; technically also now version 3.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

{
if (_gids.empty())
return _header.numCells;
else
Copy link
Contributor

Choose a reason for hiding this comment

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

rm else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -662,29 +689,31 @@ bool CompartmentReportBinary::_parseHeader()
if (_tunit.empty())
_tunit = "ms";

// After parsing the header we figure out the end of the mapping by reading
// the data offset of the first cell.
_dataOffset = get<uint64_t>(ptr, DATA_INFO + _header.headerSize);
Copy link
Contributor

Choose a reason for hiding this comment

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

why did this move out of _parseMapping()? It's always the same for multiple updateMapping() calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I thought I had already answered this, but I can't see the comment)
Yes, in fact it should the data offset should be computable just with the information from the header, but it doesn't happen to be the case (or I didn't spend enough time figuring it out).

Copy link
Contributor

Choose a reason for hiding this comment

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

still no satisfying answer why you had to move the code. Where it was before should still work, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can't be at the original place. The offset is needed for remapping the file (line 282) and then read the GIDs, which is done even if the full mapping is not processed.

bool CompartmentReportBinary::_parseMapping()
{
const uint8_t* ptr = reinterpret_cast<const uint8_t*>(_file.data());
size_t offset = _header.headerSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Contributor Author

@hernando hernando Nov 14, 2017

Choose a reason for hiding this comment

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

can't be

@bbpbuildbot
Copy link

Build finished.

@hernando
Copy link
Contributor Author

I also removed cellCount from the metadata.
I'm actually wondering if it makes sense to keep this metadata struct (C++) / dictionary (python) or should we make all metadata functions/properties of the CompartmentReport class (@arsenius7, @tribal-tec opinions?)

@hernando
Copy link
Contributor Author

I made the change because even H5Gget_num_objs is too slow.

@bbpbuildbot
Copy link

Build finished.

@arsenius7
Copy link
Contributor

I'm actually wondering if it makes sense to keep this metadata struct (C++) / dictionary (python) or should we make all metadata functions/properties of the CompartmentReport class

As we discussed yesterday, I would propose to distinguish between 'required' and 'optional' metadata.
For 'required' fields (for BluePy these are now start_time, end_time, time_step), it makes perfect sense to move them to standalone methods.
For the optional ones I would keep them in the dict and relax any requirements on it (fixed key set, fast response etc). They could still be useful for debugging so I would suggest to keep them.

@bbpbuildbot
Copy link

Build finished.

@hernando
Copy link
Contributor Author

In fact, if I knew how to translate dict lookups in Python into function calls in C++ I wouldn't change the Python side. For the C++ side is not the same, as it doesn't provide the required language feature.

@hernando
Copy link
Contributor Author

ping

A new implementation only constructor has been added to
brion::CompartmentReport. This constructor can be used to request opening
a report without parsing the mapping. Looking up the GIDs is also skipped if
possible.

The plugin interface has been extended to include the hint about parsing the
mapping or not and a new function getCellCount has also been added. This
allows to complete the report metadata without looking up the GIDs.

The members compartmentCount and cellCount have been removed from
CompartmentReportMapping because they cannot be computed efficiently in H5
reports. To replace them, CompartmentReportMapping::getFrameSize and
CompartmentReport::getCellCount have been added. It also makes more
sense to know the total frame size of a view rather than the full report.

A potential bug in mapping parsing has been fixed in CompartmentReportBinary
(a read operation was accessing an address beyond the current memory map).
@bbpbuildbot
Copy link

Build finished.

@hernando hernando merged commit e84ff45 into master Nov 16, 2017
@hernando hernando deleted the report_optimizations branch November 16, 2017 14:38
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.

None yet

4 participants