Allow parallel I/O for hydro and particle reading#4730
Closed
cphyc wants to merge 8 commits intoyt-project:mainfrom
Closed
Allow parallel I/O for hydro and particle reading#4730cphyc wants to merge 8 commits intoyt-project:mainfrom
cphyc wants to merge 8 commits intoyt-project:mainfrom
Conversation
ce2aa15 to
a8d7767
Compare
cphyc
commented
Nov 3, 2023
| roff = [off * dtr for off in offsets] | ||
| rsize = [siz * dtr for siz in sizes] | ||
| tmp_recv = recv.view(self.__tocast) | ||
| tmp_recv = recv.view(transport_dtype) |
Member
Author
There was a problem hiding this comment.
The motivation for getting rid of the cast to CHAR is so that we do not hit the limit imposed by MPI of 2**31 elements when communicating arrays as quickly.
cphyc
commented
Nov 3, 2023
Comment on lines
+1153
to
+1156
| self.comm.send( | ||
| (arr.dtype.str, arr.shape, transport_dtype) + unit_metadata, | ||
| dest=dest, | ||
| tag=tag, | ||
| ) | ||
| self.comm.Send([arr, mpi_type], dest=dest, tag=tag) |
Member
Author
There was a problem hiding this comment.
Isn't there a bug here? I think this should be
Suggested change
| self.comm.send( | |
| (arr.dtype.str, arr.shape, transport_dtype) + unit_metadata, | |
| dest=dest, | |
| tag=tag, | |
| ) | |
| self.comm.Send([arr, mpi_type], dest=dest, tag=tag) | |
| self.comm.send( | |
| (arr.dtype.str, arr.shape, transport_dtype) + unit_metadata, | |
| dest=dest, | |
| tag=tag, | |
| ) | |
| self.comm.Send([tmp, mpi_type], dest=dest, tag=tag) |
Member
There was a problem hiding this comment.
I think it should be tmp, yeah, but since it has been working I think it's possible that mpi4py was fixing it implicitly.
Member
Author
|
@yt-fido test this please |
53f24bc to
c9fc44d
Compare
c9fc44d to
3097fde
Compare
Member
Author
|
After discussion with @matthewturk and @chrishavlin, we're proposing to implement this: import numpy as np
import yt
ds = yt.load(...)
yt.enable_parallelism()
ad = ds.all_data()
def expensive_function(chunk):
import time
time.sleep(np.random.rand() * 3600)
return 42
sto = {}
for chunk in ad.piter(storage=sto, reduction="min/max/sum/cat/cat_on_root"):
sto.result["gas", "density"] = chunk["gas", "density"]
sto.result["gas", "temperature"] = chunk["gas", "temperature"]
sto.result["expensive_stuff"] = expensive_function(chunk)
if yt.is_root():
mean_expensive_stuff = np.mean(sto["expensive_stuff"])
plt.hist2d(sto["gas", "density"], sto["gas", "temperature"], bins=...)
plt.title(f"{mean_expennsive_stuff=}")
plt.savefig("...") |
2 tasks
Member
Author
|
Closing since #5218 is much better. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This allows parallel I/O for the RAMSES dataset. Reading a RAMSES dataset has three steps:
The strategy I have adopted is to parallelize on the first one, such that each MPI task is now in charge of a few domains and only reads those (incl. hydro + particles).