python - Why cannot build gem5 with a custom memory controller? - Stack Overflow

admin2025-04-18  0

I'm trying to integrate a custom memory controller in gem5 but when I try to build it returns me this error:

terminate called after throwing an instance of 'pybind11::error_already_set'
what():  TypeError: module() takes at most 2 arguments (3 given)

At:
  src/learning_gem5/my_mem_ctrl/DpiMemCtrl.py(4): <module>
  <string>(40): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <string>(1): <module>
  src/python/m5/objects/__init__.py(29): <module>
  <string>(40): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <frozen importlib._bootstrap>(1050): _gcd_import
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap>(992): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <frozen importlib._bootstrap>(1050): _gcd_import
  /usr/lib/python3.10/importlib/__init__.py(126): import_module
  build_tools/sim_object_param_struct_hh.py(57): <module>

Aborted (core dumped)
scons: *** [build/X86/params/FUDesc.hh] Error 134
scons: building terminated because of errors.
*** Summary of Warnings ***
Warning: Header file <capstone/capstone.h> not found.
         This host has no capstone library installed.
Warning: Header file <png.h> not found.
         This host has no libpng library.
         Disabling support for PNG framebuffers.
Warning: Couldn't find HDF5 C++ libraries. Disabling HDF5 support.

The funny fact is that a friend of mine is able to compile it successfully while I can't. We share the same Ubuntu version (22.04), the same python version (3.10.12), the same g++ version (11.4.0) and the same scons version (4.5.2). May you help me? Thanks.

I'm trying to integrate a custom memory controller in gem5 but when I try to build it returns me this error:

terminate called after throwing an instance of 'pybind11::error_already_set'
what():  TypeError: module() takes at most 2 arguments (3 given)

At:
  src/learning_gem5/my_mem_ctrl/DpiMemCtrl.py(4): <module>
  <string>(40): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <string>(1): <module>
  src/python/m5/objects/__init__.py(29): <module>
  <string>(40): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <frozen importlib._bootstrap>(1050): _gcd_import
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap>(992): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  <frozen importlib._bootstrap>(1050): _gcd_import
  /usr/lib/python3.10/importlib/__init__.py(126): import_module
  build_tools/sim_object_param_struct_hh.py(57): <module>

Aborted (core dumped)
scons: *** [build/X86/params/FUDesc.hh] Error 134
scons: building terminated because of errors.
*** Summary of Warnings ***
Warning: Header file <capstone/capstone.h> not found.
         This host has no capstone library installed.
Warning: Header file <png.h> not found.
         This host has no libpng library.
         Disabling support for PNG framebuffers.
Warning: Couldn't find HDF5 C++ libraries. Disabling HDF5 support.

The funny fact is that a friend of mine is able to compile it successfully while I can't. We share the same Ubuntu version (22.04), the same python version (3.10.12), the same g++ version (11.4.0) and the same scons version (4.5.2). May you help me? Thanks.

Share edited Mar 7 at 17:01 Vincy asked Mar 7 at 11:57 VincyVincy 3611 silver badge10 bronze badges 1
  • Are both of you using same gem5 version ? Also ensure that you properly defined your memory controller constructor arguments properly in DpiMemCtrl.py and also initialize them from the frontend configuration file or library if you also create library for that. – Anklon Commented Mar 24 at 18:33
Add a comment  | 

1 Answer 1

Reset to default 0

You can build a custom memory controller in gem5 but it requires multiple steps. I recommend following the code in Ramulator2 repository to see how you can build a custom memory model: https://github/CMU-SAFARI/ramulator2/tree/main/resources/gem5_wrappers.

Ideally, I recommend building your memory controller by adding a custom one to Ramulator2 or a similar memory simulation framework that works with gem5.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744931262a275169.html

最新回复(0)