Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
4b276d42
Unverified
Commit
4b276d42
authored
Oct 09, 2024
by
Jakob Görgen
Browse files
LocalParallelRuntime fixes
parent
1de5e7ce
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
21 deletions
+28
-21
experiments/run_new.py
experiments/run_new.py
+1
-1
experiments/simbricks/orchestration/instantiation/base.py
experiments/simbricks/orchestration/instantiation/base.py
+16
-10
experiments/simbricks/orchestration/runtime_new/runs/local.py
...riments/simbricks/orchestration/runtime_new/runs/local.py
+2
-6
experiments/simbricks/orchestration/simulation/host.py
experiments/simbricks/orchestration/simulation/host.py
+2
-2
experiments/simbricks/orchestration/simulation/net/net_base.py
...iments/simbricks/orchestration/simulation/net/net_base.py
+7
-2
No files found.
experiments/run_new.py
View file @
4b276d42
...
...
@@ -280,7 +280,7 @@ def main():
executors
=
load_executors
(
args
.
hosts
)
# initialize runtime
if
args
.
runtime
==
"parallel"
:
# TODO: FIXME
if
args
.
runtime
==
"parallel"
:
warn_multi_exec
(
executors
)
rt
=
rt_local
.
LocalParallelRuntime
(
cores
=
args
.
cores
,
mem
=
args
.
mem
,
verbose
=
args
.
verbose
,
executor
=
executors
[
0
]
...
...
experiments/simbricks/orchestration/instantiation/base.py
View file @
4b276d42
...
...
@@ -26,6 +26,8 @@ import enum
import
pathlib
import
shutil
import
typing
import
itertools
import
copy
from
simbricks.orchestration.utils
import
base
as
util_base
from
simbricks.orchestration.system
import
base
as
sys_base
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
...
...
@@ -74,7 +76,9 @@ class InstantiationEnvironment(util_base.IdObj):
).
resolve
()
class
Instantiation
(
util_base
.
IdObj
):
class
Instantiation
():
__id_iter
=
itertools
.
count
()
def
__init__
(
self
,
...
...
@@ -82,6 +86,7 @@ class Instantiation(util_base.IdObj):
env
:
InstantiationEnvironment
=
InstantiationEnvironment
(),
):
super
().
__init__
()
self
.
_id
=
next
(
self
.
__id_iter
)
self
.
simulation
:
sim_base
.
Simulation
=
sim
self
.
env
:
InstantiationEnvironment
=
env
self
.
_executor
:
command_executor
.
Executor
|
None
=
None
...
...
@@ -330,32 +335,33 @@ class Instantiation(util_base.IdObj):
self
.
_restore_checkpoint
=
restore_checkpoint
def
copy
(
self
)
->
Instantiation
:
copy
=
Instantiation
(
sim
=
self
.
simulation
,
env
=
self
.
env
)
return
copy
cop
=
Instantiation
(
sim
=
self
.
simulation
,
env
=
self
.
env
)
cop
.
simulation
=
copy
.
deepcopy
(
self
.
simulation
)
# maybe there is a smarter way of achieving this...
return
cop
def
out_base_dir
(
self
)
->
str
:
return
pathlib
.
Path
(
f
"
{
self
.
env
.
_output_base
}
/
{
self
.
simulation
.
name
}
"
#
/{self.
run._run_nr
}"
f
"
{
self
.
env
.
_output_base
}
/
{
self
.
simulation
.
name
}
/
{
self
.
_id
}
"
).
resolve
()
def
shm_base_dir
(
self
)
->
str
:
return
pathlib
.
Path
(
f
"
{
self
.
env
.
_shm_base
}
/
{
self
.
simulation
.
name
}
"
#
/{self.
run._run_nr
}"
f
"
{
self
.
env
.
_shm_base
}
/
{
self
.
simulation
.
name
}
/
{
self
.
_id
}
"
).
resolve
()
def
imgs_dir
(
self
)
->
str
:
return
pathlib
.
Path
(
f
"
{
self
.
env
.
_imgdir
}
/
{
self
.
simulation
.
name
}
"
#
/{self.
run._run_nr
}"
f
"
{
self
.
env
.
_imgdir
}
/
{
self
.
simulation
.
name
}
/
{
self
.
_id
}
"
).
resolve
()
def
cpdir
(
self
)
->
str
:
return
pathlib
.
Path
(
f
"
{
self
.
env
.
_cpdir
}
/
{
self
.
simulation
.
name
}
"
# /{self.
run._run_nr
}"
f
"
{
self
.
env
.
_cpdir
}
/
{
self
.
simulation
.
name
}
"
# /{self.
_id
}"
).
resolve
()
def
wrkdir
(
self
)
->
str
:
return
pathlib
.
Path
(
f
"
{
self
.
env
.
_workdir
}
/
{
self
.
simulation
.
name
}
"
# /{self.
run._run_nr
}"
f
"
{
self
.
env
.
_workdir
}
/
{
self
.
simulation
.
name
}
"
# /{self.
_id
}"
).
resolve
()
async
def
prepare
(
self
)
->
None
:
...
...
@@ -461,10 +467,10 @@ class Instantiation(util_base.IdObj):
relative_path
=
f
"
{
sim
.
full_name
()
}
-shm-pool-
{
sim
.
_id
}
"
,
)
def
get_simulation_output_path
(
self
,
run_nr
:
int
)
->
str
:
def
get_simulation_output_path
(
self
)
->
str
:
return
self
.
_join_paths
(
base
=
self
.
out_base_dir
(),
relative_path
=
f
"
{
run_nr
}
/
out.json"
,
relative_path
=
f
"out.json"
,
)
def
find_sim_by_interface
(
...
...
experiments/simbricks/orchestration/runtime_new/runs/local.py
View file @
4b276d42
...
...
@@ -69,9 +69,7 @@ class LocalSimpleRuntime(run_base.Runtime):
if
self
.
_verbose
:
print
(
f
"Writing collected output of run
{
run
.
name
()
}
to JSON file ..."
)
output_path
=
run
.
instantiation
.
get_simulation_output_path
(
run_nr
=
run
.
_run_nr
)
output_path
=
run
.
instantiation
.
get_simulation_output_path
()
run
.
_output
.
dump
(
outpath
=
output_path
)
await
runner
.
cleanup
()
...
...
@@ -150,9 +148,7 @@ class LocalParallelRuntime(run_base.Runtime):
if
self
.
_verbose
:
print
(
f
"Writing collected output of run
{
run
.
name
()
}
to JSON file ..."
)
output_path
=
run
.
instantiation
.
get_simulation_output_path
(
run_number
=
run
.
_run_nr
)
output_path
=
run
.
instantiation
.
get_simulation_output_path
()
run
.
_output
.
dump
(
outpath
=
output_path
)
await
runner
.
cleanup
()
...
...
experiments/simbricks/orchestration/simulation/host.py
View file @
4b276d42
...
...
@@ -65,8 +65,8 @@ class Gem5Sim(HostSim):
self
.
name
=
f
"Gem5Sim-
{
self
.
_id
}
"
self
.
cpu_type_cp
=
"X86KvmCPU"
self
.
cpu_type
=
"TimingSimpleCPU"
self
.
extra_main_args
:
list
[
str
]
=
[]
# TODO
self
.
extra_config_args
:
list
[
str
]
=
[]
# TODO
self
.
extra_main_args
:
list
[
str
]
=
[]
self
.
extra_config_args
:
list
[
str
]
=
[]
self
.
_variant
:
str
=
"fast"
self
.
_sys_clock
:
str
=
"1GHz"
# TODO: move to system module
...
...
experiments/simbricks/orchestration/simulation/net/net_base.py
View file @
4b276d42
...
...
@@ -180,6 +180,7 @@ class SimpleNS3Sim(NetSim):
name
=
name
,
)
self
.
_ns3_run_script
:
str
=
ns3_run_script
self
.
opt
:
str
|
None
=
None
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
return
f
"
{
inst
.
join_repo_base
(
self
.
_executable
)
}
{
self
.
_ns3_run_script
}
"
...
...
@@ -225,7 +226,9 @@ class NS3DumbbellNet(SimpleNS3Sim):
assert
sock
.
_type
==
inst_base
.
SockType
.
CONNECT
cmd
+=
f
"--SimbricksPortRight=
{
sock
.
_path
}
"
# TODO cmd += f"{self.opt}"
if
self
.
opt
is
not
None
:
cmd
+=
f
"
{
self
.
opt
}
"
return
cmd
...
...
@@ -251,5 +254,7 @@ class NS3BridgeNet(SimpleNS3Sim):
for
sock
in
sockets
:
cmd
+=
f
"--SimbricksPort=
{
sock
.
_path
}
"
# TODO cmd += f"{self.opt}"
if
self
.
opt
is
not
None
:
cmd
+=
f
"
{
self
.
opt
}
"
return
cmd
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment