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
Show 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)
...
@@ -23,6 +23,8 @@ host0 = system.I40ELinuxHost(sys)
pcie0
=
system
.
PCIeHostInterface
(
host0
)
pcie0
=
system
.
PCIeHostInterface
(
host0
)
cfg_disk0
=
system
.
DistroDiskImage
(
h
=
host0
,
name
=
"base"
)
cfg_disk0
=
system
.
DistroDiskImage
(
h
=
host0
,
name
=
"base"
)
host0
.
add_disk
(
cfg_disk0
)
host0
.
add_disk
(
cfg_disk0
)
tar_disk0
=
system
.
LinuxConfigDiskImage
(
h
=
host0
)
host0
.
add_disk
(
tar_disk0
)
host0
.
add_if
(
pcie0
)
host0
.
add_if
(
pcie0
)
nic0
=
system
.
IntelI40eNIC
(
sys
)
nic0
=
system
.
IntelI40eNIC
(
sys
)
...
@@ -34,6 +36,8 @@ host1 = system.I40ELinuxHost(sys)
...
@@ -34,6 +36,8 @@ host1 = system.I40ELinuxHost(sys)
pcie1
=
system
.
PCIeHostInterface
(
host1
)
pcie1
=
system
.
PCIeHostInterface
(
host1
)
cfg_disk1
=
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
)
cfg_disk1
=
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
)
host1
.
add_disk
(
cfg_disk1
)
host1
.
add_disk
(
cfg_disk1
)
tar_disk1
=
system
.
LinuxConfigDiskImage
(
h
=
host1
)
host1
.
add_disk
(
tar_disk1
)
host1
.
add_if
(
pcie1
)
host1
.
add_if
(
pcie1
)
nic1
=
system
.
IntelI40eNIC
(
sys
)
nic1
=
system
.
IntelI40eNIC
(
sys
)
...
...
experiments/simbricks/orchestration/instantiation/base.py
View file @
6a887cf5
...
@@ -374,6 +374,9 @@ class Instantiation(util_base.IdObj):
...
@@ -374,6 +374,9 @@ class Instantiation(util_base.IdObj):
def
wrkdir
(
self
)
->
str
:
def
wrkdir
(
self
)
->
str
:
return
pathlib
.
Path
(
self
.
_env
.
_workdir
).
resolve
()
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
:
async
def
prepare
(
self
)
->
None
:
wrkdir
=
self
.
wrkdir
()
wrkdir
=
self
.
wrkdir
()
print
(
f
"wrkdir=
{
wrkdir
}
"
)
print
(
f
"wrkdir=
{
wrkdir
}
"
)
...
@@ -391,6 +394,11 @@ class Instantiation(util_base.IdObj):
...
@@ -391,6 +394,11 @@ class Instantiation(util_base.IdObj):
shutil
.
rmtree
(
cpdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
cpdir
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
cpdir
)
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
)
pathlib
.
Path
(
wrkdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
self
.
executor
.
mkdir
(
wrkdir
)
await
self
.
executor
.
mkdir
(
wrkdir
)
...
@@ -400,6 +408,9 @@ class Instantiation(util_base.IdObj):
...
@@ -400,6 +408,9 @@ class Instantiation(util_base.IdObj):
pathlib
.
Path
(
shm_base
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
shm_base
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
self
.
executor
.
mkdir
(
shm_base
)
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
)
await
self
.
_simulation
.
prepare
(
inst
=
self
)
def
_join_paths
(
def
_join_paths
(
...
@@ -443,21 +454,21 @@ class Instantiation(util_base.IdObj):
...
@@ -443,21 +454,21 @@ class Instantiation(util_base.IdObj):
def
join_tmp_base
(
self
,
relative_path
:
str
)
->
str
:
def
join_tmp_base
(
self
,
relative_path
:
str
)
->
str
:
return
self
.
_join_paths
(
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
relative_path
,
relative_path
=
relative_path
,
)
)
def
dynamic_img_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
def
dynamic_img_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
filename
=
f
"
{
img
.
_id
}
.
{
format
}
"
filename
=
f
"
{
img
.
_id
}
.
{
format
}
"
return
self
.
_join_paths
(
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
filename
,
relative_path
=
filename
,
)
)
def
hdcopy_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
def
hdcopy_path
(
self
,
img
:
disk_images
.
DiskImage
,
format
:
str
)
->
str
:
filename
=
f
"
{
img
.
_id
}
_hdcopy.
{
format
}
"
filename
=
f
"
{
img
.
_id
}
_hdcopy.
{
format
}
"
return
self
.
_join_paths
(
return
self
.
_join_paths
(
base
=
self
.
_env
.
_tmp_simulation_files
,
base
=
self
.
tmp_dir
()
,
relative_path
=
filename
,
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
...
@@ -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
host
as
sys_host
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
from
simbricks.orchestration.system
import
mem
as
sys_mem
from
simbricks.orchestration.system
import
mem
as
sys_mem
from
simbricks.orchestration.utils
import
base
as
utils_base
class
HostSim
(
sim_base
.
Simulator
):
class
HostSim
(
sim_base
.
Simulator
):
...
@@ -153,23 +154,25 @@ class Gem5Sim(HostSim):
...
@@ -153,23 +154,25 @@ class Gem5Sim(HostSim):
cmd
+=
":sync"
cmd
+=
":sync"
cmd
+=
" "
cmd
+=
" "
# mem_interfaces = system.Interface.filter_by_type(
mem_interfaces
=
system
.
Interface
.
filter_by_type
(
# interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface
interfaces
=
fsh_interfaces
,
ty
=
sys_mem
.
MemHostInterface
# )
)
# for inf in mem_interfaces:
for
inf
in
mem_interfaces
:
# socket = self._get_socket(inst=inst, interface=inf)
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
# if socket is None:
if
socket
is
None
:
# continue
continue
# assert socket._type == inst_base.SockType.CONNECT
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
# cmd += (
utils_base
.
has_expected_type
(
inf
.
component
,
sys_mem
.
MemSimpleDevice
)
# f"--simbricks-mem={dev._size}@{dev._addr}@{dev._as_id}@" # TODO: FIXME
dev
:
sys_mem
.
MemSimpleDevice
=
inf
.
component
# f"connect:{socket._path}"
cmd
+=
(
# f":latency={latency}ns"
f
"--simbricks-mem=
{
dev
.
_size
}
@
{
dev
.
_addr
}
@
{
dev
.
_as_id
}
@"
# f":sync_interval={sync_period}ns"
f
"connect:
{
socket
.
_path
}
"
# )
f
":latency=
{
latency
}
ns"
# if run_sync:
f
":sync_interval=
{
sync_period
}
ns"
# cmd += ":sync"
)
# cmd += " "
if
run_sync
:
cmd
+=
":sync"
cmd
+=
" "
# TODO: FIXME
# TODO: FIXME
# for net in self.net_directs:
# for net in self.net_directs:
...
...
experiments/simbricks/orchestration/system/host/app.py
View file @
6a887cf5
...
@@ -102,7 +102,7 @@ class Sleep(BaseLinuxApplication):
...
@@ -102,7 +102,7 @@ class Sleep(BaseLinuxApplication):
super
().
__init__
(
h
)
super
().
__init__
(
h
)
self
.
delay
=
delay
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
}
'
]
return
[
f
'sleep
{
self
.
delay
}
'
]
...
@@ -110,7 +110,7 @@ class NetperfServer(BaseLinuxApplication):
...
@@ -110,7 +110,7 @@ class NetperfServer(BaseLinuxApplication):
def
__init__
(
self
,
h
:
sys_host
.
LinuxHost
)
->
None
:
def
__init__
(
self
,
h
:
sys_host
.
LinuxHost
)
->
None
:
super
().
__init__
(
h
)
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'
]
return
[
'netserver'
,
'sleep infinity'
]
...
@@ -121,7 +121,7 @@ class NetperfClient(BaseLinuxApplication):
...
@@ -121,7 +121,7 @@ class NetperfClient(BaseLinuxApplication):
self
.
duration_tp
=
10
self
.
duration_tp
=
10
self
.
duration_lat
=
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
[
return
[
'netserver'
,
'netserver'
,
'sleep 0.5'
,
'sleep 0.5'
,
...
...
experiments/simbricks/orchestration/system/host/disk_images.py
View file @
6a887cf5
...
@@ -130,6 +130,7 @@ class LinuxConfigDiskImage(DynamicDiskImage):
...
@@ -130,6 +130,7 @@ class LinuxConfigDiskImage(DynamicDiskImage):
async
def
_prepare_format
(
self
,
inst
:
inst_base
.
Instantiation
,
format
:
str
)
->
None
:
async
def
_prepare_format
(
self
,
inst
:
inst_base
.
Instantiation
,
format
:
str
)
->
None
:
path
=
self
.
path
(
inst
,
format
)
path
=
self
.
path
(
inst
,
format
)
print
(
path
)
with
tarfile
.
open
(
path
,
'w:'
)
as
tar
:
with
tarfile
.
open
(
path
,
'w:'
)
as
tar
:
# add main run script
# add main run script
cfg_i
=
tarfile
.
TarInfo
(
'guest/run.sh'
)
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