Skip to content
Snippets Groups Projects
Commit 776ea086 authored by Anna Wellmann's avatar Anna Wellmann
Browse files

Clean up edge node routine and add brackets

parent 435100db
No related branches found
No related tags found
1 merge request!104Add Communication Hiding to GPU version
......@@ -223,10 +223,8 @@ void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMe
// copy corner received node values from x
if (para->getNumberOfProcessNeighborsX(level, "recv") > 0) {
for (uint i = 0; i < para->getParH(level)->cornerNodesXtoY.recvPos.size(); i++) {
std::pair<int, int> & recvPosX = para->getParH(level)->cornerNodesXtoY.recvPos[i];
std::pair<int, int> & sendPosY = para->getParH(level)->cornerNodesXtoY.sendPos[i];
real &f = para->getParH(level)->recvProcessNeighborX[recvPosX.first].f[0][recvPosX.second];
para->getParH(level)->sendProcessNeighborY[sendPosY.first].f[0][sendPosY.second] = f;
para->getParH(level)->sendProcessNeighborY[para->getParH(level)->cornerNodesXtoY.sendPos[i].first].f[0][para->getParH(level)->cornerNodesXtoY.sendPos[i].second] =
para->getParH(level)->recvProcessNeighborX[para->getParH(level)->cornerNodesXtoY.recvPos[i].first].f[0][para->getParH(level)->cornerNodesXtoY.recvPos[i].second];
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -316,20 +314,16 @@ void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMe
// copy corner received node values from x
if (para->getNumberOfProcessNeighborsX(level, "recv") > 0) {
for (uint i = 0; i < para->getParH(level)->cornerNodesXtoZ.recvPos.size(); i++) {
std::pair<int, int> &recvPosX = para->getParH(level)->cornerNodesXtoZ.recvPos[i];
std::pair<int, int> &sendPosZ = para->getParH(level)->cornerNodesXtoZ.sendPos[i];
real &f = para->getParH(level)->recvProcessNeighborX[recvPosX.first].f[0][recvPosX.second];
para->getParH(level)->sendProcessNeighborZ[sendPosZ.first].f[0][sendPosZ.second] = f;
para->getParH(level)->sendProcessNeighborZ[para->getParH(level)->cornerNodesXtoZ.sendPos[i].first].f[0][para->getParH(level)->cornerNodesXtoZ.sendPos[i].second] =
para->getParH(level)->recvProcessNeighborX[para->getParH(level)->cornerNodesXtoZ.recvPos[i].first].f[0][para->getParH(level)->cornerNodesXtoZ.recvPos[i].second];
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// copy corner received node values from y
if (para->getNumberOfProcessNeighborsY(level, "recv") > 0) {
for (uint i = 0; i < para->getParH(level)->cornerNodesYtoZ.recvPos.size(); i++) {
std::pair<int, int> &recvPosY = para->getParH(level)->cornerNodesYtoZ.recvPos[i];
std::pair<int, int> &sendPosZ = para->getParH(level)->cornerNodesYtoZ.sendPos[i];
real &f = para->getParH(level)->recvProcessNeighborY[recvPosY.first].f[0][recvPosY.second];
para->getParH(level)->sendProcessNeighborZ[sendPosZ.first].f[0][sendPosZ.second] = f;
for (uint i = 0; i < para->getParH(level)->cornerNodesYtoZ.recvPos.size(); i++) {
para->getParH(level)->sendProcessNeighborZ[para->getParH(level)->cornerNodesYtoZ.sendPos[i].first].f[0][para->getParH(level)->cornerNodesYtoZ.sendPos[i].second] =
para->getParH(level)->recvProcessNeighborY[para->getParH(level)->cornerNodesYtoZ.recvPos[i].first].f[0][para->getParH(level)->cornerNodesYtoZ.recvPos[i].second];
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -2565,66 +2565,83 @@ void Parameter::findCornerNodesCommMultiGPU() {
void Parameter::findCornerNodesXY(int level)
{
for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++)
{
for (int j = 0; j < parH[level]->recvProcessNeighborX[i].numberOfNodes; j++) {
int index = parH[level]->recvProcessNeighborX[i].index[j];
bool foundIndex = findIndexInSendNodesXY(level, index);
if (foundIndex)
if (foundIndex){
this->parH[level]->cornerNodesXtoY.recvPos.push_back(std::pair(i, j));
}
}
}
}
std::cout << "para->cornerNodesXtoY.sendPos.size() " << this->getParH(level)->cornerNodesXtoY.sendPos.size() << std::endl;
}
bool Parameter::findIndexInSendNodesXY(int level, int index)
{
for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "send")); k++)
for (int l = 0; l < parH[level]->sendProcessNeighborY[l].numberOfNodes; l++)
{
for (int l = 0; l < parH[level]->sendProcessNeighborY[k].numberOfNodes; l++)
{
if (parH[level]->sendProcessNeighborY[k].index[l] == index) {
this->parH[level]->cornerNodesXtoY.sendPos.push_back(std::pair(k, l));
return true;
}
}
}
return false;
}
void Parameter::findCornerNodesXZ(int level)
{
for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++)
{
for (int j = 0; j < parH[level]->recvProcessNeighborX[i].numberOfNodes; j++) {
int index = parH[level]->recvProcessNeighborX[i].index[j];
bool foundIndex = findIndexInSendNodesXZ(level, index);
if (foundIndex)
if (foundIndex){
this->parH[level]->cornerNodesXtoZ.recvPos.push_back(std::pair(i, j));
}
}
}
}
bool Parameter::findIndexInSendNodesXZ(int level, int index)
{
for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++)
for (int l = 0; l < parH[level]->sendProcessNeighborZ[l].numberOfNodes; l++)
for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++){
for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++){
if (parH[level]->sendProcessNeighborZ[k].index[l] == index) {
this->parH[level]->cornerNodesXtoZ.sendPos.push_back(std::pair(k, l));
return true;
}
}
}
return false;
}
void Parameter::findCornerNodesYZ(int level)
{
for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "recv")); i++)
for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "recv")); i++){
for (int j = 0; j < parH[level]->recvProcessNeighborY[i].numberOfNodes; j++) {
int index = parH[level]->recvProcessNeighborY[i].index[j];
bool foundIndex = findIndexInSendNodesYZ(level, index);
if (foundIndex)
if (foundIndex){
this->parH[level]->cornerNodesYtoZ.recvPos.push_back(std::pair(i, j));
}
}
}
}
bool Parameter::findIndexInSendNodesYZ(int level, int index)
{
for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++)
for (int l = 0; l < parH[level]->sendProcessNeighborZ[l].numberOfNodes; l++)
for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++){
for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++){
if (parH[level]->sendProcessNeighborZ[k].index[l] == index) {
this->parH[level]->cornerNodesYtoZ.sendPos.push_back(std::pair(k, l));
return true;
}
}
}
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment