-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_local.py
41 lines (29 loc) · 937 Bytes
/
main_local.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
"""
Run simulations and save results
"""
import os
from multiprocessing import Pool, cpu_count
from tqdm import tqdm
from run.make_data_triton import run
from settings.config_triton import Config
def make_data(config_file):
config = Config.get(config_file)
saving_df = run(config=config)
f_name = f"{config.config_file.split('.')[0]}.csv"
os.makedirs(config.data_folder, exist_ok=True)
saving_df.to_csv(os.path.join(config.data_folder, f_name))
def main():
files = [
p.path
for p in os.scandir(os.path.join("config", "triton"))
if os.path.splitext(p.path)[1] == ".json"
]
file_count = len(files)
assert file_count > 0
with Pool(processes=cpu_count()) as p:
max_ = file_count
with tqdm(total=max_) as pbar:
for i, _ in enumerate(p.imap_unordered(make_data, files)):
pbar.update()
if __name__ == "__main__":
main()