@@ -171,7 +171,7 @@ def check(pipeline: Union[Path, str], in_data_file: Optional[Path] = None):
171171 "--max-memory" ,
172172 type = click .STRING ,
173173 default = "0" ,
174- help = "Limit the amount of memory used by the pipeline to the given memory (supports strings like 3.2G or bytes)" ,
174+ help = "The maximum amount of the CPU memory per process available on the system (supports strings like 3.2G or bytes)" ,
175175)
176176@click .option (
177177 "--save-snapshots" ,
@@ -324,6 +324,10 @@ def run(
324324 format_enum ,
325325 )
326326
327+ for wrapper in pipeline_object :
328+ wrapper .check ()
329+ wrapper .prep ()
330+
327331 if not does_contain_sweep :
328332 execute_high_throughput_run (
329333 pipeline_object ,
@@ -539,7 +543,12 @@ def execute_sweep_run(pipeline: Pipeline, global_comm: MPI.Comm) -> None:
539543 ParamSweepRunner (pipeline , global_comm ).execute ()
540544
541545
542- def estimate_cpu_memory (in_data_file : Path , pipeline_file : Path , nprocs : int ) -> int :
546+ def estimate_cpu_memory (
547+ in_data_file : Path ,
548+ pipeline_file : Path ,
549+ nprocs : int ,
550+ shape : Optional [tuple [int , int , int ]] = None ,
551+ ) -> int :
543552 pipeline = generate_pipeline (
544553 in_data_file , pipeline_file , False , MPI .COMM_WORLD , PipelineFormat .Yaml
545554 )
@@ -551,14 +560,17 @@ def estimate_cpu_memory(in_data_file: Path, pipeline_file: Path, nprocs: int) ->
551560 dtype = dataset .dtype
552561 full_shape = dataset .shape
553562
554- preview_config = parse_preview (
555- config [0 ]["parameters" ].get ("preview" , None ), full_shape
556- )
557- previewed_shape = (
558- preview_config .angles .stop - preview_config .angles .start ,
559- preview_config .detector_y .stop - preview_config .detector_y .start ,
560- preview_config .detector_x .stop - preview_config .detector_x .start ,
561- )
563+ if shape is None :
564+ preview_config = parse_preview (
565+ config [0 ]["parameters" ].get ("preview" , None ), full_shape
566+ )
567+ previewed_shape = (
568+ preview_config .angles .stop - preview_config .angles .start ,
569+ preview_config .detector_y .stop - preview_config .detector_y .start ,
570+ preview_config .detector_x .stop - preview_config .detector_x .start ,
571+ )
572+ else :
573+ previewed_shape = shape
562574
563575 section_memory_peak = 0
564576 for idx in range (len (sections )):
0 commit comments