1. MPI_Allgatherv, version 0.6.1

2. a little modification in MPI_Gazebo_launch.sh and mygzserver
3. add MPI_Gazebo_end.sh to kill simulation quickly
This commit is contained in:
zhangshuai 2019-08-26 17:05:50 +08:00
parent aa36a32c94
commit 8b1c77a2fa
3 changed files with 55 additions and 4 deletions

View File

@ -0,0 +1,51 @@
#!/bin/bash
#####################################################################################################################################
# Author: Zhang Shuai #
# Date: 2019-08-26 #
# Description: End a MPI Gazebo simulation task #
# Usage: ./MPI_Gazebo_end.sh [hostfile] #
#####################################################################################################################################
host_file=$1
host_count=0
hosts=()
#获取hostfile文件中的host名字
while read line
do
if [ -n "$line" ]
then
temp=${line% *}
hosts[$host_count]=$temp
let host_count=$host_count+1
fi
done < $host_file
echo "host_count:$host_count"
for((i=0;i<host_count;i++))
do
echo "host_name:${hosts[$i]}"
done
#登入各节点kill相关进程以结束仿真1.目前方式比较暴力后续改进2.cd ~/Git/Gazebo_Distributed_MPI/mpi_run 还要进行灵活性优化)
for((i=0;i<host_count;i++))
do
ssh -f -n ${hosts[$i]} > /dev/null 2>&1 "cd ~/Git/Gazebo_Distributed_MPI/mpi_run;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
./kill.sh;
exit"
echo "${hosts[$i]}:close_good"
done
echo simulation_done!
exit 0

View File

@ -52,11 +52,11 @@ sleep 5s
#登入第一个节点启动MPI的gzserver并成为各自节点上的ROS node #登入第一个节点启动MPI的gzserver并成为各自节点上的ROS node
ssh -f -n ${hosts[0]} "cd ~/Git/Gazebo_Distributed_MPI/mpi_run; ssh -f -n ${hosts[0]} "cd ~/Git/Gazebo_Distributed_MPI/mpi_run;
mpiexec -hostfile $host_file -np 1 mygzserver $world_file $workspace_path : -np 1 mygzserver $world_file $workspace_path; mpiexec --mca btl_tcp_if_exclude docker0 -hostfile $host_file -np 1 mygzserver $world_file $workspace_path : -np 1 mygzserver $world_file $workspace_path;
echo mpiexec_done!" echo mpiexec_done!"
echo "${hosts[0]}:mpiexec_good" echo "${hosts[0]}:mpiexec_good"
sleep 20s sleep 10s
#登入各节点roslaunch加载模型source还有改进空间ROS运行的工作目录应该作为参数传进来 #登入各节点roslaunch加载模型source还有改进空间ROS运行的工作目录应该作为参数传进来
for((i=0;i<host_count;i++)) for((i=0;i<host_count;i++))
@ -70,7 +70,7 @@ do
echo "${hosts[$i]}:roslaunch_good" echo "${hosts[$i]}:roslaunch_good"
done done
sleep 40s sleep 20s
#登入各节点开始仿真 #登入各节点开始仿真
for((i=0;i<host_count;i++)) for((i=0;i<host_count;i++))

View File

@ -6,4 +6,4 @@ source $2/devel/setup.bash
export DISPLAY=:0.0 export DISPLAY=:0.0
gzserver -u -e ode --verbose $1 -s /opt/ros/kinetic/lib/libgazebo_ros_paths_plugin.so -s /opt/ros/kinetic/lib/libgazebo_ros_api_plugin.so /usr/local/bin/gzserver -u -e ode --verbose $1 -s /opt/ros/kinetic/lib/libgazebo_ros_paths_plugin.so -s /opt/ros/kinetic/lib/libgazebo_ros_api_plugin.so