Open kyleaoman opened 1 week ago
All of the basics are now in place! Some further nice-to-have stuff:
SWIFTGalaxies
(keep support in SWIFTGalaxy
for now).SWIFTGalaxies.split(n)
to return a list of n
SWIFTGalaxies
instances each with a fraction approx 1/n
of the ensemble of target regions (where each region could contain many target galaxies). This can easily be farmed out to multiple processes (maybe a SWIFTGalaxies.sub(n, N)
approach makes more sense so that each process gets a copy-on-write instance and then picks out its own share?). Some cookbook examples useful here.SWIFTGalaxies.map(f)
to apply a function f
to each SWIFTGalaxy
and collect the results. Could combine with split
(or sub
) to offer some parallelization built in. Does swiftsimio
have a forced serial execution mode? If not nested parallel will be a problem.And of course:
If we want to iterate over many galaxies that lie in the same top-level cell(s) in the snapshot then creating separate SWIFTGalaxy objects will be inefficient because each time a SWIFTGalaxy is created the same particles will be read from disk, and then all but those corresponding to the halo of interest will be discarded. Instead we would like to do the expensive disk i/o once and then temporarily mask out particles that don't belong to the current galaxy of interest while iterating over galaxies.
We can do this cleverly using existing SWIFTGalaxy functionality: it's already easy to return a SWIFTGalaxy that is a subset (masked) of a SWIFTGalaxy. Draft workflow looks like: