Running parallel simulations (using the Command Line)

有些话、适合烂在心里 提交于 2019-12-01 13:21:52

问题


How can I run the simulation with different configurations? I am using omnet++ version 4.6.

My omnetpp.ini file looks as below :

[General]

[Config Dcn2]

network = Dcn2

# leaf switch
#**.down_port = 2
**.up_port = 16 #12   # 4

# spine switch
**.port =  28 # 20 #2048

# crossconnect
**.cross_down_port = 28 # 20 #2048
**.cross_up_port = 28 # 20 #2048

# to set destination of packet
**.number_leaf_switch = 28 # 20 #2048

# link speed
#**.switch_switch_link_speed = 40 Mbps


**.interArrivalTime = ${exponential(.0001),exponential(0.0002),exponential(0.0003)}   

**.batch_length = 10
**.buffer_length = 10

sim-time-limit = 1000s

I want to run the code with different values of interArrivalTime. But I can neither run with different configs (one after another), nor can I run individual runs in parallel on separate cores.

I have tried with cmdev option in run configurations but the different runs doesn't show up apart from the 1st one. When I try mentioning the number of processes to be more than one then also only the first run gets simulated. I really cannot find out the reason.


回答1:


Config Examinataion

In your case you can perform config examination. OMNeT++ offers different options for that. They are explained under the Parameter Studies section of the OMNeT++ manual.

So you can try one of the following options to examine your configs and thus config file:

  • ./run –a - will show all the configurations in the omnet.ini
  • ./run -x <config_name> - will give more info about a specific config
  • ./run -x <config_name> -g - see all the combinations of configs

First you will have to navigate to your example folder, and there execute one of the aforementioned commands.


I executed: ./run -x Dcn2 -g and got the following resuls

OMNeT++ Discrete Event Simulation  (C) 1992-2014 Andras Varga, OpenSim Ltd.
Version: 4.6, build: 141202-f785492, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer
Setting up Tkenv...

Config: Dcn2
Number of runs: 3
Run 0: $0=exponential(.0001), $repetition=0
Run 1: $0=exponential(0.0002), $repetition=0
Run 2: $0=exponential(0.0003), $repetition=0

End.

This confirms indeed that you have 3 different runs for the simulation parameter you are trying to modify. However, variable name you are using for the interArrivalTime parameter is assigned to $0 by default because you have not specified it.

If you change the following line in your config:

**.interArrivalTime = ${exponential(.0001),exponential(0.0002),exponential(0.0003)}

to

**.interArrivalTime = ${interArrivalTime = exponential(0.0001),exponential(0.0002),exponential(0.0003)}

you will get a more descriptive output for ./run -x Dcn2 -g


Running different runs of a config:

Next step for you would be to run the different runs for your config. You can do that by navigating to your example directory and execute:

./run -c <config-name> -r <run-number> -u Cmdenv

Note that the <config-name> would be Dcn2 for you, and the -r specifies which of the runs given above you would like to execute.

In other words you can open three terminal windows and navigate to your example directory and do:

  1. ./run -c Dcn2 -r 0 -u Cmdenv - for interArrivalTime = exponential(0.0001)
  2. ./run -c Dcn2 -r 1 -u Cmdenv - for interArrivalTime = exponential(0.0002)
  3. ./run -c Dcn2 -r 2 -u Cmdenv - for interArrivalTime = exponential(0.0003)

Distinguishing Different run results

To be able to distinguish between the output result files of the different runs for your given config you can modify the default name of the output file.

The "how-to" is given in the 12.2.3 Result File Names section of the OMNeT++ manual.

output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"

As you can see by default your output files will be distinguished by the ${runnumber} variable. You can further improve it by adding the interArrivalTime to the output file name.

Example:

output-scalar-file = "${resultdir}/${configname}-${runnumber}-IAtime=${interArrivalTime}.sca/vec"

I have not tested the final approach. So you might get some error along the path.



来源:https://stackoverflow.com/questions/30570979/running-parallel-simulations-using-the-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!