diff options
Diffstat (limited to 'gen/generators.py')
-rw-r--r-- | gen/generators.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/gen/generators.py b/gen/generators.py index dd6f1cc..fccc747 100644 --- a/gen/generators.py +++ b/gen/generators.py | |||
@@ -186,7 +186,7 @@ class BaseGenerator(object): | |||
186 | '''Configure a generated taskset with extra parameters.''' | 186 | '''Configure a generated taskset with extra parameters.''' |
187 | pass | 187 | pass |
188 | 188 | ||
189 | def create_exps(self, out_dir, force): | 189 | def create_exps(self, out_dir, force, trials): |
190 | '''Create experiments for all possible combinations of params in | 190 | '''Create experiments for all possible combinations of params in |
191 | @out_dir. Overwrite existing files if @force is True.''' | 191 | @out_dir. Overwrite existing files if @force is True.''' |
192 | builder = ColMapBuilder() | 192 | builder = ColMapBuilder() |
@@ -199,19 +199,24 @@ class BaseGenerator(object): | |||
199 | col_map = builder.build() | 199 | col_map = builder.build() |
200 | 200 | ||
201 | for dp in DesignPointGenerator(self.params): | 201 | for dp in DesignPointGenerator(self.params): |
202 | dir_leaf = "sched=%s_%s" % (self.name, col_map.encode(dp)) | 202 | for trial in xrange(trials): |
203 | dir_path = "%s/%s" % (out_dir, dir_leaf.strip('_')) | 203 | # Create directory name from relevant parameters |
204 | dir_leaf = "sched=%s_%s" % (self.name, col_map.encode(dp)) | ||
205 | dir_leaf = dir_leaf.strip('_') # If there are none | ||
206 | dir_leaf += ("_trial=%s" % trial) if trials > 1 else "" | ||
204 | 207 | ||
205 | if os.path.exists(dir_path): | 208 | dir_path = "%s/%s" % (out_dir, dir_leaf.strip('_')) |
206 | if force: | 209 | |
207 | sh.rmtree(dir_path) | 210 | if os.path.exists(dir_path): |
208 | else: | 211 | if force: |
209 | print("Skipping existing experiment: '%s'" % dir_path) | 212 | sh.rmtree(dir_path) |
210 | continue | 213 | else: |
214 | print("Skipping existing experiment: '%s'" % dir_path) | ||
215 | continue | ||
211 | 216 | ||
212 | os.mkdir(dir_path) | 217 | os.mkdir(dir_path) |
213 | 218 | ||
214 | self.__create_exp(dp, dir_path) | 219 | self.__create_exp(dict(dp), dir_path) |
215 | 220 | ||
216 | def print_help(self): | 221 | def print_help(self): |
217 | s = str(Template("""Generator $name: | 222 | s = str(Template("""Generator $name: |