Merge remote-tracking branch 'origin/dev' into aws-fpga-1.4.6-bump

This commit is contained in:
Sagar Karandikar 2019-01-29 01:04:36 +00:00
commit 6b73a562c5
4 changed files with 79 additions and 37 deletions

View File

@ -218,20 +218,21 @@ class FireSimServerNode(FireSimNode):
rootLogger.debug("[localhost] " + str(localcap.stderr))
# mount rootfs, copy files from it back to local system
mountpoint = """/home/centos/sim_slot_{}/mountpoint""".format(simserverindex)
with StreamLogger('stdout'), StreamLogger('stderr'):
run("""sudo mkdir -p {}""".format(mountpoint))
run("""sudo mount /home/centos/sim_slot_{}/{} {}""".format(simserverindex, self.get_rootfs_name(), mountpoint))
run("""sudo chmod -Rf 777 {}""".format(mountpoint))
if self.get_rootfs_name() is not None:
mountpoint = """/home/centos/sim_slot_{}/mountpoint""".format(simserverindex)
with StreamLogger('stdout'), StreamLogger('stderr'):
run("""sudo mkdir -p {}""".format(mountpoint))
run("""sudo mount /home/centos/sim_slot_{}/{} {}""".format(simserverindex, self.get_rootfs_name(), mountpoint))
run("""sudo chmod -Rf 777 {}""".format(mountpoint))
## copy back files from inside the rootfs
with warn_only(), StreamLogger('stdout'), StreamLogger('stderr'):
for outputfile in jobinfo.outputs:
get(remote_path=mountpoint + outputfile, local_path=job_dir)
## copy back files from inside the rootfs
with warn_only(), StreamLogger('stdout'), StreamLogger('stderr'):
for outputfile in jobinfo.outputs:
get(remote_path=mountpoint + outputfile, local_path=job_dir)
## unmount
with StreamLogger('stdout'), StreamLogger('stderr'):
run("""sudo umount {}""".format(mountpoint))
## unmount
with StreamLogger('stdout'), StreamLogger('stderr'):
run("""sudo umount {}""".format(mountpoint))
## copy output files generated by the simulator that live on the host:
## e.g. uartlog, memory_stats.csv, etc
@ -250,8 +251,10 @@ class FireSimServerNode(FireSimNode):
""" Return local paths of all stuff needed to run this simulation as
an array. """
all_paths = []
# todo handle none case
all_paths.append([self.get_job().rootfs_path(), ''])
if self.get_job().rootfs_path() is not None:
all_paths.append([self.get_job().rootfs_path(), ''])
all_paths.append([self.get_job().bootbinary_path(), ''])
all_paths.append([self.server_hardware_config.get_local_driver_path(), ''])
@ -275,9 +278,12 @@ class FireSimServerNode(FireSimNode):
return self.job.jobname
def get_rootfs_name(self, dummyindex=0):
if dummyindex:
if self.get_job().rootfs_path() is None:
return None
elif dummyindex:
return self.get_job().rootfs_path().split("/")[-1] + "-" + str(dummyindex)
return self.get_job().rootfs_path().split("/")[-1]
else:
return self.get_job().rootfs_path().split("/")[-1]
def get_bootbin_name(self, dummyindex=0):
if dummyindex:
@ -377,15 +383,17 @@ class FireSimSuperNodeServerNode(FireSimServerNode):
return [filepath, get_path_trailing(filepath) + str(index)]
all_paths = []
# todo handle none case
all_paths.append([self.get_job().rootfs_path(),
self.get_rootfs_name()])
if self.get_job().rootfs_path() is not None:
all_paths.append([self.get_job().rootfs_path(),
self.get_rootfs_name()])
num_siblings = self.supernode_get_num_siblings()
for x in range(1, num_siblings):
all_paths.append([self.supernode_get_sibling_rootfs_path(x),
self.supernode_get_sibling_rootfs(x)])
sibling_rootfs_path = self.supernode_get_sibling_rootfs_path(x)
if sibling_rootfs_path is not None:
all_paths.append([sibling_rootfs_path,
self.supernode_get_sibling_rootfs(x)])
all_paths.append([self.get_job().bootbinary_path(),
self.get_bootbin_name()])
@ -400,9 +408,12 @@ class FireSimSuperNodeServerNode(FireSimServerNode):
return all_paths
def get_rootfs_name(self, dummyindex=0):
if dummyindex:
if self.get_job().rootfs_path() is None:
return None
elif dummyindex:
return self.get_job().rootfs_path().split("/")[-1] + "-" + str(dummyindex)
return self.get_job().rootfs_path().split("/")[-1]
else:
return self.get_job().rootfs_path().split("/")[-1]
def get_bootbin_name(self, dummyindex=0):
if dummyindex:

View File

