gem5-dev@gem5.org

The gem5 Developer List

View all threads

Import

JC
Jesse Comeau
Sat, May 11, 2024 1:20 PM

Hi, I'm not sure if I have this correctly, but I'm sending out an email.

My name is Jesse. I have Windows 10 with Developers option turned on, with
Windows Subsystem for Linux activated, and Ubuntu installed.

I just made the build for Gem5 and everything went smoothly. I'm at the
point where there's configurations for simulation in scripts? I created
file simple.py, but I have to import m5. It says import command not found.

What do I do?

Hi, I'm not sure if I have this correctly, but I'm sending out an email. My name is Jesse. I have Windows 10 with Developers option turned on, with Windows Subsystem for Linux activated, and Ubuntu installed. I just made the build for Gem5 and everything went smoothly. I'm at the point where there's configurations for simulation in scripts? I created file simple.py, but I have to import m5. It says import command not found. What do I do?
YZ
Yibo Zhang
Sat, May 11, 2024 5:57 PM

Hi,

As I understand it, the module import mechanism for gem5's python files is different from regular python. Since gem5 is running on pybind11's embedded python interpreter environment, the modules where some of the python files in gem5 are located are determined in scons, and some configurations in scons determine how modules are imported in gem5's python configuration files.Some editors such as vscode will report errors with imported modules, but they will actually run on gem5.

As for the m5 modules you imported, they are under 'src/python/m5'.

Yibo Zhang

-----Original Messages-----
From:"Jesse Comeau via gem5-dev" gem5-dev@gem5.org
Send time:Saturday, 05/11/2024 21:20:27
To: gem5-dev@gem5.org
Cc: "Jesse Comeau" jessecomeau87@gmail.com
Subject: [gem5-dev] Import

Hi, I'm not sure if I have this correctly, but I'm sending out an email.

My name is Jesse. I have Windows 10 with Developers option turned on, with Windows Subsystem for Linux activated, and Ubuntu installed.

I just made the build for Gem5 and everything went smoothly. I'm at the point where there's configurations for simulation in scripts? I created file simple.py, but I have to import m5. It says import command not found.

What do I do?

Best wishes!

Hi, As I understand it, the module import mechanism for gem5's python files is different from regular python. Since gem5 is running on pybind11's embedded python interpreter environment, the modules where some of the python files in gem5 are located are determined in scons, and some configurations in scons determine how modules are imported in gem5's python configuration files.Some editors such as vscode will report errors with imported modules, but they will actually run on gem5. As for the m5 modules you imported, they are under 'src/python/m5'. Yibo Zhang -----Original Messages----- From:"Jesse Comeau via gem5-dev" <gem5-dev@gem5.org> Send time:Saturday, 05/11/2024 21:20:27 To: gem5-dev@gem5.org Cc: "Jesse Comeau" <jessecomeau87@gmail.com> Subject: [gem5-dev] Import Hi, I'm not sure if I have this correctly, but I'm sending out an email. My name is Jesse. I have Windows 10 with Developers option turned on, with Windows Subsystem for Linux activated, and Ubuntu installed. I just made the build for Gem5 and everything went smoothly. I'm at the point where there's configurations for simulation in scripts? I created file simple.py, but I have to import m5. It says import command not found. What do I do? Best wishes!