diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp index 29e5cb4890b9cb24cfbf2c15d98f65eb00cab1c5..5c4ee37b4b59fd37c9f1ff02a378c575806b8d31 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp @@ -111,11 +111,8 @@ void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMe void prepareExchangeCollDataYGPU27(Parameter *para, int level, int streamIndex, bool useReducedCommunicationAfterFtoC) { cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); - std::vector<ProcessNeighbor27> *sendProcessNeighbor; - if (useReducedCommunicationAfterFtoC) - sendProcessNeighbor = ¶->getParD(level)->sendProcessNeighborsAfterFtoCY; - else - sendProcessNeighbor = ¶->getParD(level)->sendProcessNeighborY; + std::vector<ProcessNeighbor27> *sendProcessNeighbor = + getSendProcessNeighborY(useReducedCommunicationAfterFtoC, para, level); for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) GetSendFsPostDev27(para->getParD(level)->d0SP.f[0], @@ -132,9 +129,14 @@ void prepareExchangeCollDataYGPU27(Parameter *para, int level, int streamIndex, } void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMemoryManager *cudaManager, int level, - int streamIndex) + int streamIndex, bool useReducedCommunicationAfterFtoC) { cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + std::vector<ProcessNeighbor27> *sendProcessNeighbor = + getSendProcessNeighborY(useReducedCommunicationAfterFtoC, para, level); + std::vector<ProcessNeighbor27> *recvProcessNeighbor = + getRecvProcessNeighborY(useReducedCommunicationAfterFtoC, para, level); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) @@ -218,6 +220,24 @@ void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMe } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } + +std::vector<ProcessNeighbor27> *getSendProcessNeighborY(bool useReducedCommunicationAfterFtoC, Parameter *para, + int level) +{ + if (useReducedCommunicationAfterFtoC) + return ¶->getParD(level)->sendProcessNeighborsAfterFtoCY; + else + return ¶->getParD(level)->sendProcessNeighborY; +} + +std::vector<ProcessNeighbor27> *getRecvProcessNeighborY(bool useReducedCommunicationAfterFtoC, Parameter *para, + int level) +{ + if (useReducedCommunicationAfterFtoC) + return ¶->getParD(level)->recvProcessNeighborsAfterFtoCY; + else + return ¶->getParD(level)->recvProcessNeighborY; +} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h index 6b537242ceddc6e33ac4f3fe65e466411a1b46f1..887e4d2b382b74392625a8cd31dab50d76c1c8c0 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h @@ -17,9 +17,11 @@ extern "C" void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator extern "C" void prepareExchangeCollDataXGPU27(Parameter *para, int level, int streamIndex); extern "C" void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMemoryManager *cudaManager, int level, int streamIndex); -extern "C" void prepareExchangeCollDataYGPU27(Parameter *para, int level, int streamIndex, bool useReducedCommunicationAfterFtoC = false); +extern "C" void prepareExchangeCollDataYGPU27(Parameter *para, int level, int streamIndex, + bool useReducedCommunicationAfterFtoC = false); +std::vector<ProcessNeighbor27> *getSendProcessNeighborY(bool useReducedCommunicationAfterFtoC, Parameter *para, int level); extern "C" void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMemoryManager *cudaManager, - int level, int streamIndex); + int level, int streamIndex, bool useReducedCommunicationAfterFtoC = false); extern "C" void prepareExchangeCollDataZGPU27(Parameter *para, int level, int streamIndex); extern "C" void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator *comm, CudaMemoryManager *cudaManager, int level, int streamIndex);