diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 5edae460afafff5cb68c9d98fc13fcbe48067fce..fe1ae5ba66c23e7fd2311f085327eb3b0a57a717 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -339,7 +339,7 @@ void GridGenerator::initalValuesDomainDecompostion() builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborX[j].index, direction, level); if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC) - indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseX(level, j, direction); + indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseX(level, j, direction); //////////////////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyProcessNeighborXIndex(level, j); //////////////////////////////////////////////////////////////////////////////////////// @@ -408,7 +408,7 @@ void GridGenerator::initalValuesDomainDecompostion() builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborY[j].index, direction, level); if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC) - indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseY(level, j, direction); + indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseY(level, j, direction); //////////////////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyProcessNeighborYIndex(level, j); //////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp index 56aae47b0ce9da21eb5ca9150b2f63e61adaa9f6..bcf4b83cd66fa3179e71515f1ead07cc30b3cf21 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp @@ -1,214 +1,267 @@ #include "IndexRearrangementForStreams.h" +#include "Communication/Communicator.h" #include "Parameter/Parameter.h" -#include <GridGenerator/grid/GridBuilder/GridBuilder.h> #include <GridGenerator/grid/Grid.h> -#include "Communication/Communicator.h" +#include <GridGenerator/grid/GridBuilder/GridBuilder.h> -#include <iostream> #include <algorithm> +#include <iostream> IndexRearrangementForStreams::IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder) : para(para), builder(builder) -{ } +{ +} -void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseX(const uint &level, int j, +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseX(const uint &level, + int indexOfProcessNeighbor, int direction) { // init send indices for communication after coarse to fine std::cout << "communication: reorder send indices X "; - para->initNumberOfProcessNeighborsAfterFtoCX(level); + para->initProcessNeighborsAfterFtoCX(level); std::vector<uint> sendIndicesForCommAfterFtoCPositions; - reorderSendIndicesForCommAfterFtoCX(direction, level, j, sendIndicesForCommAfterFtoCPositions); - para->setSendProcessNeighborsAfterFtoCX(para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].numberOfNodes, - level, j); + reorderSendIndicesForCommAfterFtoCX(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCX( + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); - // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions from sending process + // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions + // from sending process std::cout << "mpi send and receive "; std::vector<uint> recvIndicesForCommAfterFtoCPositions; recvIndicesForCommAfterFtoCPositions.resize( - (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].numberOfNodes * + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes * 2); // give vector an arbitraty size (larger than needed) // TODO: Find a better way auto comm = vf::gpu::Communicator::getInstanz(); comm->exchangeIndices(recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->recvProcessNeighborX[j].rankNeighbor, + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->sendProcessNeighborX[j].rankNeighbor); - + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].rankNeighbor); + // resize receiving vector to correct size auto it = std::unique(recvIndicesForCommAfterFtoCPositions.begin(), recvIndicesForCommAfterFtoCPositions.end()); - recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way // init receive indices for communication after coarse to fine std::cout << "reorder receive indices "; - reorderRecvIndicesForCommAfterFtoCX(direction, level, j, recvIndicesForCommAfterFtoCPositions); - para->setRecvProcessNeighborsAfterFtoCX(para->getParH(level)->recvProcessNeighborsAfterFtoCX[j].numberOfNodes, - level, j); - copyProcessNeighborToCommAfterFtoCX(level, j); + reorderRecvIndicesForCommAfterFtoCX(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCX( + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); + copyProcessNeighborToCommAfterFtoCX(level, indexOfProcessNeighbor); std::cout << "done." << std::endl; } -void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseY(const uint &level, int j, int direction) +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseY(const uint &level, + int indexOfProcessNeighbor, + int direction) { // init send indices for communication after coarse to fine std::cout << "communication: reorder send indices Y "; - para->initNumberOfProcessNeighborsAfterFtoCY(level); + para->initProcessNeighborsAfterFtoCY(level); std::vector<uint> sendIndicesForCommAfterFtoCPositions; - reorderSendIndicesForCommAfterFtoCY(direction, level, j, sendIndicesForCommAfterFtoCPositions); - para->setSendProcessNeighborsAfterFtoCY(para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].numberOfNodes, - level, j); + reorderSendIndicesForCommAfterFtoCY(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCY( + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); - // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions from sending process + // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions + // from sending process std::cout << "mpi send and receive "; - std::vector<uint> recvIndicesForCommAfterFtoCPositions; - recvIndicesForCommAfterFtoCPositions.resize((size_t) para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].numberOfNodes * - 2); // give vector an arbitraty size (larger than needed) // TODO: Find a better way + std::vector<uint> recvIndicesForCommAfterFtoCPositions; + recvIndicesForCommAfterFtoCPositions.resize( + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes * + 2); // give vector an arbitraty size (larger than needed) // TODO: Find a better way auto comm = vf::gpu::Communicator::getInstanz(); comm->exchangeIndices(recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->recvProcessNeighborY[j].rankNeighbor, + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->sendProcessNeighborY[j].rankNeighbor); - + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].rankNeighbor); + // resize receiving vector to correct size auto it = std::unique(recvIndicesForCommAfterFtoCPositions.begin(), recvIndicesForCommAfterFtoCPositions.end()); - recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way // init receive indices for communication after coarse to fine std::cout << "reorder receive indices "; - reorderRecvIndicesForCommAfterFtoCY(direction, level, j, recvIndicesForCommAfterFtoCPositions); - para->setRecvProcessNeighborsAfterFtoCY(para->getParH(level)->recvProcessNeighborsAfterFtoCY[j].numberOfNodes, - level, j); + reorderRecvIndicesForCommAfterFtoCY(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCY( + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); - copyProcessNeighborToCommAfterFtoCY(level, j); + copyProcessNeighborToCommAfterFtoCY(level, indexOfProcessNeighbor); std::cout << "done." << std::endl; } -void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseZ(const uint &level, int j, int direction) +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseZ(const uint &level, + int indexOfProcessNeighbor, + int direction) { // init send indices for communication after coarse to fine std::cout << "communication: reorder send indices Z "; - para->initNumberOfProcessNeighborsAfterFtoCZ(level); + para->initProcessNeighborsAfterFtoCZ(level); std::vector<uint> sendIndicesForCommAfterFtoCPositions; - reorderSendIndicesForCommAfterFtoCZ(direction, level, j, sendIndicesForCommAfterFtoCPositions); - para->setSendProcessNeighborsAfterFtoCZ(para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].numberOfNodes, - level, j); + reorderSendIndicesForCommAfterFtoCZ(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCZ( + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); - // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions from sending process + // send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFtoCPositions + // from sending process std::cout << "mpi send and receive "; - std::vector<uint> recvIndicesForCommAfterFtoCPositions; - recvIndicesForCommAfterFtoCPositions.resize((size_t) para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].numberOfNodes * - 2); // give vector an arbitraty size (larger than needed) // TODO: Find a better way + std::vector<uint> recvIndicesForCommAfterFtoCPositions; + recvIndicesForCommAfterFtoCPositions.resize( + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes * + 2); // give vector an arbitraty size (larger than needed) // TODO: Find a better way auto comm = vf::gpu::Communicator::getInstanz(); comm->exchangeIndices(recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->recvProcessNeighborZ[j].rankNeighbor, + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), - para->getParH(level)->sendProcessNeighborZ[j].rankNeighbor); - + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor); + // resize receiving vector to correct size auto it = std::unique(recvIndicesForCommAfterFtoCPositions.begin(), recvIndicesForCommAfterFtoCPositions.end()); - recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + recvIndicesForCommAfterFtoCPositions.erase(std::prev(it, 1), + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way // init receive indices for communication after coarse to fine std::cout << "reorder receive indices "; - reorderRecvIndicesForCommAfterFtoCZ(direction, level, j, recvIndicesForCommAfterFtoCPositions); - para->setRecvProcessNeighborsAfterFtoCZ(para->getParH(level)->recvProcessNeighborsAfterFtoCZ[j].numberOfNodes, - level, j); + reorderRecvIndicesForCommAfterFtoCZ(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCZ( + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); - copyProcessNeighborToCommAfterFtoCZ(level, j); + copyProcessNeighborToCommAfterFtoCZ(level, indexOfProcessNeighbor); std::cout << "done." << std::endl; } -void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCX(const uint &level, int j) +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCX(const uint &level, int indexOfProcessNeighbor) { // init f[0]* - para->getParD(level)->sendProcessNeighborsAfterFtoCX[j].f[0] = para->getParD(level)->sendProcessNeighborX[j].f[0]; - para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].f[0] = para->getParH(level)->sendProcessNeighborX[j].f[0]; - para->getParD(level)->recvProcessNeighborsAfterFtoCX[j].f[0] = para->getParD(level)->recvProcessNeighborX[j].f[0]; - para->getParH(level)->recvProcessNeighborsAfterFtoCX[j].f[0] = para->getParH(level)->recvProcessNeighborX[j].f[0]; + para->getParD(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].f[0]; // init index* - para->getParD(level)->sendProcessNeighborsAfterFtoCX[j].index = para->getParD(level)->sendProcessNeighborX[j].index; - para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].index = para->getParH(level)->sendProcessNeighborX[j].index; - para->getParD(level)->recvProcessNeighborsAfterFtoCX[j].index = para->getParD(level)->recvProcessNeighborX[j].index; - para->getParH(level)->recvProcessNeighborsAfterFtoCX[j].index = para->getParH(level)->recvProcessNeighborX[j].index; + para->getParD(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; // rank neighbor - para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].rankNeighbor = para->getParH(level)->sendProcessNeighborX[j].rankNeighbor; - para->getParH(level)->recvProcessNeighborsAfterFtoCX[j].rankNeighbor = para->getParH(level)->recvProcessNeighborX[j].rankNeighbor; + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor; } -void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCY(const uint &level, int j) +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCY(const uint &level, int indexOfProcessNeighbor) { // init f[0]* - para->getParD(level)->sendProcessNeighborsAfterFtoCY[j].f[0] = para->getParD(level)->sendProcessNeighborY[j].f[0]; - para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].f[0] = para->getParH(level)->sendProcessNeighborY[j].f[0]; - para->getParD(level)->recvProcessNeighborsAfterFtoCY[j].f[0] = para->getParD(level)->recvProcessNeighborY[j].f[0]; - para->getParH(level)->recvProcessNeighborsAfterFtoCY[j].f[0] = para->getParH(level)->recvProcessNeighborY[j].f[0]; + para->getParD(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].f[0]; // init index* - para->getParD(level)->sendProcessNeighborsAfterFtoCY[j].index = para->getParD(level)->sendProcessNeighborY[j].index; - para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].index = para->getParH(level)->sendProcessNeighborY[j].index; - para->getParD(level)->recvProcessNeighborsAfterFtoCY[j].index = para->getParD(level)->recvProcessNeighborY[j].index; - para->getParH(level)->recvProcessNeighborsAfterFtoCY[j].index = para->getParH(level)->recvProcessNeighborY[j].index; + para->getParD(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; // rank neighbor - para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].rankNeighbor = para->getParH(level)->sendProcessNeighborY[j].rankNeighbor; - para->getParH(level)->recvProcessNeighborsAfterFtoCY[j].rankNeighbor = para->getParH(level)->recvProcessNeighborY[j].rankNeighbor; + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor; } -void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCZ(const uint &level, int j) +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCZ(const uint &level, int indexOfProcessNeighbor) { // init f[0]* - para->getParD(level)->sendProcessNeighborsAfterFtoCZ[j].f[0] = para->getParD(level)->sendProcessNeighborZ[j].f[0]; - para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].f[0] = para->getParH(level)->sendProcessNeighborZ[j].f[0]; - para->getParD(level)->recvProcessNeighborsAfterFtoCZ[j].f[0] = para->getParD(level)->recvProcessNeighborZ[j].f[0]; - para->getParH(level)->recvProcessNeighborsAfterFtoCZ[j].f[0] = para->getParH(level)->recvProcessNeighborZ[j].f[0]; + para->getParD(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].f[0]; // init index* - para->getParD(level)->sendProcessNeighborsAfterFtoCZ[j].index = para->getParD(level)->sendProcessNeighborZ[j].index; - para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].index = para->getParH(level)->sendProcessNeighborZ[j].index; - para->getParD(level)->recvProcessNeighborsAfterFtoCZ[j].index = para->getParD(level)->recvProcessNeighborZ[j].index; - para->getParH(level)->recvProcessNeighborsAfterFtoCZ[j].index = para->getParH(level)->recvProcessNeighborZ[j].index; + para->getParD(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; // rank neighbor - para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].rankNeighbor = para->getParH(level)->sendProcessNeighborZ[j].rankNeighbor; - para->getParH(level)->recvProcessNeighborsAfterFtoCZ[j].rankNeighbor = para->getParH(level)->recvProcessNeighborZ[j].rankNeighbor; + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor; } -void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCX(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCX( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *sendIndices = para->getParH(level)->sendProcessNeighborX[j].index; - int &numberOfSendNeighborsAfterFtoC = para->getParH(level)->sendProcessNeighborsAfterFtoCX[j].numberOfNodes; - reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, j, + int *sendIndices = para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + int &numberOfSendNeighborsAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCY(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCY( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *sendIndices = para->getParH(level)->sendProcessNeighborY[j].index; - int &numberOfSendNeighborsAfterFtoC = para->getParH(level)->sendProcessNeighborsAfterFtoCY[j].numberOfNodes; - reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, j, + int *sendIndices = para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + int &numberOfSendNeighborsAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCZ(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCZ( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *sendIndices = para->getParH(level)->sendProcessNeighborZ[j].index; - int &numberOfSendNeighborsAfterFtoC = para->getParH(level)->sendProcessNeighborsAfterFtoCZ[j].numberOfNodes; - reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, j, + int *sendIndices = para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + int &numberOfSendNeighborsAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC(int *sendIndices, int &numberOfSendNeighborsAfterFtoC, - int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC( + int *sendIndices, int &numberOfSendNeighborsAfterFtoC, int direction, int level, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { *logging::out << logging::Logger::INFO_INTERMEDIATE << "reorder send indices for communication after fine to coarse: level: " << level @@ -225,10 +278,10 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC(int *sendI std::array<int, 7> neighbors; uint numberOfSendIndices = builder->getNumberOfSendIndices(direction, level); - //iCellFCC + // iCellFCC for (uint posInSendIndices = 0; posInSendIndices < numberOfSendIndices; posInSendIndices++) { neighbors.fill(-1); - sparseIndexSend = sendIndices[posInSendIndices]; + sparseIndexSend = sendIndices[posInSendIndices]; if (isSparseIndexInICellFCC(para->getParH(level)->intFC.kFC, sparseIndexSend, level)) addUniqueIndexToCommunicationVectors(sendIndicesAfterFtoC, sparseIndexSend, sendIndicesForCommAfterFtoCPositions, posInSendIndices); @@ -293,7 +346,7 @@ void IndexRearrangementForStreams::aggregateNodesInICellCFC(int level, std::vect nodesCFC.push_back(neighborY[neighborX[sparseIndex]]); nodesCFC.push_back(neighborZ[neighborX[sparseIndex]]); nodesCFC.push_back(neighborZ[neighborY[sparseIndex]]); - nodesCFC.push_back(neighborZ[neighborY[neighborX[sparseIndex]]]); + nodesCFC.push_back(neighborZ[neighborY[neighborX[sparseIndex]]]); } // remove duplicate nodes @@ -307,7 +360,8 @@ void IndexRearrangementForStreams::addUniqueIndexToCommunicationVectors( std::vector<unsigned int> &sendIndicesForCommAfterFtoCPositions, uint &posInSendIndices) const { // add index to corresponding vectors but omit indices which are already in sendIndicesAfterFtoC - if (std::find(sendIndicesAfterFtoC.begin(), sendIndicesAfterFtoC.end(), sparseIndexSend) == sendIndicesAfterFtoC.end()) { + if (std::find(sendIndicesAfterFtoC.begin(), sendIndicesAfterFtoC.end(), sparseIndexSend) == + sendIndicesAfterFtoC.end()) { sendIndicesAfterFtoC.push_back(sparseIndexSend); sendIndicesForCommAfterFtoCPositions.push_back(posInSendIndices); } @@ -342,37 +396,36 @@ void IndexRearrangementForStreams::findIndicesNotInCommAfterFtoC(const uint &num } } -void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCX(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCX( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *recvIndices = para->getParH(level)->recvProcessNeighborX[j].index; - int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCX[j].numberOfNodes; - reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, j, + int *recvIndices = para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; + int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCY(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCY( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *recvIndices = para->getParH(level)->recvProcessNeighborY[j].index; - int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCY[j].numberOfNodes; - reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, j, + int *recvIndices = para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; + int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCZ(int direction, int level, int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCZ( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { - int *recvIndices = para->getParH(level)->recvProcessNeighborZ[j].index; - int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCZ[j].numberOfNodes; - reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, j, + int *recvIndices = para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; + int &numberOfRecvNeighborsAfterFtoC = para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNeighborsAfterFtoC, direction, level, sendIndicesForCommAfterFtoCPositions); } -void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC(int *recvIndices, - int &numberOfRecvNeighborsAfterFtoC, int direction, int level, - int j, - std::vector<uint> &sendIndicesForCommAfterFtoCPositions) +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( + int *recvIndices, int &numberOfRecvNeighborsAfterFtoC, int direction, int level, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { *logging::out << logging::Logger::INFO_INTERMEDIATE << "reorder receive indices for communication after fine to coarse: level: " << level @@ -436,8 +489,8 @@ void IndexRearrangementForStreams::splitFineToCoarseIntoBorderAndBulk(const uint void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkFC(int level) { // This function reorders the arrays of FCC/FCF indices and return pointers and sizes of the new subarrays: - // The coarse cells for interpolation from fine to coarse (iCellFCC) are divided into two subgroups: border and bulk. - // The fine cells (iCellFCF) are reordered accordingly. + // The coarse cells for interpolation from fine to coarse (iCellFCC) are divided into two subgroups: border and + // bulk. The fine cells (iCellFCF) are reordered accordingly. // create some local variables for better readability uint *iCellFccAll = para->getParH(level)->intFC.ICellFCC; @@ -480,37 +533,40 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkFC(int level void IndexRearrangementForStreams::splitCoarseToFineIntoBorderAndBulk(const uint &level) { - // For communication hiding, the interpolation cells from the coarse to the fine grid need to be split into two groups: + // For communication hiding, the interpolation cells from the coarse to the fine grid need to be split into two + // groups: // - cells which are at the border between two gpus --> "border" // - the other cells which are not directly related to the communication betweeen the two gpus --> "bulk" - this->getGridInterfaceIndicesBorderBulkCF(level); para->getParD(level)->intCFBorder.kCF = para->getParH(level)->intCFBorder.kCF; para->getParD(level)->intCFBulk.kCF = para->getParH(level)->intCFBulk.kCF; para->getParD(level)->intCFBorder.ICellCFC = para->getParD(level)->intCF.ICellCFC; - para->getParD(level)->intCFBulk.ICellCFC = para->getParD(level)->intCFBorder.ICellCFC + para->getParD(level)->intCFBorder.kCF; + para->getParD(level)->intCFBulk.ICellCFC = + para->getParD(level)->intCFBorder.ICellCFC + para->getParD(level)->intCFBorder.kCF; para->getParD(level)->intCFBorder.ICellCFF = para->getParD(level)->intCF.ICellCFF; - para->getParD(level)->intCFBulk.ICellCFF = para->getParD(level)->intCFBorder.ICellCFF + para->getParD(level)->intCFBorder.kCF; - para->getParD(level)->offCFBulk.xOffCF = para->getParD(level)->offCF.xOffCF + para->getParD(level)->intCFBorder.kCF; - para->getParD(level)->offCFBulk.yOffCF = para->getParD(level)->offCF.yOffCF + para->getParD(level)->intCFBorder.kCF; - para->getParD(level)->offCFBulk.zOffCF = para->getParD(level)->offCF.zOffCF + para->getParD(level)->intCFBorder.kCF; + para->getParD(level)->intCFBulk.ICellCFF = + para->getParD(level)->intCFBorder.ICellCFF + para->getParD(level)->intCFBorder.kCF; + para->getParD(level)->offCFBulk.xOffCF = para->getParD(level)->offCF.xOffCF + para->getParD(level)->intCFBorder.kCF; + para->getParD(level)->offCFBulk.yOffCF = para->getParD(level)->offCF.yOffCF + para->getParD(level)->intCFBorder.kCF; + para->getParD(level)->offCFBulk.zOffCF = para->getParD(level)->offCF.zOffCF + para->getParD(level)->intCFBorder.kCF; } -void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level) -{ +void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level) +{ // This function reorders the arrays of CFC/CFF indices and sets the pointers and sizes of the new subarrays: - // The coarse cells for interpolation from coarse to fine (iCellCFC) are divided into two subgroups: border and bulk. - // The fine cells (iCellCFF) are reordered accordingly. The offset cells (xOffCF, yOffCF, zOffCF) must be reordered in the same way. - + // The coarse cells for interpolation from coarse to fine (iCellCFC) are divided into two subgroups: border and + // bulk. The fine cells (iCellCFF) are reordered accordingly. The offset cells (xOffCF, yOffCF, zOffCF) must be + // reordered in the same way. + // create some local variables for better readability - uint *iCellCfcAll = para->getParH(level)->intCF.ICellCFC; - uint *iCellCffAll = para->getParH(level)->intCF.ICellCFF; - uint *neighborX_SP = this->para->getParH(level)->neighborX_SP; - uint *neighborY_SP = this->para->getParH(level)->neighborY_SP; - uint *neighborZ_SP = this->para->getParH(level)->neighborZ_SP; - auto grid = this->builder->getGrid((uint)level); + uint *iCellCfcAll = para->getParH(level)->intCF.ICellCFC; + uint *iCellCffAll = para->getParH(level)->intCF.ICellCFF; + uint *neighborX_SP = this->para->getParH(level)->neighborX_SP; + uint *neighborY_SP = this->para->getParH(level)->neighborY_SP; + uint *neighborZ_SP = this->para->getParH(level)->neighborZ_SP; + auto grid = this->builder->getGrid((uint)level); std::vector<uint> iCellCfcBorderVector; std::vector<uint> iCellCfcBulkVector; @@ -535,7 +591,8 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level grid->isSparseIndexInFluidNodeIndicesBorder(neighborY_SP[neighborX_SP[sparseIndexOfICellBSW]]) || grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ_SP[neighborX_SP[sparseIndexOfICellBSW]]) || grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ_SP[neighborY_SP[sparseIndexOfICellBSW]]) || - grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ_SP[neighborY_SP[neighborX_SP[sparseIndexOfICellBSW]]])) { + grid->isSparseIndexInFluidNodeIndicesBorder( + neighborZ_SP[neighborY_SP[neighborX_SP[sparseIndexOfICellBSW]]])) { iCellCfcBorderVector.push_back(iCellCfcAll[i]); iCellCffBorderVector.push_back(iCellCffAll[i]); @@ -556,11 +613,13 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level para->getParH(level)->intCFBorder.ICellCFF = para->getParH(level)->intCF.ICellCFF; para->getParH(level)->intCFBorder.kCF = (uint)iCellCfcBorderVector.size(); para->getParH(level)->intCFBulk.kCF = (uint)iCellCfcBulkVector.size(); - para->getParH(level)->intCFBulk.ICellCFC = para->getParH(level)->intCF.ICellCFC + para->getParH(level)->intCFBorder.kCF; - para->getParH(level)->intCFBulk.ICellCFF = para->getParH(level)->intCF.ICellCFF + para->getParH(level)->intCFBorder.kCF; - para->getParH(level)->offCFBulk.xOffCF = para->getParH(level)->offCF.xOffCF + para->getParH(level)->intCFBorder.kCF; - para->getParH(level)->offCFBulk.yOffCF = para->getParH(level)->offCF.yOffCF + para->getParH(level)->intCFBorder.kCF; - para->getParH(level)->offCFBulk.zOffCF = para->getParH(level)->offCF.zOffCF + para->getParH(level)->intCFBorder.kCF; + para->getParH(level)->intCFBulk.ICellCFC = + para->getParH(level)->intCF.ICellCFC + para->getParH(level)->intCFBorder.kCF; + para->getParH(level)->intCFBulk.ICellCFF = + para->getParH(level)->intCF.ICellCFF + para->getParH(level)->intCFBorder.kCF; + para->getParH(level)->offCFBulk.xOffCF = para->getParH(level)->offCF.xOffCF + para->getParH(level)->intCFBorder.kCF; + para->getParH(level)->offCFBulk.yOffCF = para->getParH(level)->offCF.yOffCF + para->getParH(level)->intCFBorder.kCF; + para->getParH(level)->offCFBulk.zOffCF = para->getParH(level)->offCF.zOffCF + para->getParH(level)->intCFBorder.kCF; // copy the created vectors to the memory addresses of the old arrays for (uint i = 0; i < (uint)iCellCfcBorderVector.size(); i++) { @@ -571,10 +630,10 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level para->getParH(level)->offCF.zOffCF[i] = zOffCFBorderVector[i]; } for (uint i = 0; i < (uint)iCellCfcBulkVector.size(); i++) { - para->getParH(level)->intCFBulk.ICellCFC[i] = iCellCfcBulkVector[i]; - para->getParH(level)->intCFBulk.ICellCFF[i] = iCellCffBulkVector[i]; - para->getParH(level)->offCFBulk.xOffCF[i] = xOffCFBulkVector[i]; - para->getParH(level)->offCFBulk.yOffCF[i] = yOffCFBulkVector[i]; - para->getParH(level)->offCFBulk.zOffCF[i] = zOffCFBulkVector[i]; + para->getParH(level)->intCFBulk.ICellCFC[i] = iCellCfcBulkVector[i]; + para->getParH(level)->intCFBulk.ICellCFF[i] = iCellCffBulkVector[i]; + para->getParH(level)->offCFBulk.xOffCF[i] = xOffCFBulkVector[i]; + para->getParH(level)->offCFBulk.yOffCF[i] = yOffCFBulkVector[i]; + para->getParH(level)->offCFBulk.zOffCF[i] = zOffCFBulkVector[i]; } } diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h index a8ac6ce93c9f9f6955ade3b95a861f0771729f5d..c1430232b2e4c9380886a47c819f75abde9e4757 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h @@ -40,18 +40,18 @@ public: private: // communication after coarse to fine - void copyProcessNeighborToCommAfterFtoCX(const uint &level, int j); - void copyProcessNeighborToCommAfterFtoCY(const uint &level, int j); - void copyProcessNeighborToCommAfterFtoCZ(const uint &level, int j); + void copyProcessNeighborToCommAfterFtoCX(const uint &level, int indexOfProcessNeighbor); + void copyProcessNeighborToCommAfterFtoCY(const uint &level, int indexOfProcessNeighbor); + void copyProcessNeighborToCommAfterFtoCZ(const uint &level, int indexOfProcessNeighbor); - void reorderSendIndicesForCommAfterFtoCX(int direction, int level, int j, + void reorderSendIndicesForCommAfterFtoCX(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); - void reorderSendIndicesForCommAfterFtoCY(int direction, int level, int j, + void reorderSendIndicesForCommAfterFtoCY(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); - void reorderSendIndicesForCommAfterFtoCZ(int direction, int level, int j, + void reorderSendIndicesForCommAfterFtoCZ(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); void reorderSendIndicesForCommAfterFtoC(int *sendIndices, int &numberOfSendNeighborsAfterFtoC, int direction, - int level, int j, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); + int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); bool isSparseIndexInICellFCC(uint sizeOfICellFCC, int sparseIndexSend, int level); void aggregateNodesInICellCFC(int level, std::vector<uint> &nodesCFC); @@ -65,20 +65,20 @@ private: std::vector<int> &sendOrReceiveIndicesAfterFtoC, std::vector<int> &sendOrIndicesOther); - void reorderRecvIndicesForCommAfterFtoCX(int direction, int level, int j, + void reorderRecvIndicesForCommAfterFtoCX(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); - void reorderRecvIndicesForCommAfterFtoCY(int direction, int level, int j, + void reorderRecvIndicesForCommAfterFtoCY(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); - void reorderRecvIndicesForCommAfterFtoCZ(int direction, int level, int j, + void reorderRecvIndicesForCommAfterFtoCZ(int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); void reorderRecvIndicesForCommAfterFtoC(int *recvIndices, int &numberOfRecvNeighborsAfterFtoC, int direction, - int level, int j, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); + int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); // split interpolation cells void getGridInterfaceIndicesBorderBulkCF(int level); void getGridInterfaceIndicesBorderBulkFC(int level); - + friend class IndexRearrangementForStreamsTest; }; #endif diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp index ca2481ff99502b7b63faecad53e098af56d39693..c7c01026d07b81811a815aeb9f0656c3a2cf2412 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -2674,7 +2674,7 @@ bool Parameter::findIndexInSendNodesYZ(int level, int index, int &indexOfProcess return false; } -void Parameter::initNumberOfProcessNeighborsAfterFtoCX(int level) +void Parameter::initProcessNeighborsAfterFtoCX(int level) { this->getParH(level)->sendProcessNeighborsAfterFtoCX.resize( this->getParH(level)->sendProcessNeighborX.size()); @@ -2686,7 +2686,7 @@ void Parameter::initNumberOfProcessNeighborsAfterFtoCX(int level) this->getParH(level)->recvProcessNeighborsAfterFtoCX.size()); } -void Parameter::initNumberOfProcessNeighborsAfterFtoCY(int level) +void Parameter::initProcessNeighborsAfterFtoCY(int level) { this->getParH(level)->sendProcessNeighborsAfterFtoCY.resize( this->getParH(level)->sendProcessNeighborY.size()); @@ -2698,7 +2698,7 @@ void Parameter::initNumberOfProcessNeighborsAfterFtoCY(int level) this->getParH(level)->recvProcessNeighborsAfterFtoCY.size()); } -void Parameter::initNumberOfProcessNeighborsAfterFtoCZ(int level) +void Parameter::initProcessNeighborsAfterFtoCZ(int level) { this->getParH(level)->sendProcessNeighborsAfterFtoCZ.resize( this->getParH(level)->sendProcessNeighborZ.size()); diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index d351309b408ca29a350ff657959ef3f2ff047b57..67e5f44f19ba8f502d5af59750860a59978a5a87 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -900,9 +900,9 @@ public: std::unique_ptr<CudaStreamManager> &getStreamManager(); bool getKernelNeedsFluidNodeIndicesToRun(); - void initNumberOfProcessNeighborsAfterFtoCX(int level); - void initNumberOfProcessNeighborsAfterFtoCY(int level); - void initNumberOfProcessNeighborsAfterFtoCZ(int level); + void initProcessNeighborsAfterFtoCX(int level); + void initProcessNeighborsAfterFtoCY(int level); + void initProcessNeighborsAfterFtoCZ(int level); void findEdgeNodesCommMultiGPU(); bool useReducedCommunicationAfterFtoC{ true };