hust-diangroup / ns3-ai

Enable the interaction between ns-3 and popular frameworks using Python, which mean you can train and test your AI algorithms in ns-3 without changing any frameworks you are using now!
GNU General Public License v2.0
220 stars 80 forks source link

using vector: APB_SIZE size problem #113

Closed yfh667 closed 5 months ago

yfh667 commented 5 months ago

I am currently using version 1.2.0 of the memory communication to develop another module. At the moment, I am transferring the position information of nodes in the simulation to an external program outside of ns3 for computational processing, using the vector transmission mode. However, I've encountered a problem where if the APB_SIZE exceeds 73, it results in an error.

Traceback (most recent call last): File "/home/yfh/home/ns3.39/manswn/contrib/ai/examples/satway/use-msg-vec/apb.py", line 26, in <module> exp = Experiment("ns3ai_apb_msg_vec2", "../../../../../", py_binding, File "/home/yfh/home/ns3.39/manswn/contrib/ai/python_utils/ns3ai_utils.py", line 136, in __init__ self.msgInterface.GetPy2CppVector().resize(self.vectorSize) RuntimeError: boost::interprocess::bad_alloc Exception ignored in: <function Experiment.__del__ at 0x7fc684c7ee60> Traceback (most recent call last): File "/home/yfh/home/ns3.39/manswn/contrib/ai/python_utils/ns3ai_utils.py", line 145, in __del__ self.kill() File "/home/yfh/home/ns3.39/manswn/contrib/ai/python_utils/ns3ai_utils.py", line 166, in kill if self.proc and self.isalive(): AttributeError: 'Experiment' object has no attribute 'proc' The program works fine when APB_SIZE is less than 74, but it fails when APB_SIZE is greater than 73. The format for location data is (x,y,z), so the vector would be structured like [(x,y,z), (x,y,z), ...]. Is there any variable or specific part of the code that I need to modify to address this issue? So far, I haven't been able to find the problematic variable.

yfh667 commented 5 months ago

in ns3_ai_utils.py shmSize=60000, modify this