ValueError:尝试以非软件包[gem5]

时间:2019-06-25 07:13:44

标签: python gem5

我正在configs / common中使用配置Simulation.py。我得到了错误

  

ValueError:尝试以非包形式进行相对导入

完整错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/X86/python/m5/main.py", line 438, in main
    exec(filecode, scope)
  File "configs/common/Simulation.py", line 49, in <module>
    from . import CpuConfig
ValueError: Attempted relative import in non-package

Simulation.py:

from __future__ import print_function
from __future__ import absolute_import

import sys
from os import getcwd
from os.path import join as joinpath

from . import CpuConfig
from . import BPConfig
from . import MemConfig

import m5
from m5.defines import buildEnv
from m5.objects import *
from m5.util import *

addToPath('../common')

我尝试从相对导入路径更改为绝对导入路径,但仍然出现错误。 这个人有一个类似的错误:https://www.mail-archive.com/gem5-users@gem5.org/msg16430.html,但对我来说并没有解决。

OS: Ubuntu 18.04.2 LTS
git SHA: d00aa3658498968f7dc2b586347771734af0d24a

1 个答案:

答案 0 :(得分:0)

Eleanor's comment之后,似乎他们正在尝试直接使用gem5.opt执行configs/common/Simulation.py,这不受支持。

通常,configs/common下的Python脚本并不意味着可以直接执行,而应排除其他脚本。

我知道的最重要的树内脚本是:

  • configs/example/fs.py:主要的交叉拱完整系统脚本
  • configs/example/se.py:主要的交叉拱系统调用仿真脚本
  • configs/example/arm/fs_bigLITTLE.py:ARM bigLITTLE系统
  • configs/example/arm/starter_fs.py:ARM最小系统
  • gem5/configs/learning_gem5/:Jason的Learning Gem5教程的教程脚本

因此,您看到configs/example/包含大多数有趣的内容。您只需要了解脚本必须包含哪些内容才能“运行”,最重要的组成部分基本上是对以下内容的调用:

Simulation.run

实际上开始模拟。

我所知道的唯一可观的文档是:

  1. http://gem5.org/这是一个半混乱的维基,所以命中注定

  2. Jason的
  3. http://learning.gem5.org/展示了如何设置一些基本的Python配置,并且非常有价值

  4. https://github.com/cirosantilli/linux-kernel-module-cheat,其中包含一些可以正常使用并且可以用作初始参考的设置

相关问题