From 45c315466e4952a73c0c2228bea1cae074ae167c Mon Sep 17 00:00:00 2001 From: Anna Wellmann <a.wellmann@tu-bs.de> Date: Tue, 31 May 2022 11:44:42 +0000 Subject: [PATCH] Add doxygen documentation to IndexRearrangementForStreams --- .../IndexRearrangementForStreams.cpp | 21 +-------- .../IndexRearrangementForStreams.h | 47 +++++++++++++++++-- .../CumulantK17CompChimStreamDevice.cu | 4 +- .../VirtualFluids_GPU/Parameter/Parameter.h | 4 +- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp index 7eb844583..e830b21c1 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp @@ -468,11 +468,6 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( void IndexRearrangementForStreams::splitFineToCoarseIntoBorderAndBulk(const uint &level) { - // For communication hiding, the interpolation cells from the fine to the coarse 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->getGridInterfaceIndicesBorderBulkFC(level); para->getParD(level)->intFCBorder.kFC = para->getParH(level)->intFCBorder.kFC; @@ -487,10 +482,6 @@ 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. - // create some local variables for better readability uint *iCellFccAll = para->getParH(level)->intFC.ICellFCC; uint *iCellFcfAll = para->getParH(level)->intFC.ICellFCF; @@ -520,6 +511,7 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkFC(int level para->getParH(level)->intFCBulk.ICellFCF = iCellFcfAll + para->getParH(level)->intFCBorder.kFC; // copy the created vectors to the memory addresses of the old arrays + // this is inefficient :( for (uint i = 0; i < (uint)iCellFccBorderVector.size(); i++) { iCellFccAll[i] = iCellFccBorderVector[i]; iCellFcfAll[i] = iCellFcfBorderVector[i]; @@ -532,11 +524,6 @@ 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: - // - 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; @@ -554,11 +541,6 @@ void IndexRearrangementForStreams::splitCoarseToFineIntoBorderAndBulk(const uint 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. - // create some local variables for better readability uint *iCellCfcAll = para->getParH(level)->intCF.ICellCFC; uint *iCellCffAll = para->getParH(level)->intCF.ICellCFF; @@ -621,6 +603,7 @@ void IndexRearrangementForStreams::getGridInterfaceIndicesBorderBulkCF(int level 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 + // this is inefficient :( for (uint i = 0; i < (uint)iCellCfcBorderVector.size(); i++) { para->getParH(level)->intCFBorder.ICellCFC[i] = iCellCfcBorderVector[i]; para->getParH(level)->intCFBorder.ICellCFF[i] = iCellCffBorderVector[i]; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h index c1430232b..4b55ff587 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h @@ -1,3 +1,9 @@ +//! \file IndexRearrangementForStreams.h +//! \ingroup GPU +//! \author Anna Wellmann +//! \ref master thesis of Anna Wellmann + + #ifndef IndexRearrangementForStreams_H #define IndexRearrangementForStreams_H @@ -26,20 +32,45 @@ private: std::shared_ptr<Parameter> para; public: + //! \brief construct IndexRearrangementForStreams object IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder); + ////////////////////////////////////////////////////////////////////////// // communication after coarse to fine + ////////////////////////////////////////////////////////////////////////// void initCommunicationArraysForCommAfterFinetoCoarseX(const uint &level, int j, int direction); void initCommunicationArraysForCommAfterFinetoCoarseY(const uint &level, int j, int direction); void initCommunicationArraysForCommAfterFinetoCoarseZ(const uint &level, int j, int direction); +public: + ////////////////////////////////////////////////////////////////////////// // split interpolation cells + ////////////////////////////////////////////////////////////////////////// + + //! \brief split the interpolation cells from coarse to fine into border an bulk + //! \details 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" + //! \ref see master thesis of Anna Wellmann (p. 62-68) void splitCoarseToFineIntoBorderAndBulk(const uint &level); + + //! \brief split the interpolation cells from fine to coarse into border an bulk + //! \details For communication hiding, the interpolation cells from the fine to the coarse 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" + //! + //! \ref see master thesis of Anna Wellmann (p. 62-68) void splitFineToCoarseIntoBorderAndBulk(const uint &level); private: + ////////////////////////////////////////////////////////////////////////// // communication after coarse to fine + ////////////////////////////////////////////////////////////////////////// void copyProcessNeighborToCommAfterFtoCX(const uint &level, int indexOfProcessNeighbor); void copyProcessNeighborToCommAfterFtoCY(const uint &level, int indexOfProcessNeighbor); void copyProcessNeighborToCommAfterFtoCZ(const uint &level, int indexOfProcessNeighbor); @@ -73,12 +104,22 @@ private: std::vector<uint> &sendIndicesForCommAfterFtoCPositions); void reorderRecvIndicesForCommAfterFtoC(int *recvIndices, int &numberOfRecvNeighborsAfterFtoC, int direction, int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions); - + + private: + ////////////////////////////////////////////////////////////////////////// // split interpolation cells + ////////////////////////////////////////////////////////////////////////// + + //! \brief This function reorders the arrays of CFC/CFF indices and sets the pointers and sizes of the new subarrays: + //! \details 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. void getGridInterfaceIndicesBorderBulkCF(int level); - void getGridInterfaceIndicesBorderBulkFC(int level); - friend class IndexRearrangementForStreamsTest; + //! \brief This function reorders the arrays of FCC/FCF indices and return pointers and sizes of the new subarrays: + //! \details 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. + void getGridInterfaceIndicesBorderBulkFC(int level); }; #endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu index da37bb1e2..f57fd9dd9 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu @@ -26,9 +26,9 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file Cumulant27chim.cu +//! \file Cumulant27chimStream.cu //! \ingroup GPU -//! \author Martin Schoenherr +//! \author Martin Schoenherr, Anna Wellmann //======================================================================================= /* Device code */ #include "LBM/LB.h" diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index db648344f..940b2493f 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -899,8 +899,8 @@ private: std::unique_ptr<CudaStreamManager> cudaStreamManager; public: - //! sets whether streams and thus communication hiding should be used - /*! This function is only useful for simulations on multiple GPUs. If there is only one MPI process, the passed value is automatically overwritten with false. */ + //! \brief sets whether streams and thus communication hiding should be used + //! \details This function is only useful for simulations on multiple GPUs. If there is only one MPI process, the passed value is automatically overwritten with false. void setUseStreams(bool useStreams); bool getUseStreams(); std::unique_ptr<CudaStreamManager> &getStreamManager(); -- GitLab