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

Improves IO performance for the report readers #104

Merged
merged 6 commits into from
Oct 20, 2020
Merged

Conversation

sergiorg-hpc
Copy link
Contributor

@sergiorg-hpc sergiorg-hpc commented Oct 9, 2020

Changes

IO:

  • Loop through rows (timesteps) instead of columns (node_ids).
    • Changes from tsteps * node_ids reads, to tsteps reads (i.e.,
      constant time in terms of IO, regardless of node_ids reqs.).
  • Read all node_ids in a buffer every timestep, between min and max
    offsets of node_ids requested.

Memory:

  • Allocate buffer before passing to HighFive to avoid extra and
    unnecessary memory allocations before reading.
  • Change data structure of node_ids/offsets from vector to map
    for faster search (from n^2 to nlogn).
  • In soma reports, assign values directly to return buffer instead
    of std::copy/memcpy.

New features and others:

  • Add support for strided reads, allowing to reduce the amount of
    timesteps (e.g., 1 by default, 2 for every 2 timesteps, etc.).
  • Eliminate duplicated code, avoid calling HDF5 metadata in every
    iteration, updated unit tests, and other minor changes.

Important note

Performance evaluations and other related discussions can be obtained here:
https://bbpteam.epfl.ch/project/issues/browse/REP-60
https://bbpteam.epfl.ch/project/issues/browse/BLPY-217

> IO:
  * Loop through rows (timesteps) instead of columns (node_ids).
      - Changes from tsteps * node_ids reads, to tsteps reads (i.e.,
        constant time in terms of IO, regardless of node_ids reqs.).
  * Read all node_ids in a buffer every timestep, between min and max
    offsets of node_ids requested.

> Memory
  * Allocate buffer before passing to HighFive to avoid extra and
    unnecessary memory allocations before reading.
  * Change data structure of node_ids/offsets from vector to map
    for faster search (from n^2 to nlogn).
  * In soma reports, assign values directly to return buffer instead
    of std::copy/memcpy.

> New features and others:
  * Add support for strided reads, allowing to reduce the amount of
    timesteps (e.g., 1 by default, 2 for every 2 timesteps, etc.).
  * Eliminate duplicated code, avoid calling HDF5 metadata in every
    iteration, updated unit tests, and other minor changes.
alkino
alkino previously approved these changes Oct 9, 2020
src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
@alkino
Copy link
Member

alkino commented Oct 9, 2020

Really nice way to improve things

matz-e
matz-e previously approved these changes Oct 9, 2020
Copy link
Member

@matz-e matz-e left a comment

Choose a reason for hiding this comment

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

Great! Some nitpicks about the docs… if that's intentional, please ignore.

include/bbp/sonata/report_reader.h Show resolved Hide resolved
include/bbp/sonata/report_reader.h Outdated Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
Copy link
Contributor

@mgeplf mgeplf left a comment

Choose a reason for hiding this comment

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

Very nice addition.

src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
src/report_reader.cpp Show resolved Hide resolved
src/report_reader.cpp Outdated Show resolved Hide resolved
@sergiorg-hpc
Copy link
Contributor Author

sergiorg-hpc commented Oct 19, 2020

@jorblancoa and I went through all the comments and suggestions, and integrated everything (specially Jorge, thanks for the effort). Thanks for all the great feedback!

If no one has any additional comments, we are ready to close the PR and merge the changes!

alkino
alkino previously approved these changes Oct 19, 2020
include/bbp/sonata/report_reader.h Outdated Show resolved Hide resolved
python/tests/test.py Show resolved Hide resolved
@mgeplf mgeplf self-requested a review October 20, 2020 11:20
Copy link
Contributor

@mgeplf mgeplf left a comment

Choose a reason for hiding this comment

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

LGTM, nice work!

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.

7 participants