-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPGDL_server_individual_execution.py
35 lines (29 loc) · 1.42 KB
/
PGDL_server_individual_execution.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
import json
import sys
import os
gpu_number = int(sys.argv[1])
# Make visible only the GPUs specified in the argument
os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_number)
from model.experiments_group import perform_experiment
def execute_task(json_template_task, topo_weight_task):
with open(json_template_task) as json_specs:
base_experiment_specs = json.load(json_specs)
base_root_filepath_to_save_experiments = base_experiment_specs['root_filepath_to_save_experiments']
experiment_specs = base_experiment_specs.copy()
experiment_specs['root_filepath_to_save_experiments'] = f'{base_root_filepath_to_save_experiments}' \
f'/topo_weight_{topo_weight_task}'
experiment_specs['topo_weight'] = topo_weight_task
iterations_to_plot = int(experiment_specs['iterations_to_plot'])
perform_experiment(experiment_specification=experiment_specs, iterations_to_plot=iterations_to_plot,
verbose=True)
if __name__ == '__main__':
# First argument: gpu_number
# Second argument: json_tempalte
# Third argument: topo_weight
try:
json_template = sys.argv[2]
topo_weight = float(sys.argv[3])
except Exception:
print("The arguments must be specified correctly. See the file script for more information")
sys.exit()
execute_task(json_template, topo_weight)