Skip to content

Commit e973f6b

Browse files
committed
Fixed GPU assignment in hyper param search after upstream fetch
1 parent db80b60 commit e973f6b

File tree

2 files changed

+137
-128
lines changed

2 files changed

+137
-128
lines changed

.gitignore

Lines changed: 130 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,130 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
lib/
19-
lib64/
20-
parts/
21-
sdist/
22-
var/
23-
wheels/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
28-
# PyInstaller
29-
# Usually these files are written by a python script from a template
30-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31-
*.manifest
32-
*.spec
33-
34-
# Installer logs
35-
pip-log.txt
36-
pip-delete-this-directory.txt
37-
38-
# Unit test / coverage reports
39-
htmlcov/
40-
.tox/
41-
.coverage
42-
.coverage.*
43-
.cache
44-
nosetests.xml
45-
coverage.xml
46-
*.cover
47-
.hypothesis/
48-
49-
# Translations
50-
*.mo
51-
*.pot
52-
53-
# Django stuff:
54-
*.log
55-
local_settings.py
56-
57-
# Flask stuff:
58-
instance/
59-
.webassets-cache
60-
61-
# Scrapy stuff:
62-
.scrapy
63-
64-
# Sphinx documentation
65-
docs/_build/
66-
67-
# PyBuilder
68-
target/
69-
70-
# Jupyter Notebook
71-
.ipynb_checkpoints
72-
73-
# pyenv
74-
.python-version
75-
76-
# celery beat schedule file
77-
celerybeat-schedule
78-
79-
# SageMath parsed files
80-
*.sage.py
81-
82-
# dotenv
83-
.env
84-
85-
# virtualenv
86-
.venv
87-
venv/
88-
ENV/
89-
90-
# Spyder project settings
91-
.spyderproject
92-
.spyproject
93-
94-
# Rope project settings
95-
.ropeproject
96-
97-
# mkdocs documentation
98-
/site
99-
100-
# mypy
101-
.mypy_cache/
102-
103-
# Test datafiles
104-
out.dat
105-
wrds_top_2000_3mo_lag.dat
106-
sample_data_wrds.dat
107-
output.txt
108-
109-
# Training checkpoints
110-
training.ckpt*
111-
checkpoint
112-
*.pkl
113-
114-
#pycharm
115-
.idea/
116-
117-
# Error-Analysis temp files
118-
/error-analysis/test_EA/
119-
/error-analysis/errorplotting.py
120-
/error-analysis/**/*.txt
121-
/error-analysis/**/*.pyc
122-
/error-analysis/**/*.png
123-
/error-analysis/**/*.jpg
124-
/error-analysis/**/*.csv
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
49+
# Translations
50+
*.mo
51+
*.pot
52+
53+
# Django stuff:
54+
*.log
55+
local_settings.py
56+
57+
# Flask stuff:
58+
instance/
59+
.webassets-cache
60+
61+
# Scrapy stuff:
62+
.scrapy
63+
64+
# Sphinx documentation
65+
docs/_build/
66+
67+
# PyBuilder
68+
target/
69+
70+
# Jupyter Notebook
71+
.ipynb_checkpoints
72+
73+
# pyenv
74+
.python-version
75+
76+
# celery beat schedule file
77+
celerybeat-schedule
78+
79+
# SageMath parsed files
80+
*.sage.py
81+
82+
# dotenv
83+
.env
84+
85+
# virtualenv
86+
.venv
87+
venv/
88+
ENV/
89+
90+
# Spyder project settings
91+
.spyderproject
92+
.spyproject
93+
94+
# Rope project settings
95+
.ropeproject
96+
97+
# mkdocs documentation
98+
/site
99+
100+
# mypy
101+
.mypy_cache/
102+
103+
# Test datafiles
104+
out.dat
105+
wrds_top_2000_3mo_lag.dat
106+
sample_data_wrds.dat
107+
output.txt
108+
109+
# Training checkpoints
110+
training.ckpt*
111+
checkpoint
112+
*.pkl
113+
114+
#pycharm
115+
.idea/
116+
117+
# Error-Analysis temp files
118+
/error-analysis/test_EA/
119+
/error-analysis/errorplotting.py
120+
/error-analysis/**/*.txt
121+
/error-analysis/**/*.pyc
122+
/error-analysis/**/*.png
123+
/error-analysis/**/*.jpg
124+
/error-analysis/**/*.csv
125+
126+
# Experiments
127+
/exprmnts/
128+
129+
# Datasets
130+
/datasets/

scripts/hyper_param_search.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_search_configs():
5353
configurations.DEFINE_integer("num_threads",4,"NUmber of parallel threads (Number of parallel executions)")
5454
configurations.DEFINE_integer("num_gpu",1,"Number of GPU on the machine, Use 0 if there are None")
5555
configurations.DEFINE_integer("sleep_time",1,"Sleep time")
56-
configurations.DEFINE_float("mutate_rate",0.2,"Mutation rate for genetic algorithm")
56+
configurations.DEFINE_float("mutate_rate",0.02,"Mutation rate for genetic algorithm")
5757
configurations.DEFINE_string("init_pop",None,"Specify starting population. Path to the pickle file")
5858

5959
c = configurations.ConfigValues()
@@ -157,16 +157,19 @@ def create_train_scripts(pop,gen):
157157
m = len(pop)//_NUM_THREADS
158158
pop_idxs = [thread*m + i for i in range(m)]
159159
for i in pop_idxs:
160+
id_seed = int(17*gen + i)
160161
# Add GPU number to the members of the generation
161162
if _NUM_GPU!=0:
162-
str = "CUDA_VISIBLE_DEVICES=%d"%thread
163+
str = "CUDA_VISIBLE_DEVICES=%d"%(thread%_NUM_GPU)
163164
elif _NUM_GPU==0:
164165
str = "CUDA_VISIBLE_DEVICES=''"
165166
str += " deep_quant.py"
166167
str += " --config=config/"+config_filename(gen,i)
168+
#str += " --seed=%i"%id_seed
169+
str += " --cache_id=%i"%id_seed
167170
str += " > " + output_filename(gen,i)
168171
str += " 2> output/stderr-%s.txt"%get_name(gen,i)
169-
str += "; rm -rf chkpts/chkpts-%s"%get_name(gen,i)+";"
172+
#str += "; rm -rf chkpts/chkpts-%s"%get_name(gen,i)+";"
170173
print(str,file=f)
171174
donefile = donefile_filename(gen,thread)
172175
print("echo 'done.' > %s"%donefile,file=f)
@@ -337,7 +340,7 @@ def execute_genetic_search(args):
337340

338341
# Read user specified or latest population
339342
if args.init_pop:
340-
pop = pickle.load(open(str(args.init_pop)),"rb")
343+
pop = pickle.load(open(str(args.init_pop),"rb"))
341344
else:
342345
pop = init_population(config)
343346

0 commit comments

Comments
 (0)