@@ -358,7 +358,7 @@ def get_parser() -> argparse.ArgumentParser:
358358 "(e.g., --output-files {\\ \" file1\\ \" : 1024, \\ \" file2\\ \" : 2048})." )
359359 parser .add_argument ("--input-files" , help = "Input files names as a JSON array "
360360 "(e.g., --input-files [\\ \" file3\\ \" , \\ \" file4\\ \" ])." )
361- parser .add_argument ("--silent " , action = "store_true" , help = "Disable all log messages." )
361+ parser .add_argument ("--verbose " , action = "store_true" , help = "Enable all log messages." )
362362 parser .add_argument ("--debug" , action = "store_true" , help = "Enable debug log messages." )
363363 parser .add_argument ("--with-flowcept" , action = "store_true" , default = False , help = "Enable Flowcept monitoring." )
364364 parser .add_argument ("--workflow_id" , default = None , help = "Id to group tasks in a workflow." )
@@ -387,21 +387,27 @@ def compute_num_chunks(time_limit, cpu_work, gpu_work, num_chunks):
387387 # Compute the (feasible number of chunks)
388388 min_chunk_size_time = 1 # At least 1 second per chunk, if we're doing time-based
389389 # TODO: Pick reasonable factors below so that a chunk takes about min_chunk_size_time sec on a reasonable machine
390- min_chunk_size_cpu_work = 3000000 * min_chunk_size_time # 1s on my MacBook Pro
391- min_chunk_size_gpu_work = 30000000 * min_chunk_size_time # unknown.....
390+ min_chunk_size_cpu_work = 2500 * min_chunk_size_time # 1s on Henri's MacBook Pro
391+ min_chunk_size_gpu_work = 2000 * min_chunk_size_time # unknown.....
392392
393393 if time_limit :
394394 num_chunks = min (num_chunks , time_limit // min_chunk_size_time )
395395 else :
396396 if cpu_work :
397397 num_chunks_cpu = min (num_chunks , cpu_work // min_chunk_size_cpu_work )
398398 else :
399- num_chunks_cpu = 1
399+ num_chunks_cpu = None
400400 if gpu_work :
401401 num_chunks_gpu = min (num_chunks , gpu_work // min_chunk_size_gpu_work )
402402 else :
403- num_chunks_gpu = 1
404- num_chunks = min (num_chunks_cpu , num_chunks_gpu )
403+ num_chunks_gpu = None
404+
405+ if num_chunks_cpu is None :
406+ num_chunks = num_chunks_gpu
407+ elif num_chunks_gpu is None :
408+ num_chunks = num_chunks_cpu
409+ else :
410+ num_chunks = min (num_chunks_cpu , num_chunks_gpu )
405411
406412 num_chunks = max (num_chunks , 1 ) # The above computations may say "zero"
407413 return num_chunks
@@ -412,7 +418,7 @@ def kill_current_handles(handles: list[ProcessHandle]):
412418 handle .terminate_along_with_children ()
413419
414420
415- def run (workflow_id , name , with_flowcept , silent , debug , rundir , path_lock , path_cores ,
421+ def run (workflow_id , name , with_flowcept , verbose , debug , rundir , path_lock , path_cores ,
416422 time_limit , cpu_work , percent_cpu , mem , gpu_work , num_chunks ,
417423 input_files , output_files ):
418424 """Main function."""
@@ -423,7 +429,7 @@ def run(workflow_id, name, with_flowcept, silent, debug, rundir, path_lock, path
423429 flowcept = None
424430 flowcept_task = None
425431
426- if silent :
432+ if verbose :
427433 logging .getLogger ().setLevel (logging .NOTSET )
428434 if debug :
429435 logging .getLogger ().setLevel (logging .DEBUG )
@@ -606,6 +612,9 @@ def main():
606612 if not args .time_limit and (not args .cpu_work and not args .gpu_work ):
607613 log_error ("At least one of --time-limit, --cpu-work, or --gpu-work should be provided." )
608614 sys .exit (1 )
615+ if args .time_limit and (not args .cpu_work and not args .gpu_work ):
616+ log_error ("In addition to --time-limit, at least one of --cpu-work or --gpu-work must be provided (to specify which kind of work should be done)." )
617+ sys .exit (1 )
609618
610619 run (** vars (args ))
611620
0 commit comments