@@ -99,7 +99,7 @@ def list_jars(path):
9999 ]
100100}
101101
102- _renaissance_config = {
102+ _renaissance_pre014_config = {
103103 "akka-uct" : {
104104 "group" : "actors-akka" ,
105105 "legacy-group" : "actors" ,
@@ -196,15 +196,15 @@ def list_jars(path):
196196}
197197
198198
199- def benchmark_group (benchmark , suite_version ):
199+ def pre014_benchmark_group (benchmark , suite_version ):
200200 if suite_version in ["0.9.0" , "0.10.0" , "0.11.0" ]:
201- return _renaissance_config [benchmark ].get ("legacy-group" , _renaissance_config [benchmark ]["group" ])
201+ return _renaissance_pre014_config [benchmark ].get ("legacy-group" , _renaissance_pre014_config [benchmark ]["group" ])
202202 else :
203- return _renaissance_config [benchmark ]["group" ]
203+ return _renaissance_pre014_config [benchmark ]["group" ]
204204
205205
206- def requires_recompiled_harness (benchmark , suite_version ):
207- requires_harness = _renaissance_config [benchmark ].get ("requires-recompiled-harness" , False )
206+ def pre014_requires_recompiled_harness (benchmark , suite_version ):
207+ requires_harness = _renaissance_pre014_config [benchmark ].get ("requires-recompiled-harness" , False )
208208 if isinstance (requires_harness , list ):
209209 return suite_version in requires_harness
210210 return requires_harness
@@ -215,10 +215,10 @@ class RenaissanceNativeImageBenchmarkSuite(mx_java_benchmarks.RenaissanceBenchma
215215 Building an image for a renaissance benchmark requires all libraries for the group this benchmark belongs to
216216 and a harness project compiled with the same scala version as the benchmark.
217217 Since we don't support building an image from fat-jars, we extract them to create project dependencies.
218- Depending on the benchmark's scala version we create corresponding renaissance harness and benchmark projects,
219- we set this harness project as a dependency for the benchmark project and collect project's classpath.
220- For each renaissance benchmark we store an information about the group and scala version in _renaissance-config.
221- We build an image from renaissance jar with the classpath as previously described, provided configurations and extra arguments while neccessary .
218+
219+ On recent renaissance versions (>= 0.14.0), it's only necessary to extract the fatjar and run the standalone jar
220+ of a given benchmark. Those standalone jars define the minimal classpath and include the matching harness for the
221+ scala version needed by the benchmark .
222222 """
223223
224224 def name (self ):
@@ -228,24 +228,35 @@ def benchSuiteName(self, bmSuiteArgs=None):
228228 return 'renaissance'
229229
230230 def renaissance_harness_lib_name (self ):
231+ # Before Renaissance 0.14.0, we had to cross-compile the Renaissance harness to ensure we have a matching
232+ # harness for each project compiled with different scala versions.
233+ # As of Renaissance 0.14.0, we use the standalone mode of renaissance which already creates a native-image
234+ # friendly classpath and already bundles all harness versions needed.
231235 version_to_run = self .version ()
232- version_end_index = str (version_to_run ).rindex ('.' )
233- return 'RENAISSANCE_HARNESS_v' + str (version_to_run )[0 :version_end_index ]
236+ if version_to_run in ["0.9.0" , "0.10.0" , "0.11.0" , "0.12.0" , "0.13.0" ]:
237+ version_end_index = str (version_to_run ).rindex ('.' )
238+ return 'RENAISSANCE_HARNESS_v' + str (version_to_run )[0 :version_end_index ]
239+ else :
240+ return None
234241
235242 def harness_path (self ):
236- lib = mx .library (self .renaissance_harness_lib_name ())
237- if lib :
238- return lib .get_path (True )
243+ harness_lib = self .renaissance_harness_lib_name ()
244+ if harness_lib is not None :
245+ lib = mx .library (harness_lib )
246+ if lib :
247+ return lib .get_path (True )
239248 return None
240249
241- # Before supporting new Renaissance versions, we must cross-compile Renaissance harness project
242- # with scala 11 for benchmarks compiled with this version of Scala.
243250 def availableSuiteVersions (self ):
244- return ["0.9.0" , "0.10.0" , "0.11.0" , "0.12.0" , "0.13.0" ]
251+ return ["0.9.0" , "0.10.0" , "0.11.0" , "0.12.0" , "0.13.0" , "0.14.0" ]
245252
246253 def renaissance_unpacked (self ):
247254 return extract_archive (self .renaissancePath (), 'renaissance.extracted' )
248255
256+ def standalone_jar_path (self , benchmark_name ):
257+ standalone_jars_directory = "single"
258+ return os .path .join (self .renaissance_unpacked (), standalone_jars_directory , "{}.jar" .format (benchmark_name ))
259+
249260 def renaissance_additional_lib (self , lib ):
250261 return mx .library (lib ).get_path (True )
251262
@@ -284,20 +295,24 @@ def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
284295 self .benchmark_name = benchmarks [0 ]
285296 run_args = self .postprocessRunArgs (self .benchmarkName (), self .runArgs (bmSuiteArgs ))
286297 vm_args = self .vmArgs (bmSuiteArgs )
287- return ['-cp' , self .create_classpath (self .benchmarkName ())] + vm_args + ['-jar' , self .renaissancePath ()] + run_args + [self .benchmarkName ()]
298+ if self .version () in ["0.9.0" , "0.10.0" , "0.11.0" , "0.12.0" , "0.13.0" ]:
299+ return ['-cp' , self .create_pre014_classpath (self .benchmarkName ())] + vm_args + ['-jar' , self .renaissancePath ()] + run_args + [self .benchmarkName ()]
300+ else :
301+ # use renaissance standalone mode as of renaissance 0.14.0
302+ return vm_args + ["-jar" , self .standalone_jar_path (self .benchmarkName ())] + run_args + [self .benchmarkName ()]
288303
289304 def successPatterns (self ):
290305 return super (RenaissanceNativeImageBenchmarkSuite , self ).successPatterns () + [
291306 _successful_stage_pattern
292307 ]
293308
294- def create_classpath (self , benchmarkName ):
295- custom_harness = requires_recompiled_harness (benchmarkName , self .version ())
296- harness_project = RenaissanceNativeImageBenchmarkSuite .RenaissanceProject ('harness' , custom_harness , self )
297- group_project = RenaissanceNativeImageBenchmarkSuite .RenaissanceProject ( benchmark_group (benchmarkName , self .version ()), custom_harness , self , harness_project )
309+ def create_pre014_classpath (self , benchmarkName ):
310+ custom_harness = pre014_requires_recompiled_harness (benchmarkName , self .version ())
311+ harness_project = RenaissanceNativeImageBenchmarkSuite .RenaissancePre014Project ('harness' , custom_harness , self )
312+ group_project = RenaissanceNativeImageBenchmarkSuite .RenaissancePre014Project ( pre014_benchmark_group (benchmarkName , self .version ()), custom_harness , self , harness_project )
298313 return ':' .join ([mx .classpath (harness_project ), mx .classpath (group_project )])
299314
300- class RenaissanceDependency (mx .ClasspathDependency ):
315+ class RenaissancePre014Dependency (mx .ClasspathDependency ):
301316 def __init__ (self , name , path ): # pylint: disable=super-init-not-called
302317 mx .Dependency .__init__ (self , _suite , name , None )
303318 self .path = path
@@ -308,7 +323,7 @@ def classpath_repr(self, resolve=True):
308323 def _walk_deps_visit_edges (self , * args , ** kwargs ):
309324 pass
310325
311- class RenaissanceProject (mx .ClasspathDependency ):
326+ class RenaissancePre014Project (mx .ClasspathDependency ):
312327 def __init__ (self , group , requires_recompiled_harness , renaissance_suite , dep_project = None ): # pylint: disable=super-init-not-called
313328 mx .Dependency .__init__ (self , _suite , group , None )
314329 self .suite = renaissance_suite
@@ -326,17 +341,17 @@ def classpath_repr(self, resolve=True):
326341 def get_dependencies (self , path , group ):
327342 deps = []
328343 for jar in list_jars (path ):
329- deps .append (RenaissanceNativeImageBenchmarkSuite .RenaissanceDependency (os .path .basename (jar ), mx .join (path , jar )))
344+ deps .append (RenaissanceNativeImageBenchmarkSuite .RenaissancePre014Dependency (os .path .basename (jar ), mx .join (path , jar )))
330345
331346 if self .suite .version () in ["0.9.0" , "0.10.0" , "0.11.0" ]:
332347 if group == 'apache-spark' :
333348 # breeze jar is replaced with a patched jar because of IncompatibleClassChange errors due to a bug in the Scala compiler
334349 invalid_bytecode_jar = 'breeze_2.11-0.11.2.jar'
335- lib_dep = RenaissanceNativeImageBenchmarkSuite .RenaissanceDependency (invalid_bytecode_jar , mx .join (path , invalid_bytecode_jar ))
350+ lib_dep = RenaissanceNativeImageBenchmarkSuite .RenaissancePre014Dependency (invalid_bytecode_jar , mx .join (path , invalid_bytecode_jar ))
336351 if lib_dep in deps :
337352 deps .remove (lib_dep )
338353 lib_path = RenaissanceNativeImageBenchmarkSuite .renaissance_additional_lib (self .suite , 'SPARK_BREEZE_PATCHED' )
339- deps .append (RenaissanceNativeImageBenchmarkSuite .RenaissanceDependency (os .path .basename (lib_path ), lib_path ))
354+ deps .append (RenaissanceNativeImageBenchmarkSuite .RenaissancePre014Dependency (os .path .basename (lib_path ), lib_path ))
340355 return deps
341356
342357 def collect_group_dependencies (self , group , requires_recompiled_harness ):
0 commit comments