Skip to content

Commit

Permalink
Explicitly implement JDK version specific workarounds as modifiers (#134
Browse files Browse the repository at this point in the history
)
  • Loading branch information
caizixian authored Nov 20, 2023
1 parent f1d747d commit 2414110
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 73 deletions.
3 changes: 2 additions & 1 deletion docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
## Unreleased
### Added
#### Base Configurations
- DaCapo 23.11-Chopin. Please use `dacapochopin_jep261` modifier when running this release with `callback` set due to JEP 261.
- DaCapo 23.11-Chopin available as `dacapochopin`. Please use `dacapochopin_jdk9`, `dacapochopin_jdk11`, `dacapochopin_jdk17`, and `dacapochopin_jdk21` modifiers for JDK 9, 11, 17, and 21 respectively.
- Temurin 21

### Changed
#### Base Configurations
- Environment variables are expanded when resolving paths of runtimes and benchmark suites.
- `--add-exports java.base/jdk.internal.ref=ALL-UNNAMED` is no longer automatically added when running DaCapo benchmarks on >= JDK 9. This approach doesn't scale now we have more workarounds specific to different JDK versions. This is also too opaque and not clear how it's implemented. New modifiers are introduced to address this issue.

#### Modifiers
- `EnvVar` `val` is expanded using the outside environment prior to benchmark execution.
Expand Down
66 changes: 59 additions & 7 deletions src/running/config/base/dacapo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,77 @@ suites:
timeout: 1800

modifiers:
dacapochopin_jep261:
dacapochopin_jdk21:
type: ModifierSet
val: dacapochopin_jep261_h2o21|dacapochopin_jep261_cassandra21|dacapochopin_jep261_trades21
dacapochopin_jep261_h2o21:
val: "dacapochopin_jdk17|dacapochopin_jdk21_h2o"
dacapochopin_jdk21_h2o:
type: JVMArg
val: "-Dsys.ai.h2o.debug.allowJavaVersions=21 --add-opens java.base/java.lang=ALL-UNNAMED"
val: "-Dsys.ai.h2o.debug.allowJavaVersions=21"
includes:
dacapochopin:
- h2o
dacapochopin_jep261_cassandra21:
dacapochopin_jdk17:
type: ModifierSet
val: "dacapochopin_jdk11|dacapochopin_jdk17_cassandra"
dacapochopin_jdk17_cassandra:
type: JVMArg
val: "-Djava.security.manager=allow"
includes:
dacapochopin:
- cassandra
dacapochopin_jdk11:
type: ModifierSet
val: "dacapochopin_jdk9"
dacapochopin_jdk9:
type: ModifierSet
val: "dacapochopin_jdk9_backward_compatible|dacapochopin_jdk9_h2o|dacapochopin_jdk9_cassandra|dacapochopin_jdk9_trades"
dacapochopin_jdk9_h2o:
type: JVMArg
val: "--add-opens java.base/java.lang=ALL-UNNAMED"
includes:
dacapochopin:
- h2o
dacapochopin_jdk9_cassandra:
type: JVMArg
val: "-Djava.security.manager=allow --add-exports java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED"
val: "--add-exports java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED"
includes:
dacapochopin:
- cassandra
dacapochopin_jep261_trades21:
dacapochopin_jdk9_trades:
type: JVMArg
val: "--add-opens java.base/java.util=ALL-UNNAMED"
includes:
dacapochopin:
- tradebeans
- tradesoap
# https://github.com/anupli/running-ng/issues/111
# https://github.com/anupli/running-ng/pull/114
# https://github.com/anupli/running-ng/issues/130
# https://mmtk.zulipchat.com/#narrow/stream/262677-ANU-Research/topic/Using.20new.20dacapo/near/270150954
dacapochopin_jdk9_backward_compatible:
type: JVMArg
val: "--add-exports java.base/jdk.internal.ref=ALL-UNNAMED"
includes:
dacapochopin:
- avrora
- batik
- biojava
- cassandra
- eclipse
- fop
- graphchi
- h2
- h2o
- jme
- jython
- kafka
- luindex
- lusearch
- pmd
- spring
- sunflow
- tomcat
- tradebeans
- tradesoap
- xalan
- zxing
8 changes: 0 additions & 8 deletions src/running/config/base/modifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ modifiers:
c2:
type: JVMArg
val: "-XX:-TieredCompilation -Xcomp"
excludes:
# These two benchmarks exit with code 1
dacapochopin-29a657f:
- tradebeans
- tradesoap
dacapochopin-f480064:
- tradebeans
- tradesoap
ms:
type: JVMArg
val: "-XX:MetaspaceSize=500M -XX:+DisableExplicitGC"
Expand Down
15 changes: 0 additions & 15 deletions src/running/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,6 @@ def get_benchmark(self, bm_spec: Union[str, Dict[str, Any]]) -> "JavaBenchmark":
# Name of the benchmark
program_args.append(bm_name)

# https://github.com/anupli/running-ng/issues/111
# https://mmtk.zulipchat.com/#narrow/stream/262677-ANU-Research/topic/Using.20new.20dacapo/near/270150954
def strategy(runtime: Runtime) -> Sequence[Modifier]:
modifiers = []
if isinstance(runtime, OpenJDK):
if runtime.release >= 9:
modifiers.append(
JVMArg(
name="add_exports",
val="--add-exports java.base/jdk.internal.ref=ALL-UNNAMED",
)
)
return modifiers

return JavaBenchmark(
jvm_args=[],
program_args=program_args,
Expand All @@ -247,7 +233,6 @@ def strategy(runtime: Runtime) -> Sequence[Modifier]:
suite_name=self.name,
name=name,
timeout=timeout,
runtime_specific_modifiers_strategy=strategy,
)

def get_minheap(self, bm: Benchmark) -> int:
Expand Down
42 changes: 0 additions & 42 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,48 +76,6 @@ def test_dacapo_timing_iteration():
assert "-converge" in fop_converge.to_string(DummyRuntime("java"))


def test_dacapo_openjdk_9_workaround():
c = Configuration(
{
"suites": {
"dacapo2006": {
"type": "DaCapo",
"release": "2006",
"path": "/usr/share/benchmarks/dacapo/dacapo-2006-10-MR2.jar",
"timing_iteration": 3,
}
},
"benchmarks": {"dacapo2006": ["fop"]},
"runtimes": {
"jdk8": {
"type": "OpenJDK",
"release": 8,
"home": "/usr/lib/jvm/temurin-8-jdk-amd64",
},
"jdk11": {
"type": "OpenJDK",
"release": 11,
"home": "/usr/lib/jvm/temurin-11-jdk-amd64",
},
},
"configs": ["jdk8", "jdk11"],
}
)
c.resolve_class()
from running.benchmark import JavaBenchmark

fop: JavaBenchmark
fop = c.get("benchmarks")["dacapo2006"][0]
jdk8 = c.get("runtimes")["jdk8"]
jdk11 = c.get("runtimes")["jdk11"]
fop_jdk8 = fop.attach_modifiers(fop.get_runtime_specific_modifiers(jdk8))
fop_jdk11 = fop.attach_modifiers(fop.get_runtime_specific_modifiers(jdk11))
print(fop_jdk8.to_string(jdk8))
print(fop_jdk11.to_string(jdk11))
assert "add-exports" not in fop_jdk8.to_string(jdk8)
assert "add-exports" in fop_jdk11.to_string(jdk11)


def test_dacapo_path_ennvvar():
c = Configuration(
{
Expand Down

0 comments on commit 2414110

Please sign in to comment.