MPI_ALLGATHERV test3

This commit is contained in:
zhangshuai 2019-05-30 11:33:06 +08:00
parent cb35012c7d
commit 9607a1ab76
2 changed files with 4 additions and 10 deletions

View File

@ -965,9 +965,6 @@ void World::Update()
for (int k = 0; k < tmp_gazebo_id; k++) for (int k = 0; k < tmp_gazebo_id; k++)
displs[tmp_gazebo_id] = displs[tmp_gazebo_id] + bufferLen[k]; displs[tmp_gazebo_id] = displs[tmp_gazebo_id] + bufferLen[k];
std::cout << "*************$$$$$$$$$ bufferLen:" << bufferLen[tmp_gazebo_id] << " $$$$$$$$$$***************" << std::endl;
std::cout << "*************$$$$$$$$$ displs: " << displs[tmp_gazebo_id] << " $$$$$$$$$$***************" << std::endl;
if (this->gazeboLocalID == tmp_gazebo_id) if (this->gazeboLocalID == tmp_gazebo_id)
{ {
sendBuffer = new char[bufferLen[tmp_gazebo_id] + 1]; sendBuffer = new char[bufferLen[tmp_gazebo_id] + 1];
@ -984,8 +981,6 @@ void World::Update()
receiveBuffer = new char[receiveBufferLen + 1]; receiveBuffer = new char[receiveBufferLen + 1];
receiveBuffer[receiveBufferLen] = '\0'; receiveBuffer[receiveBufferLen] = '\0';
std::cout << "*************$$$$$$$$$ bufferLen:" << receiveBufferLen << " $$$$$$$$$$***************" << std::endl;
// Added by zhangshuai 2019.04.03 for count time ----Begin // Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME #ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
@ -1018,12 +1013,12 @@ void World::Update()
// Added by zhangshuai 2019.04.03 for count time ----End // Added by zhangshuai 2019.04.03 for count time ----End
//receive and get information from other processes //receive and get information from other processes
for (int tmp_gazebo_id = 0; tmp_gazebo_id < this->distribution->GetGazeboCount(); tmp_gazebo_id++) for (int tmp_gazebo_id = 0; tmp_gazebo_id < tmp_gazebo_count; tmp_gazebo_id++)
{ {
if (this->gazeboLocalID != tmp_gazebo_id) if (this->gazeboLocalID != tmp_gazebo_id)
{ {
std::string receive_messages; std::string receive_messages = "";
for (int j = displs[tmp_gazebo_id]; j < bufferLen[tmp_gazebo_id]; j++) for (int j = displs[tmp_gazebo_id]; j < (displs[tmp_gazebo_id] + bufferLen[tmp_gazebo_id]); j++)
{ {
receive_messages.push_back(receiveBuffer[j]); receive_messages.push_back(receiveBuffer[j]);
} }
@ -1037,7 +1032,6 @@ void World::Update()
{ {
math::Pose tmp_pose; math::Pose tmp_pose;
std::string tmp_model_name = modelPoseListReceive.pose(i).name(); std::string tmp_model_name = modelPoseListReceive.pose(i).name();
std::cout << "*************$$$$$$$$$ model_name:" << tmp_model_name << " $$$$$$$$$$***************" << std::endl;
tmp_pose.pos.x = modelPoseListReceive.pose(i).position().x(); tmp_pose.pos.x = modelPoseListReceive.pose(i).position().x();
tmp_pose.pos.y = modelPoseListReceive.pose(i).position().y(); tmp_pose.pos.y = modelPoseListReceive.pose(i).position().y();
tmp_pose.pos.z = modelPoseListReceive.pose(i).position().z(); tmp_pose.pos.z = modelPoseListReceive.pose(i).position().z();

View File

@ -81,7 +81,7 @@ do
echo "${hosts[$i]}:start_good" echo "${hosts[$i]}:start_good"
done done
sleep 3m sleep 5m
#登入各节点kill相关进程以结束仿真1.目前方式比较暴力后续改进2.cd ~/MPI 还要进行灵活性优化) #登入各节点kill相关进程以结束仿真1.目前方式比较暴力后续改进2.cd ~/MPI 还要进行灵活性优化)
for((i=0;i<host_count;i++)) for((i=0;i<host_count;i++))