Skip to content

Commit

Permalink
Removed the unnecessary parameter (-m) from run_all_benchmarks.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
CihatAltiparmak committed Aug 3, 2024
1 parent 67e2664 commit 6535984
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
17 changes: 6 additions & 11 deletions docs/how_to_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ To run all benchmarks, just select your middleware implementation and go ahead w
cd ws
source /opt/ros/rolling/setup.sh
source install/setup.sh
# select your middleware
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
sh src/moveit_middleware_benchmark/scripts/run_all_benchmarks.sh -i ./src/moveit_middleware_benchmark/middleware_configurations/rmw_cyclonedds/config_rmw_cyclonedds.sh -d /benchmark_results -m rmw_cyclonedds_cpp
# go to moveit_middleware_benchmark package's directory
cd src/moveit_middleware_benchmark
# conduct all benchmarks
sh src/moveit_middleware_benchmark/scripts/run_all_benchmarks.sh -i ./src/moveit_middleware_benchmark/middleware_configurations/rmw_cyclonedds/config.sh -d /benchmark_results
```

Let's explain all operations at `run_all_benchmarks.sh`.

#### selection of initial script
```
-i ./src/moveit_middleware_benchmark/middleware_configurations/rmw_cyclonedds/config_rmw_cyclonedds.sh
-i ./src/moveit_middleware_benchmark/middleware_configurations/rmw_cyclonedds/config.sh
```

This argument is for selecting the initial scripts to be run. In this repository, These initial scripts is used for configuring middleware so that middleware is used more effectively. For example, you can use the initial script to configure TCP settings for rmw_zenoh like below.

```shell
echo "The configurations for rmw_zenoh_cpp is started!"
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
sudo sysctl -w "net.ipv4.tcp_rmem=4096 4096 4096"
sudo sysctl -w "net.ipv4.tcp_wmem=4096 4096 4096"
sudo sysctl -w "net.ipv4.tcp_mem=4096 4096 4096"
Expand All @@ -49,13 +51,6 @@ benchmark_results/
└── rmw_zenoh_cpp.json
```

#### middleware selection
```
-m rmw_cyclonedds_cpp
```

This argument is important for both saving the benchmark results correctly and run `export RMW_IMPLEMENTATION=...` command correctly.

## Plot Visualization of Benchmark Results

After running `run_all_benchmarks.sh`, you can also visualize the box plots of benchmark results. Suppose that you have some benchmark results stored in below directory and the directory named `benchmark_results` is located in `ws` directory which this repository is built.
Expand Down
3 changes: 3 additions & 0 deletions middleware_configurations/rmw_cyclonedds/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "The configurations for rmw_cyclonedds_cpp is started!"
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
echo "The configurations for rmw_cyclonedds_cpp is finished!"
Empty file.
3 changes: 3 additions & 0 deletions middleware_configurations/rmw_fastrtps/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "The configurations for rmw_fastrtps_cpp is started!"
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
echo "The configurations for rmw_fastrtps_cpp is finished!"
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
echo "The configurations for rmw_zenoh_cpp is started!"
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
sudo sysctl -w "net.ipv4.tcp_rmem=4096 4096 4096"
sudo sysctl -w "net.ipv4.tcp_wmem=4096 4096 4096"
sudo sysctl -w "net.ipv4.tcp_mem=4096 4096 4096"
Expand Down
13 changes: 4 additions & 9 deletions scripts/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
helpFunction()
{
echo ""
echo "Usage: $0 -i initial_script -m middleware_name -d benchmark_results_directory"
echo "Usage: $0 -i initial_script -d benchmark_results_directory"
echo -i "\t-i initial_script to run once all benchmarks are started"
echo -m "\t-m selected middleware to benchmark"
echo -d "\t-d the directory the benchmark results is saved"
exit 1 # Exit script after printing help
}
Expand All @@ -13,33 +12,29 @@ while getopts "i:m:d:" opt
do
case "$opt" in
i ) initial_script="$OPTARG" ;;
m ) middleware_name="$OPTARG" ;;
d ) benchmark_results_directory="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done

# Print helpFunction in case parameters are empty
if [ -z "$initial_script" ] || [ -z "$middleware_name" ] || [ -z "$benchmark_results_directory" ]
if [ -z "$initial_script" ] || [ -z "$benchmark_results_directory" ]
then
echo "Some or all of the parameters are empty";
helpFunction
fi

echo "middleware name is $middleware_name"
echo "benchmark results directory is $benchmark_results_directory"

echo "Benchmarking is starting!"
echo "Starting initial scripts before benchmarks run!"
sh "$initial_script"
echo "Initial script has finished! Now starting to benchmark middleware with scenarios!"

export RMW_IMPLEMENTATION=${middleware_name}

mkdir ${benchmark_results_directory}/scenario_basic_service_client -p
ros2 daemon stop
ros2 launch moveit_middleware_benchmark scenario_basic_service_client_benchmark.launch.py benchmark_command_args:="--benchmark_out=${benchmark_results_directory}/scenario_basic_service_client/${middleware_name}.json --benchmark_out_format=json"
ros2 launch moveit_middleware_benchmark scenario_basic_service_client_benchmark.launch.py benchmark_command_args:="--benchmark_out=${benchmark_results_directory}/scenario_basic_service_client/${RMW_IMPLEMENTATION}.json --benchmark_out_format=json"

mkdir ${benchmark_results_directory}/scenario_perception_pipeline -p
ros2 daemon stop
ros2 launch moveit_middleware_benchmark scenario_perception_pipeline_benchmark.launch.py benchmark_command_args:="--benchmark_out=${benchmark_results_directory}/scenario_perception_pipeline/${middleware_name}.json --benchmark_out_format=json"
ros2 launch moveit_middleware_benchmark scenario_perception_pipeline_benchmark.launch.py benchmark_command_args:="--benchmark_out=${benchmark_results_directory}/scenario_perception_pipeline/${RMW_IMPLEMENTATION}.json --benchmark_out_format=json" selected_test_case_index:=0

0 comments on commit 6535984

Please sign in to comment.