@ -100,12 +100,19 @@ class RuntimeHWConfig:
# the sed is in there to get rid of newlines in runtime confs
driver = self.get_local_driver_binaryname()
runtimeconf = self.get_local_runtimeconf_binaryname()
basecommand = """screen -S fsim{slotid} -d -m bash -c "script -f -c 'stty intr ^] && sudo ./{driver} +permissive $(sed \':a;N;$!ba;s/\\n/ /g\' {runtimeconf}) +macaddr0={macaddr} +blkdev0={blkdev} +slotid={slotid} +niclog0=niclog {tracefile} +trace-start0={trace_start} +trace-end0={trace_end} +linklatency0={linklatency} +netbw0={netbw} +profile-interval={profile_interval} +zero-out-dram +shmemportname0={shmemportname} +permissive-off +prog0={bootbin} && stty intr ^c' uartlog"; sleep 1""".format(
slotid=slotid, driver=driver, runtimeconf=runtimeconf,
macaddr=macaddr, blkdev=blkdev, linklatency=linklatency,
netbw=netbw, profile_interval=profile_interval,
shmemportname=shmemportname, bootbin=bootbin, tracefile=tracefile,
trace_start=trace_start, trace_end=trace_end)
driverArgs = """+permissive $(sed \':a;N;$!ba;s/\\n/ /g\' {runtimeconf}) +macaddr0={macaddr} +slotid={slotid} +niclog0=niclog {tracefile} +trace-start0={trace_start} +trace-end0={trace_end} +linklatency0={linklatency} +netbw0={netbw} +profile-interval={profile_interval} +zero-out-dram +shmemportname0={shmemportname} +permissive-off +prog0={bootbin}""".format(
slotid=slotid, runtimeconf=runtimeconf, macaddr=macaddr,
linklatency=linklatency, netbw=netbw,
profile_interval=profile_interval, shmemportname=shmemportname,
bootbin=bootbin, tracefile=tracefile, trace_start=trace_start,
trace_end=trace_end)
if blkdev is not None:
driverArgs += """ +blkdev0={blkdev}""".format(blkdev=blkdev)
basecommand = """screen -S fsim{slotid} -d -m bash -c "script -f -c 'stty intr ^] && sudo ./{driver} {driverArgs} && stty intr ^c' uartlog"; sleep 1""".format(
slotid=slotid, driver=driver, driverArgs=driverArgs)
return basecommand
@ -130,7 +137,10 @@ class RuntimeHWConfig:
runtimeconf = self.get_local_runtimeconf_binaryname()
def array_to_plusargs(valuesarr, plusarg):
args = map(lambda ind_rootfs: """{}{}={}""".format(plusarg, ind_rootfs[0], ind_rootfs[1]), enumerate(valuesarr))
args = []
for index, arg in enumerate(valuesarr):
if arg is not None:
args.append("""{}{}={}""".format(plusarg, index, arg))
return " ".join(args) + " "
command_macs = array_to_plusargs(all_macs, "+macaddr")

View File

@ -30,15 +30,30 @@ class JobConfig:
else:
self.bootbinary = parent_workload.common_bootbinary
if 'rootfs' in singlejob_dict:
if singlejob_dict['rootfs'] is None:
# Don't include a rootfs
self.rootfs = None
else:
# Explicit per-job rootfs
self.rootfs = parent_workload.workload_input_base_dir + singlejob_dict['rootfs']
else:
# No explicit per-job rootfs, inherit from workload
if parent_workload.derive_rootfs:
# No explicit workload rootfs, derive path from job name
self.rootfs = self.parent_workload.workload_input_base_dir + self.jobname + self.filesystemsuffix
elif parent_workload.common_rootfs is None:
# Don't include a rootfs
self.rootfs = None
else:
# Explicit rootfs path from workload
self.rootfs = self.parent_workload.workload_input_base_dir + self.parent_workload.common_rootfs
def bootbinary_path(self):
return self.parent_workload.workload_input_base_dir + self.bootbinary
def rootfs_path(self):
if self.parent_workload.common_rootfs is not None:
return self.parent_workload.workload_input_base_dir + self.parent_workload.common_rootfs
else:
# assume the rootfs is named after the job
return self.parent_workload.workload_input_base_dir + self.jobname + self.filesystemsuffix
return self.rootfs
def __str__(self):
return self.jobname
@ -60,7 +75,13 @@ class WorkloadConfig:
with open(self.workloadfilename) as json_data:
workloadjson = json.load(json_data)
self.common_rootfs = workloadjson.get("common_rootfs")
if 'common_rootfs' in workloadjson:
self.common_rootfs = workloadjson["common_rootfs"]
self.derive_rootfs = False
else:
self.common_rootfs = None
self.derive_rootfs = True
self.common_bootbinary = workloadjson.get("common_bootbinary")
self.workload_name = workloadjson.get("benchmark_name")
#self.rootfs_base = workloadjson.get("deliver_dir")

View File

@ -72,7 +72,7 @@ uart_t::uart_t(simif_t* sim, UARTWIDGET_struct * mmio_addrs, int uartno): endpoi
// also, for these we want to log output to file here.
std::string uartlogname = std::string("uartlog") + std::to_string(uartno);
printf("UART logfile is being written to %s\n", uartlogname.c_str());
this->loggingfd = open(uartlogname.c_str(), O_RDWR | O_CREAT);
this->loggingfd = open(uartlogname.c_str(), O_RDWR | O_CREAT, 0644);
}
// Don't block on reads if there is nothing typed in