Click here to Skip to main content
15,876,805 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How to recover missing file ? Pin
Richard MacCutchan28-Feb-24 8:00
mveRichard MacCutchan28-Feb-24 8:00 
AnswerRe: How to recover missing file ? Pin
jschell28-Feb-24 12:26
jschell28-Feb-24 12:26 
AnswerRe: How to recover missing file ? Pin
k505428-Feb-24 12:34
mvek505428-Feb-24 12:34 
GeneralRe: How to recover missing file ? Pin
Salvatore Terress29-Feb-24 1:11
Salvatore Terress29-Feb-24 1:11 
GeneralRe: How to recover missing file ? Pin
k505429-Feb-24 5:19
mvek505429-Feb-24 5:19 
GeneralRe: How to recover missing file ? Pin
jschell29-Feb-24 12:24
jschell29-Feb-24 12:24 
GeneralRe: How to recover missing file ? Pin
k505429-Feb-24 12:50
mvek505429-Feb-24 12:50 
QuestionMpi blocking communication Pin
Member 1518121126-Feb-24 11:19
Member 1518121126-Feb-24 11:19 
I'm currently working on a lattice Boltzmann code (D3Q27) employing MPI for parallelization. I've implemented MPI 3D topology for communication, and my code snippet handles communication as follows, I also have the same structure for the communication between front-back and up-down.

void Simulation::Communicate(int iter) {

int tag_xp = 0;
int tag_xm = 1;
int tag_yp = 2;
int tag_ym = 3;
int tag_zp = 4;
int tag_zm = 5;

MPI_Status status;

if (SubDomain_.my_right_ != MPI_PROC_NULL) {
std::vector<double> send_data;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {

if (SubDomain_.lattice_[SubDomain_.my_Nx_ - 2][j][k] == nullptr) {
for (int dir = 0; dir < _nLatNodes; dir++) {

send_data.push_back(0.0);

}
}
else {

for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(SubDomain_.lattice_[SubDomain_.my_Nx_ - 2][j][k]->m_distributions[dir]);

}
}

}
}

std::vector<double> recv_data(send_data.size());

MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xp,
recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xm,
MPI_COMM_WORLD, &status);


int index = 0;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
for (int dir = 0; dir < _nLatNodes; dir++) {
SubDomain_.lattice_[SubDomain_.my_Nx_ - 1][j][k]->m_distributions[dir] = recv_data[index];
index++;
}
}
}

}


if (SubDomain_.my_left_ != MPI_PROC_NULL) {
std::vector<double> send_data;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {

if (SubDomain_.lattice_[1][j][k] == nullptr) {
for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(0.0);
}
}
else {

for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(SubDomain_.lattice_[1][j][k]->m_distributions[dir]);
}

}
}
}

std::vector<double> recv_data(send_data.size());
MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_left_, tag_xm,
recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_left_, tag_xp,
MPI_COMM_WORLD, &status);
int index = 0;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
for (int dir = 0; dir < _nLatNodes; dir++) {
SubDomain_.lattice_[0][j][k]->m_distributions[dir] = recv_data[index];
index++;
}
}
}
}
}


While I can verify that communication occurs correctly by printing sent and received data, upon visualization, it appears that the data might not be transferring to neighboring processors as expected, despite not being zeroed out (as previously confirmed through printing). After each iteration, I visualize the velocity components obtained via the Lattice Boltzmann Method (LBM). My observation reveals that the fluid dynamics are solely resolved within the processor featuring the inlet boundary condition, while all other processors exhibit a velocity of zero. This suggests that data transfer to neighboring processors might not be occurring as expected.

I have a couple of concerns:

Could data corruption arise from blocking communication? Is diagonal communication necessary? My understanding is that if communication in the normal directions (x, y, and z) is established, diagonal communication implicitly occurs. Additionally, I'm uncertain about the order of communication. Do all communications happen simultaneously, or is it sequential (e.g., right and left, then front and back, then up and down)? If they're not simultaneous, would diagonal communication be required?

I also have a confusion in receiver processor id. for example

MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xp, recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xm, MPI_COMM_WORLD, &status); should it be SubDomain_.myrank_, instead of SubDomain_.my_right_ in receive part?

I'd appreciate any insights to clarify these points of confusion. Thank you!
AnswerRe: Mpi blocking communication Pin
jschell26-Feb-24 12:22
jschell26-Feb-24 12:22 
Questionhow to "include" this... Pin
Salvatore Terress26-Feb-24 8:37
Salvatore Terress26-Feb-24 8:37 
AnswerRe: how to "include" this... Pin
Richard MacCutchan26-Feb-24 9:09
mveRichard MacCutchan26-Feb-24 9:09 
AnswerRe: how to "include" this... Pin
jschell26-Feb-24 12:25
jschell26-Feb-24 12:25 
GeneralRe: how to "include" this... Pin
Salvatore Terress26-Feb-24 16:48
Salvatore Terress26-Feb-24 16:48 
GeneralRe: how to "include" this... Pin
RedDk27-Feb-24 7:51
RedDk27-Feb-24 7:51 
AnswerRe: how to "include" this... Pin
Maximilien27-Feb-24 1:32
Maximilien27-Feb-24 1:32 
GeneralRe: how to "include" this... Pin
Salvatore Terress27-Feb-24 7:19
Salvatore Terress27-Feb-24 7:19 
QuestionPaige-Tarjan algorithm in C Pin
Joeyabuki26-Feb-24 4:06
Joeyabuki26-Feb-24 4:06 
AnswerRe: Paige-Tarjan algorithm in C Pin
Maximilien26-Feb-24 5:51
Maximilien26-Feb-24 5:51 
GeneralRe: Paige-Tarjan algorithm in C Pin
Joeyabuki26-Feb-24 6:20
Joeyabuki26-Feb-24 6:20 
QuestionExtracting the Points from a CRgn Object - C / C++ / MFC ... Pin
Member 1601389325-Feb-24 18:47
Member 1601389325-Feb-24 18:47 
AnswerRe: Extracting the Points from a CRgn Object - C / C++ / MFC ... Pin
Victor Nijegorodov25-Feb-24 20:09
Victor Nijegorodov25-Feb-24 20:09 
QuestionHow to create a hover popup window beside the mouse cursor Pin
Member 1185324-Feb-24 15:51
Member 1185324-Feb-24 15:51 
AnswerRe: How to create a hover popup window beside the mouse cursor Pin
Richard MacCutchan24-Feb-24 20:50
mveRichard MacCutchan24-Feb-24 20:50 
QuestionPLEASE help (me) with syntax for placings redirection to file. Pin
Salvatore Terress19-Feb-24 6:08
Salvatore Terress19-Feb-24 6:08 
AnswerRe: PLEASE help (me) with syntax for placings redirection to file. Pin
Mircea Neacsu19-Feb-24 6:50
Mircea Neacsu19-Feb-24 6:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.