@@ -543,7 +543,8 @@ def get_parser() -> argparse.ArgumentParser:
543543 "if amounts of work and or input/output file sizes are too small)." )
544544 parser .add_argument ("--gpu-work" , default = None , help = "Amount of GPU work." )
545545 parser .add_argument ("--time" , default = None , help = "Time limit (in seconds) to complete "
546- "the computational portion of the benchmark (overrides CPU and GPU works)." )
546+ "the computational portion of the benchmark (overrides CPU and GPU works). "
547+ "Is only approximate since I/O time may make the overall time longer." )
547548 parser .add_argument ("--mem" , type = float , default = None , help = "Maximum memory consumption (in MB)." )
548549 parser .add_argument ("--output-files" , help = "Output file names with sizes in bytes as a JSON dictionary "
549550 "(e.g., --output-files {\\ \" file1\\ \" : 1024, \\ \" file2\\ \" : 2048})." )
@@ -591,7 +592,7 @@ def compute_num_chunks(args):
591592 num_chunks_gpu = min (int (args .num_chunks ), int (float (args .gpu_work ) / min_chunk_size_gpu_work ))
592593 else :
593594 num_chunks_gpu = 1
594- num_chunks = min (num_chunks_cpu , num_chunks_cpu )
595+ num_chunks = min (num_chunks_cpu , num_chunks_gpu )
595596
596597 num_chunks = max (num_chunks , 1 ) # The above computations may say "zero"
597598 return num_chunks
@@ -624,9 +625,9 @@ def main():
624625 path_cores = pathlib .Path (args .path_cores )
625626 core = lock_core (path_locked , path_cores )
626627
627- if args .time and (not args .cpu_work and not args .gpu_work ):
628- log_error ("If --time is provided, at least one of --cpu-work and --gpu-work must also be provided." )
629- sys .exit (1 )
628+ # if args.time and (not args.cpu_work and not args.gpu_work):
629+ # log_error("If --time is provided, at least one of --cpu-work and --gpu-work must also be provided.")
630+ # sys.exit(1)
630631
631632 # Compute the (feasible) number of chunks based on the arguments
632633 num_chunks = compute_num_chunks (args )
@@ -741,11 +742,12 @@ def main():
741742
742743 # If time based, sleep the required amount of time and kill the process
743744 if args .time :
744- time .sleep (float (args .time ) / num_chunks )
745- if cpu_benchmark_process is not None :
746- cpu_benchmark_process .terminate_along_with_children ()
747- if gpu_benchmark_process is not None :
748- gpu_benchmark_process .terminate ()
745+ if cpu_benchmark_process is not None or gpu_benchmark_process is not None :
746+ time .sleep (float (args .time ) / num_chunks )
747+ if cpu_benchmark_process is not None :
748+ cpu_benchmark_process .terminate_along_with_children ()
749+ if gpu_benchmark_process is not None :
750+ gpu_benchmark_process .terminate ()
749751
750752 # Wait for the I/O processes to be done
751753 if io_read_process is not None :
0 commit comments