Commit 57a79819 authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

sysbench_memory experiment: add Simics

parent f18e74b3
...@@ -29,7 +29,7 @@ import simbricks.orchestration.experiments as exp ...@@ -29,7 +29,7 @@ import simbricks.orchestration.experiments as exp
import simbricks.orchestration.nodeconfig as node import simbricks.orchestration.nodeconfig as node
import simbricks.orchestration.simulators as sim import simbricks.orchestration.simulators as sim
host_types = ['gem5'] host_types = ['gem5', 'simics']
mem_types = ['local', 'basicmem'] mem_types = ['local', 'basicmem']
experiments = [] experiments = []
...@@ -41,7 +41,8 @@ class SysbenchMemoryBenchmark(node.AppConfig): ...@@ -41,7 +41,8 @@ class SysbenchMemoryBenchmark(node.AppConfig):
disagg_addr: int, disagg_addr: int,
disagg_size: int, disagg_size: int,
disaggregated: bool, disaggregated: bool,
time_limit: int time_limit: int,
num_threads=1
): ):
self.disagg_addr = disagg_addr self.disagg_addr = disagg_addr
"""Address of disaggregated memory start.""" """Address of disaggregated memory start."""
...@@ -51,6 +52,8 @@ class SysbenchMemoryBenchmark(node.AppConfig): ...@@ -51,6 +52,8 @@ class SysbenchMemoryBenchmark(node.AppConfig):
"""Whether to use disaggregated memory.""" """Whether to use disaggregated memory."""
self.time_limit = time_limit self.time_limit = time_limit
"""Time limit for sysbench benchmark in seconds. 0 to disable limit.""" """Time limit for sysbench benchmark in seconds. 0 to disable limit."""
self.num_threads = num_threads
"""Number of cores to run the benchmark on in parallel."""
# pylint: disable=consider-using-with # pylint: disable=consider-using-with
def config_files(self): def config_files(self):
...@@ -58,33 +61,38 @@ class SysbenchMemoryBenchmark(node.AppConfig): ...@@ -58,33 +61,38 @@ class SysbenchMemoryBenchmark(node.AppConfig):
return {**m, **super().config_files()} return {**m, **super().config_files()}
def run_cmds(self, _): def run_cmds(self, _):
cmds = [] cmds = [
'mount -t proc proc /proc', 'mount -t sysfs sysfs /sys', 'free -m'
]
if self.disaggregated: if self.disaggregated:
cmds += [ cmds.append(
'mount -t proc proc /proc', f'insmod /tmp/guest/farmem.ko '
'mount -t sysfs sysfs /sys', f'base_addr=0x{self.disagg_addr:x} '
'free -m', f'size=0x{self.disagg_size:x} nnid=1 drain_node=1'
( )
f'insmod /tmp/guest/farmem.ko ' cmds.append('free -m')
f'base_addr=0x{self.disagg_addr:x} ' cmds.append('numactl -H')
f'size=0x{self.disagg_size:x} nnid=1 drain_node=1'
) sysbench_cmd = (
] 'sysbench '
cmds += [ f'--time={self.time_limit} '
'free -m', '--histogram=on '
'numactl -H', 'memory '
( '--memory-oper=read '
'--memory-block-size=16M '
'--memory-access-mode=rnd '
'--memory-total-size=0 run'
)
parallel_cmd = str()
for i in range(self.num_threads):
parallel_cmd += (
f'numactl --membind={1 if self.disaggregated else 0} ' f'numactl --membind={1 if self.disaggregated else 0} '
'sysbench ' f'--physcpubind={i} {sysbench_cmd} & '
f'--time={self.time_limit} '
'--histogram=on '
'memory '
'--memory-oper=read '
'--memory-block-size=16M '
'--memory-access-mode=rnd '
'--memory-total-size=0 run'
) )
] parallel_cmd += 'wait'
cmds.append(parallel_cmd)
return cmds return cmds
...@@ -94,40 +102,53 @@ for host_type in host_types: ...@@ -94,40 +102,53 @@ for host_type in host_types:
for mem_type in mem_types: for mem_type in mem_types:
e = exp.Experiment(f'sysbench_memory-{host_type}-{mem_type}') e = exp.Experiment(f'sysbench_memory-{host_type}-{mem_type}')
# memory type and app config if not mem_type in mem_types:
if mem_type == 'local':
mem = sim.BasicMemDev()
mem.name = 'mem0'
mem.addr = 0x2000000000
app = SysbenchMemoryBenchmark(mem.addr, mem.size, False, 10)
elif mem_type == 'basicmem':
mem = sim.BasicMemDev()
mem.name = 'mem0'
mem.addr = 0x2000000000
app = SysbenchMemoryBenchmark(mem.addr, mem.size, True, 10)
else:
raise NameError(mem_type) raise NameError(mem_type)
mem = sim.BasicMemDev()
mem.name = 'mem0'
mem.addr = 0x2000000000
# node config # node config
node_config = node.NodeConfig() node_config = node.NodeConfig()
node_config.cores = 1
node_config.threads = 1
node_config.memory = 4096 node_config.memory = 4096
node_config.kcmd_append += 'numa=fake=2' # TODO Simics offers no way to extend the kernel command line. Instead,
# the base image has to be rebuilt to set the following option using
# GRUB in `images/scripts/install-base.sh`.
if host_type != 'simics':
node_config.kcmd_append += 'numa=fake=2'
# app config
app = SysbenchMemoryBenchmark(
mem.addr,
mem.size,
mem_type == 'basicmem',
1,
node_config.cores * node_config.threads
)
node_config.app = app node_config.app = app
# host # host
if host_type == 'gem5': if host_type == 'gem5':
host = sim.Gem5Host(node_config) host = sim.Gem5Host(node_config)
e.checkpoint = True e.checkpoint = True
elif host_type == 'simics':
host = sim.SimicsHost(node_config)
host.sync = True
host.timing = True
e.checkpoint = True
else: else:
raise NameError(host_type) raise NameError(host_type)
host.name = 'host.0' host.name = 'host.0'
e.add_host(host) e.add_host(host)
host.wait = True host.wait = True
host.mem_latency = host.sync_period = mem.mem_latency = \
mem.sync_period = 500
if mem: if mem_type == 'basicmem':
host.add_memdev(mem) host.add_memdev(mem)
e.add_memdev(mem) e.add_memdev(mem)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment