Skip to content

Commit 6c80080

Browse files
tianleqcaizixian
andauthored
Add SPECjvm98 support (#63)
Co-authored-by: Zixian Cai <u5937495@anu.edu.au>
1 parent 60dc496 commit 6c80080

File tree

6 files changed

+114
-3
lines changed

6 files changed

+114
-3
lines changed

docs/src/changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- `JVMClasspathAppend`
66
- `JVMClasspathPrepend`
77

8+
#### Benchmark Suites
9+
- `SPECjvm98`
10+
811
### Changed
912
#### Modifiers
1013
- `JVMClasspath` is now an alias of `JVMClasspathAppend`. This is backward compatible.

docs/src/references/suite.md

+46
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,52 @@ Note that the property file should reside in `path/../config/specjbb2015.props`
101101
Only strings are allowed, which should correspond to the the mode of the SPECjbb2015 controller.
102102
Right now, only `"composite"` is supported.
103103

104+
## `SPECjvm98` (preview ⚠️)
105+
[SPECjvm98](https://www.spec.org/jvm98/).
106+
107+
Note that you will need to prepend probes to the classpaths, so that the [modified](https://github.com/anupli/probes/blob/master/SpecApplication.java) `SpecApplication` can be used.
108+
109+
Here is an example configuration file.
110+
```yaml
111+
includes:
112+
- "/home/zixianc/running-ng/src/running/config/base/runbms.yml"
113+
114+
modifiers:
115+
probes_cp:
116+
type: JVMClasspathPrepend
117+
val: "/home/zixianc/MMTk-Dev/evaluation/probes /home/zixianc/MMTk-Dev/evaluation/probes/probes.jar"
118+
119+
benchmarks:
120+
specjvm98:
121+
- _213_javac
122+
123+
configs:
124+
- "adoptopenjdk-8|probes_cp"
125+
```
126+
127+
### Keys
128+
`release`: one of the possible values `["1.03_05"]`.
129+
The value is required.
130+
131+
`path`: path to the SPECjvm98 folder, where you can find `SpecApplication.class`.
132+
The value is required.
133+
134+
`timing_iteration`: specifying the timing iteration.
135+
It can only be a number, which is passed to SpecApplication as `-i`.
136+
The value is required.
137+
138+
### Benchmark Specification
139+
Only strings are allowed, which should correspond to benchmark program of SPECjvm98.
140+
The following are the benchmarks:
141+
- _200_check
142+
- _201_compress
143+
- _202_jess
144+
- _209_db
145+
- _213_javac
146+
- _222_mpegaudio
147+
- _227_mtrt
148+
- _228_jack
149+
104150
## `Octane` (preview ⚠️)
105151
### Keys
106152
`path`: path to the Octane benchmark folder.

src/running/benchmark.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SubprocessrExit(Enum):
2020

2121

2222
class Benchmark(object):
23-
def __init__(self, suite_name: str, name: str, wrapper: Optional[str] = None, timeout: Optional[int] = None, **kwargs):
23+
def __init__(self, suite_name: str, name: str, wrapper: Optional[str] = None, timeout: Optional[int] = None, override_cwd: Optional[Path] = None, **kwargs):
2424
self.name = name
2525
self.suite_name = suite_name
2626
self.env_args: Dict[str, str]
@@ -31,6 +31,9 @@ def __init__(self, suite_name: str, name: str, wrapper: Optional[str] = None, ti
3131
else:
3232
self.wrapper = []
3333
self.timeout = timeout
34+
# ignore the current working directory provided by commands like runbms or minheap
35+
# certain benchmarks expect to be invoked from certain directories
36+
self.override_cwd = override_cwd
3437

3538
def get_env_str(self) -> str:
3639
return " ".join([
@@ -85,7 +88,7 @@ def run(self, runtime: Runtime, cwd: Path = None) -> Tuple[bytes, SubprocessrExi
8588
stdout=subprocess.PIPE,
8689
stderr=subprocess.STDOUT,
8790
timeout=self.timeout,
88-
cwd=cwd
91+
cwd=self.override_cwd if self.override_cwd else cwd
8992
)
9093
return p.stdout, SubprocessrExit.Normal
9194
except subprocess.CalledProcessError as e:

src/running/config/base/specjvm98.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
suites:
2+
specjvm98:
3+
type: SPECjvm98
4+
path: "/usr/share/benchmarks/SPECjvm98"
5+
release: "1.03_05"
6+
timing_iteration: 3

src/running/config/base/suites.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
includes:
22
- "./dacapo.yml"
33
- "./specjbb2015.yml"
4+
- "./specjvm98.yml"

src/running/suite.py

+53-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def get_benchmark(self, bm_spec: Union[str, Dict[str, Any]]) -> 'JavaBenchmark':
186186
program_args.append("--converge")
187187
# Input size
188188
program_args.extend(["-s", size])
189-
# Naem of the benchmark
189+
# Name of the benchmark
190190
program_args.append(bm_name)
191191
return JavaBenchmark(
192192
jvm_args=[],
@@ -342,3 +342,55 @@ def get_minheap(self, bm: Benchmark) -> int:
342342

343343
def is_passed(self, output: bytes) -> bool:
344344
return b"PASSED" in output
345+
346+
347+
@register(BenchmarkSuite)
348+
class SPECjvm98(JavaBenchmarkSuite):
349+
def __init__(self, **kwargs):
350+
super().__init__(**kwargs)
351+
self.release: str
352+
self.release = kwargs["release"]
353+
if self.release not in ["1.03_05"]:
354+
raise ValueError(
355+
"SPECjvm98 release {} not recongized".format(self.release))
356+
self.path: Path
357+
self.path = Path(kwargs["path"]).resolve()
358+
359+
if not self.path.exists():
360+
logging.info("SPECjvm98 {} not found".format(self.path))
361+
if not (self.path / "SpecApplication.class").exists():
362+
logging.info(
363+
"SpecApplication.class not found under SPECjvm98 {}".format(self.path))
364+
try:
365+
self.timing_iteration = int(kwargs.get("timing_iteration"))
366+
except ValueError:
367+
timing_iteration = kwargs.get("timing_iteration")
368+
raise TypeError("The timing iteration of the SPECjvm98 benchmark suite `{}` is {}, which is not an "
369+
"integer".format(self.path.parent, repr(timing_iteration)))
370+
371+
def __str__(self) -> str:
372+
return "{} SPECjvm98 {} {}".format(super().__str__(), self.release, self.path)
373+
374+
def get_benchmark(self, bm_spec: Union[str, Dict[str, Any]]) -> 'JavaBenchmark':
375+
assert type(bm_spec) is str
376+
program_args = [
377+
"SpecApplication",
378+
"-i{}".format(self.timing_iteration),
379+
bm_spec
380+
]
381+
return JavaBenchmark(
382+
jvm_args=[],
383+
program_args=program_args,
384+
cp=[str(self.path)],
385+
suite_name=self.name,
386+
name=bm_spec,
387+
override_cwd=self.path
388+
)
389+
390+
def get_minheap(self, _bm: Benchmark) -> int:
391+
# FIXME allow user to measure and specify minimum heap sizes
392+
return 32 # SPEC recommends running with minimum 32MB of heap
393+
394+
def is_passed(self, output: bytes) -> bool:
395+
# FIXME
396+
return b"**NOT VALID**" not in output

0 commit comments

Comments
 (0)