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

Parallel concatenate #5926

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions benchmarks/benchmarks/merge_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ class Concatenate:
cube_list: CubeList

def setup(self):
source_cube = realistic_4d_w_everything()
second_cube = source_cube.copy()
first_dim_coord = second_cube.coord(dimensions=0, dim_coords=True)
first_dim_coord.points = (
first_dim_coord.points + np.ptp(first_dim_coord.points) + 1
)
self.cube_list = CubeList([source_cube, second_cube])
source_cube = realistic_4d_w_everything(lazy=True)
Copy link
Member Author

Choose a reason for hiding this comment

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

I enabled lazy=True because it seems more realistic, but the timings are very similar for both cases, maybe because the data is small enough to keep in RAM. Is this change wanted or should I change it back?

self.cube_list = CubeList([source_cube])
for _ in range(24):
Comment on lines +49 to +50
Copy link
Member Author

Choose a reason for hiding this comment

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

The concatenate benchmarks now concatenate 25 cubes, to make the benchmark more realistic but not too time-consuming.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried this branch with one year of high resolution data ( 12 cubes to concatenate) and I get a decrease in time of about 90 seconds with respect to main branch 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for testing @sloosvel! Do you know what the total time was as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I get around one minute for the parallel concatenation and two minutes / two minutes and a half for the main branch

next_cube = self.cube_list[-1].copy()
first_dim_coord = next_cube.coord(dimensions=0, dim_coords=True)
first_dim_coord.points = (
first_dim_coord.points + np.ptp(first_dim_coord.points) + 1
)
self.cube_list.append(next_cube)

def time_concatenate(self):
_ = self.cube_list.concatenate_cube()
Expand Down
Loading
Loading