aboutsummaryrefslogtreecommitdiffstats
path: root/astro/oskar/run_oskar.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-02-04 15:45:35 +0800
committerAaron LI <aly@aaronly.me>2018-02-04 15:45:35 +0800
commit75017f26eb6657130c48921a747e829d02c0a9c3 (patch)
treee1ebc967e9a4ce2ded966016eee9993442b126c2 /astro/oskar/run_oskar.py
parent1a76f267601847a7c63c216fab6f736a280e33cb (diff)
downloadatoolbox-75017f26eb6657130c48921a747e829d02c0a9c3.tar.bz2
astro/run_oskar.py: better report time cost
Diffstat (limited to 'astro/oskar/run_oskar.py')
-rwxr-xr-xastro/oskar/run_oskar.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/astro/oskar/run_oskar.py b/astro/oskar/run_oskar.py
index 145a083..e2e8653 100755
--- a/astro/oskar/run_oskar.py
+++ b/astro/oskar/run_oskar.py
@@ -68,10 +68,13 @@ def run_oskar(configfile, model, freq, vis_ms, vis_oskar=None,
if dryrun:
print("Dry run mode -> DONE!")
else:
- t1 = time()
+ tstart = time()
subprocess.check_call(cmd)
- t2 = time()
- print("Elapsed time: %.1f [min]" % ((t2-t1)/60))
+ tcost = time() - tstart
+ if tcost <= 3*60:
+ print("Elapsed time: %.1f [sec]" % tcost)
+ else:
+ print("Elapsed time: %.1f [min]" % (tcost/60))
print("-------------------------------------------------------------")
@@ -124,7 +127,7 @@ def main():
help="list of sky model items in format of " +
"'<freq[MHz]>:<skymodel-file>'")
args = parser.parse_args()
- t1 = time()
+ tstart = time()
use_gpus = None
if args.use_gpu:
@@ -184,9 +187,12 @@ def main():
use_gpus=use_gpus, gpu_ids=args.gpu_ids,
num_devices=args.num_devices, dryrun=args.dryrun)
- t2 = time()
+ tcost = time() - tstart
print("=============================================================")
- print("Total elapsed time: %.1f [min]" % ((t2-t1)/60))
+ if tcost <= 3*60:
+ print("Total elapsed time: %.1f [sec]" % tcost)
+ else:
+ print("Total elapsed time: %.1f [min]" % (tcost/60))
if __name__ == "__main__":