forked from HpWang-whu/RoReg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_benchmark_global.py
42 lines (30 loc) · 1.53 KB
/
run_benchmark_global.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os, shutil
from multiprocessing import Pool
from pathlib import Path
PY3="python3"
GPU = "0"
os.environ["CUDA_VISIBLE_DEVICES"] = GPU
PREPROCESSING_DIR="/benchmark/experiments/RoReg/preprocessing/"
base_command = (f'{PY3}' + ' Test.py --RD --RM --ET yohoo')
# datasets = (['urban05', 'apartment', 'gazebo_summer', 'gazebo_winter', 'hauptgebaude', 'plain', 'stairs',
# 'wood_autumn', 'wood_summer', 'long_office_household', 'pioneer_slam', 'pioneer_slam3', 'box_met',
# 'p2at_met', 'planetary_map'])
datasets = (['wood_summer', 'long_office_household', 'pioneer_slam', 'pioneer_slam3', 'box_met',
'p2at_met', 'planetary_map'])
commands = []
for dataset in datasets:
full_command = (base_command + f' --testset {dataset}')
time_command = f'command time --verbose -o {PREPROCESSING_DIR}/roreg_stats/{dataset}_time.txt ' + full_command
nvidia_command = (f'nvidia-smi --query-gpu=timestamp,memory.used -i 0 --format=csv -lms 1 > {PREPROCESSING_DIR}'
f'/roreg_stats/{dataset}_memory.txt')
full_command_stats = f'parallel -j2 -u --halt now,success=1 ::: \'{time_command}\' \'{nvidia_command}\''
commands.append(full_command_stats)
if not os.path.exists(PREPROCESSING_DIR+"/roreg_stats"):
os.makedirs(PREPROCESSING_DIR+"/roreg_stats")
# save config in result directory
txt_commands = os.path.join(PREPROCESSING_DIR, "readme_roreg.md")
with open(txt_commands, 'w') as f:
for item in commands:
f.write("%s\n" % item)
pool = Pool(1)
pool.map(os.system, commands)