From 8b1c77a2fa53dc0098444ebabfc4877d236bfd42 Mon Sep 17 00:00:00 2001 From: zhangshuai Date: Mon, 26 Aug 2019 17:05:50 +0800 Subject: [PATCH] 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 --- .../mpi_run/MPI_Gazebo_end.sh | 51 +++++++++++++++++++ .../mpi_run/MPI_Gazebo_launch.sh | 6 +-- Gazebo_Distributed_MPI/mpi_run/mygzserver | 2 +- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100755 Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_end.sh diff --git a/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_end.sh b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_end.sh new file mode 100755 index 0000000..e329e26 --- /dev/null +++ b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_end.sh @@ -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 /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 \ No newline at end of file diff --git a/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh index 664ce9e..23ffd8a 100755 --- a/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh +++ b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh @@ -52,11 +52,11 @@ sleep 5s #登入第一个节点启动MPI的gzserver,并成为各自节点上的ROS node 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 "${hosts[0]}:mpiexec_good" -sleep 20s +sleep 10s #登入各节点roslaunch加载模型(source还有改进空间,ROS运行的工作目录应该作为参数传进来) for((i=0;i