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

Running ns3-ai when using cmake to build ns3 #77

Open Flunzmas opened 1 year ago

Flunzmas commented 1 year ago

I am using ns3.36.1 (mind: I'm new to ns3 and ns3-ai), and had to tweak this repo's code in a few ways before I could get the _a_plusb example to work:

  1. From ns3.36, the build system shifted from waf to cmake (see here, the ns3 command replaces the waf command), meaning that contrib modules have to be shipped with CMakeLists.txt files. I noticed that the cmake branch took care of just that, although with the new ns3 run command introduced in their commits so far I could not solve the issue introduced below in point 3.
  2. Additionally, it seems as if the string check for successful builds in build_ns3 (link) is invalid since that line is not printed (anymore?). Is it a good idea to simply do ok = proc.returncode == 0?
  3. Running the _a_plusb example as indicated in the README failed with the output /bin/sh: ./a_plus_b: No such file or directory. Changing line 59 of a_plus_b/run.py to exp = Experiment(mempool_key, mem_size, 'a_plus_b/ns3.36.1-sim-debug', '../../') (i.e. appending the /ns3.36.1-sim-debug to the path makes it work (EDIT: also applies to the rl-tcp example). Is this a bug or a result of changes in the ns3 code?
Mauriyin commented 1 year ago

Hi, Flunzmas,

Thanks for pointing out point 2. For 3, where did you run the a_plus_b example? If you copy the scripts to the scratch/, please remove the CMakeLists.txt and try it again. The making system is a little bit different, so we are trying to continue to work on fixing those issues and provide the documents.

Flunzmas commented 1 year ago

I am running the scripts as indicated in your readme, e.g. copying a_plus_b to the scratch folder and running run.py from scratch/a_plus_b. Removing the CMakeLists.txt and then running the examples leads to a build failure for me: run_single_ns3(): requested to build ns3, but build failed!

EDIT: I have implemented a small hotfix for my local fork that deals with these changes executable paths, see here. That commit is probably breaking the functionality for other use cases, though, so not yet ready for a pull request.

EDIT 2: This issue is related to #66 (which is closed already)

Mauriyin commented 1 year ago

We've made some new commits on the cmake branch. Please try to reinstall the python_interface as well.