yt.frontends.enzo.simulation_handling.EnzoSimulation.piter

EnzoSimulation.piter(storage=None)

Iterate over time series components in parallel.

This allows you to iterate over a time series while dispatching individual components of that time series to different processors or processor groups. If the parallelism strategy was set to be multi-processor (by “parallel = N” where N is an integer when the DatasetSeries was created) this will issue each dataset to an N-processor group. For instance, this would allow you to start a 1024 processor job, loading up 100 datasets in a time series and creating 8 processor groups of 128 processors each, each of which would be assigned a different dataset. This could be accomplished as shown in the examples below. The storage option is as seen in parallel_objects() which is a mechanism for storing results of analysis on an individual dataset and then combining the results at the end, so that the entire set of processors have access to those results.

Note that supplying a store changes the iteration mechanism; see below.

Parameters:

storage : dict

This is a dictionary, which will be filled with results during the course of the iteration. The keys will be the dataset indices and the values will be whatever is assigned to the result attribute on the storage during iteration.

Examples

Here is an example of iteration when the results do not need to be stored. One processor will be assigned to each dataset.

>>> ts = DatasetSeries("DD*/DD*.index")
>>> for ds in ts.piter():
...    SlicePlot(ds, "x", "Density").save()
...

This demonstrates how one might store results:

>>> def print_time(ds):
...     print ds.current_time
...
>>> ts = DatasetSeries("DD*/DD*.index",
...             setup_function = print_time )
...
>>> my_storage = {}
>>> for sto, ds in ts.piter(storage=my_storage):
...     v, c = ds.find_max("density")
...     sto.result = (v, c)
...
>>> for i, (v, c) in sorted(my_storage.items()):
...     print "% 4i  %0.3e" % (i, v)
...

This shows how to dispatch 4 processors to each dataset:

>>> ts = DatasetSeries("DD*/DD*.index",
...                     parallel = 4)
>>> for ds in ts.piter():
...     ProjectionPlot(ds, "x", "Density").save()
...