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
6a887cf5
Unverified
Commit
6a887cf5
authored
Sep 26, 2024
by
Jakob Görgen
Browse files
fixes regarding tar and tmp folder creation
parent
aa1fda22
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
23 deletions
+42
-23
experiments/pyexps/netperf_sysconf.py
experiments/pyexps/netperf_sysconf.py
+4
-0
experiments/simbricks/orchestration/instantiation/base.py
experiments/simbricks/orchestration/instantiation/base.py
+14
-3
experiments/simbricks/orchestration/simulation/host.py
experiments/simbricks/orchestration/simulation/host.py
+20
-17
experiments/simbricks/orchestration/system/host/app.py
experiments/simbricks/orchestration/system/host/app.py
+3
-3
experiments/simbricks/orchestration/system/host/disk_images.py
...iments/simbricks/orchestration/system/host/disk_images.py
+1
-0
No files found.
experiments/pyexps/netperf_sysconf.py
View file @
6a887cf5
...
...
@@ -23,6 +23,8 @@ host0 = system.I40ELinuxHost(sys)
pcie0
=
system
.
PCIeHostInterface
(
host0
)
cfg_disk0
=
system
.
DistroDiskImage
(
h
=
host0
,
name
=
"base"
)
host0
.
add_disk
(
cfg_disk0
)
tar_disk0
=
system
.
LinuxConfigDiskImage
(
h
=
host0
)
host0
.
add_disk
(
tar_disk0
)
host0
.
add_if
(
pcie0
)
nic0
=
system
.
IntelI40eNIC
(
sys
)
...
...
@@ -34,6 +36,8 @@ host1 = system.I40ELinuxHost(sys)
pcie1
=
system
.
PCIeHostInterface
(
host1
)
cfg_disk1
=
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
)
host1
.
add_disk
(
cfg_disk1
)
tar_disk1
=
system
.
LinuxConfigDiskImage
(
h
=
host1
)
host1
.
add_disk
(
tar_disk1
)
host1
.
add_if
(
pcie1
)
nic1
=
system
.
IntelI40eNIC
(
sys
)
...
...
experiments/simbricks/orchestration/instantiation/base.py
View file @
6a887cf5
...
...
@@ -373,6 +373,9 @@ class Instantiation(util_base.IdObj):
def
wrkdir
(
self
)
->
str
:
return
pathlib
.
Path
(
self
.
_env
.
_workdir
).
resolve
()
def
tmp_dir
(
self
)
->
str
:
return
pathlib
.
Path
(
self
.
_env
.
_tmp_simulation_files
).
resolve
()
async
def
prepare
(
self
)
->
None
:
wrkdir
=
self
.
wrkdir
()
...
...
@@ -391,6 +394,11 @@ class Instantiation(util_base.IdObj):
shutil
.
rmtree
(
cpdir
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
cpdir
)
tmpdir
=
self
.
tmp_dir
()
print
(
f
"tmpdir=
{
tmpdir
}
"
)
shutil
.
rmtree
(
tmpdir
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
tmpdir
)
pathlib
.
Path
(
wrkdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
self
.
executor
.
mkdir
(
wrkdir
)
...
...
@@ -400,6 +408,9 @@ class Instantiation(util_base.IdObj):
pathlib
.
Path
(
shm_base
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
self
.
executor
.
mkdir
(
shm_base
)
pathlib
.
Path
(
tmpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
self
.
executor
.
mkdir
(
tmpdir
)
await
self
.
_simulation
.
prepare
(
inst
=
self
)
def
_join_paths
(
...
...
@@ -443,21 +454,21 @@ class Instantiation(util_base.IdObj):
def
join_tmp_base
(
self
,
relative_path
:
str
)
->
str
:
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
relative_path
,
)
def
dynamic_img_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
filename
=
f
"
{
img
.
_id
}
.
{
format
}
"
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
filename
,
)
def
hdcopy_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
filename
=
f
"
{
img
.
_id
}
_hdcopy.
{
format
}
"
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
filename
,
)
...
...
experiments/simbricks/orchestration/simulation/host.py
View file @
6a887cf5
...
...
@@ -32,6 +32,7 @@ from simbricks.orchestration.experiment.experiment_environment_new import ExpEnv
from
simbricks.orchestration.system
import
host
as
sys_host
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
from
simbricks.orchestration.system
import
mem
as
sys_mem
from
simbricks.orchestration.utils
import
base
as
utils_base
class
HostSim
(
sim_base
.
Simulator
):
...
...
@@ -153,23 +154,25 @@ class Gem5Sim(HostSim):
cmd
+=
":sync"
cmd
+=
" "
# mem_interfaces = system.Interface.filter_by_type(
# interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface
# )
# for inf in mem_interfaces:
# socket = self._get_socket(inst=inst, interface=inf)
# if socket is None:
# continue
# assert socket._type == inst_base.SockType.CONNECT
# cmd += (
# f"--simbricks-mem={dev._size}@{dev._addr}@{dev._as_id}@" # TODO: FIXME
# f"connect:{socket._path}"
# f":latency={latency}ns"
# f":sync_interval={sync_period}ns"
# )
# if run_sync:
# cmd += ":sync"
# cmd += " "
mem_interfaces
=
system
.
Interface
.
filter_by_type
(
interfaces
=
fsh_interfaces
,
ty
=
sys_mem
.
MemHostInterface
)
for
inf
in
mem_interfaces
:
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
if
socket
is
None
:
continue
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
utils_base
.
has_expected_type
(
inf
.
component
,
sys_mem
.
MemSimpleDevice
)
dev
:
sys_mem
.
MemSimpleDevice
=
inf
.
component
cmd
+=
(
f
"--simbricks-mem=
{
dev
.
_size
}
@
{
dev
.
_addr
}
@
{
dev
.
_as_id
}
@"
f
"connect:
{
socket
.
_path
}
"
f
":latency=
{
latency
}
ns"
f
":sync_interval=
{
sync_period
}
ns"
)
if
run_sync
:
cmd
+=
":sync"
cmd
+=
" "
# TODO: FIXME
# for net in self.net_directs:
...
...
experiments/simbricks/orchestration/system/host/app.py
View file @
6a887cf5
...
...
@@ -102,7 +102,7 @@ class Sleep(BaseLinuxApplication):
super
().
__init__
(
h
)
self
.
delay
=
delay
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
L
ist
[
str
]:
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
l
ist
[
str
]:
return
[
f
'sleep
{
self
.
delay
}
'
]
...
...
@@ -110,7 +110,7 @@ class NetperfServer(BaseLinuxApplication):
def
__init__
(
self
,
h
:
sys_host
.
LinuxHost
)
->
None
:
super
().
__init__
(
h
)
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
L
ist
[
str
]:
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
l
ist
[
str
]:
return
[
'netserver'
,
'sleep infinity'
]
...
...
@@ -121,7 +121,7 @@ class NetperfClient(BaseLinuxApplication):
self
.
duration_tp
=
10
self
.
duration_lat
=
10
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
L
ist
[
str
]:
def
run_cmds
(
self
,
inst
:
inst_base
.
Instantiation
)
->
l
ist
[
str
]:
return
[
'netserver'
,
'sleep 0.5'
,
...
...
experiments/simbricks/orchestration/system/host/disk_images.py
View file @
6a887cf5
...
...
@@ -130,6 +130,7 @@ class LinuxConfigDiskImage(DynamicDiskImage):
async
def
_prepare_format
(
self
,
inst
:
inst_base
.
Instantiation
,
format
:
str
)
->
None
:
path
=
self
.
path
(
inst
,
format
)
print
(
path
)
with
tarfile
.
open
(
path
,
'w:'
)
as
tar
:
# add main run script
cfg_i
=
tarfile
.
TarInfo
(
'guest/run.sh'
)
...
...
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