@@ -105,8 +105,8 @@ def analyze_run(sim):
105105 sim .categories ['gpu' ], sim .categories ['host' ], ncores )
106106
107107
108- def write_bench (top , tmpl , nodes , gpu , module , tpr , name , host , time ):
109- """ Writes a single gromacs benchmark file and the respective sim object
108+ def write_bench (top , tmpl , nodes , gpu , module , name , host , time ):
109+ """Generates a single job file for GROMACS and the respective Sim object.
110110 """
111111 sim = mds .Sim (
112112 top ['{}/' .format (nodes )],
@@ -120,7 +120,12 @@ def write_bench(top, tmpl, nodes, gpu, module, tpr, name, host, time):
120120 'started' : False
121121 })
122122
123- copyfile (tpr , sim [tpr ].relpath )
123+ full_filename = name + '.tpr'
124+ if name .endswith ('.tpr' ):
125+ full_filename = name
126+ name = name [:- 4 ]
127+
128+ copyfile (full_filename , sim [full_filename ].relpath )
124129 # Add some time buffer to the requested time. Otherwise the queuing system
125130 # kills the jobs before GROMACS can finish
126131 formatted_time = '{:02d}:{:02d}:00' .format (* divmod (time + 5 , 60 ))
@@ -140,22 +145,20 @@ def write_bench(top, tmpl, nodes, gpu, module, tpr, name, host, time):
140145 fh .write (script )
141146
142147
143- def check_file_extension (name ):
144- """ check and append the correct file extensions for the given module .
148+ def check_input_file_exists (name ):
149+ """Check if the TPR file exists .
145150 """
146- # Check that the .tpr file exists.
147- fn , ext = os .path .splitext (name )
148-
149- if ext == '' :
150- ext = '.tpr'
151+ fn = name
152+ if fn .endswith ('.tpr' ):
153+ fn = name [:- 4 ]
151154
152- tpr = fn + ext
155+ tpr = fn + '.tpr'
153156 if not os .path .exists (tpr ):
154157 console .error (
155158 "File {} does not exist, but is needed for GROMACS benchmarks." ,
156159 tpr )
157160
158- return tpr
161+ return
159162
160163
161164def cleanup_before_restart (sim ):
0 commit comments