Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / ewald / pme_pp_comm_gpu_impl.h
index be408acbf4ac6a9d2e5922bf7c455298c83ce370..5565bea3705d5284499aca13a51abad17709209b 100644 (file)
@@ -55,83 +55,86 @@ namespace gmx
 class PmePpCommGpu::Impl
 {
 
-    public:
-        /*! \brief Creates PME-PP GPU communication object.
-         * \param[in] comm            Communicator used for simulation
-         * \param[in] pmeRank         Rank of PME task
-         */
-        Impl(MPI_Comm comm, int pmeRank);
-        ~Impl();
+public:
+    /*! \brief Creates PME-PP GPU communication object.
+     * \param[in] comm            Communicator used for simulation
+     * \param[in] pmeRank         Rank of PME task
+     */
+    Impl(MPI_Comm comm, int pmeRank);
+    ~Impl();
 
-        /*! \brief Perform steps required when buffer size changes
-         * \param[in]  size   Number of elements in buffer
-         */
-        void reinit(int size);
+    /*! \brief Perform steps required when buffer size changes
+     * \param[in]  size   Number of elements in buffer
+     */
+    void reinit(int size);
 
-        /*! \brief Pull force buffer directly from GPU memory on PME
-         * rank to either GPU or CPU memory on PP task using CUDA
-         * Memory copy.
-         *
-         * recvPtr should be in GPU or CPU memory if recvPmeForceToGpu
-         * is true or false, respectively. If receiving to GPU, this
-         * method should be called before the local GPU buffer
-         * operations. If receiving to CPU it should be called
-         * before forces are reduced with the other force
-         * contributions on the CPU. It will automatically wait for
-         * remote PME force data to be ready.
-         *
-         * \param[out] recvPtr CPU buffer to receive PME force data
-         * \param[in] recvSize Number of elements to receive
-         * \param[in] receivePmeForceToGpu Whether receive is to GPU, otherwise CPU
-         */
-        void receiveForceFromPmeCudaDirect(void *recvPtr, int recvSize, bool receivePmeForceToGpu);
+    /*! \brief Pull force buffer directly from GPU memory on PME
+     * rank to either GPU or CPU memory on PP task using CUDA
+     * Memory copy.
+     *
+     * recvPtr should be in GPU or CPU memory if recvPmeForceToGpu
+     * is true or false, respectively. If receiving to GPU, this
+     * method should be called before the local GPU buffer
+     * operations. If receiving to CPU it should be called
+     * before forces are reduced with the other force
+     * contributions on the CPU. It will automatically wait for
+     * remote PME force data to be ready.
+     *
+     * \param[out] recvPtr CPU buffer to receive PME force data
+     * \param[in] recvSize Number of elements to receive
+     * \param[in] receivePmeForceToGpu Whether receive is to GPU, otherwise CPU
+     */
+    void receiveForceFromPmeCudaDirect(void* recvPtr, int recvSize, bool receivePmeForceToGpu);
 
 
-        /*! \brief Push coordinates buffer directly to GPU memory on PME
-         * task, from either GPU or CPU memory on PP task using CUDA
-         * Memory copy. sendPtr should be in GPU or CPU memory if
-         * sendPmeCoordinatesFromGpu is true or false respectively. If
-         * sending from GPU, this method should be called after the
-         * local GPU coordinate buffer operations. The remote PME task will
-         * automatically wait for data to be copied before commencing PME force calculations.
-         * \param[in] sendPtr Buffer with coordinate data
-         * \param[in] sendSize Number of elements to send
-         * \param[in] sendPmeCoordinatesFromGpu Whether send is from GPU, otherwise CPU
-         * \param[in] coordinatesReadyOnDeviceEvent Event recorded when coordinates are available on device
-         */
-        void sendCoordinatesToPmeCudaDirect(void *sendPtr, int sendSize, bool sendPmeCoordinatesFromGpu, GpuEventSynchronizer* coordinatesReadyOnDeviceEvent);
+    /*! \brief Push coordinates buffer directly to GPU memory on PME
+     * task, from either GPU or CPU memory on PP task using CUDA
+     * Memory copy. sendPtr should be in GPU or CPU memory if
+     * sendPmeCoordinatesFromGpu is true or false respectively. If
+     * sending from GPU, this method should be called after the
+     * local GPU coordinate buffer operations. The remote PME task will
+     * automatically wait for data to be copied before commencing PME force calculations.
+     * \param[in] sendPtr Buffer with coordinate data
+     * \param[in] sendSize Number of elements to send
+     * \param[in] sendPmeCoordinatesFromGpu Whether send is from GPU, otherwise CPU
+     * \param[in] coordinatesReadyOnDeviceEvent Event recorded when coordinates are available on device
+     */
+    void sendCoordinatesToPmeCudaDirect(void*                 sendPtr,
+                                        int                   sendSize,
+                                        bool                  sendPmeCoordinatesFromGpu,
+                                        GpuEventSynchronizer* coordinatesReadyOnDeviceEvent);
 
-        /*! \brief
-         * Return pointer to buffer used for staging PME force on GPU
-         */
-        void* getGpuForceStagingPtr();
+    /*! \brief
+     * Return pointer to buffer used for staging PME force on GPU
+     */
+    void* getGpuForceStagingPtr();
 
-        /*! \brief
-         * Return pointer to event recorded when forces are ready
-         */
-        void* getForcesReadySynchronizer();
+    /*! \brief
+     * Return pointer to event recorded when forces are ready
+     */
+    void* getForcesReadySynchronizer();
 
-    private:
-        //! CUDA stream used for the communication operations in this class
-        cudaStream_t            pmePpCommStream_ = nullptr;
-        //! Remote location of PME coordinate data buffer
-        void                   *remotePmeXBuffer_ = nullptr;
-        //! Remote location of PME force data buffer
-        void                   *remotePmeFBuffer_ = nullptr;
-        //! communicator for simulation
-        MPI_Comm                comm_;
-        //! Rank of PME task
-        int                     pmeRank_ = -1;
-        //! Buffer for staging PME force on GPU
-        rvec                   *d_pmeForces_ = nullptr;
-        //! number of atoms in PME force staging array
-        int                     d_pmeForcesSize_ = -1;
-        //! number of atoms allocated in recvbuf array
-        int                     d_pmeForcesSizeAlloc_ = -1;
-        //! Event recorded when PME forces are ready on PME task
-        GpuEventSynchronizer    forcesReadySynchronizer_;
-        //! Event recorded when coordinates have been transferred to PME task
-        GpuEventSynchronizer    pmeCoordinatesSynchronizer_;
+private:
+    //! CUDA stream used for the communication operations in this class
+    cudaStream_t pmePpCommStream_ = nullptr;
+    //! Remote location of PME coordinate data buffer
+    void* remotePmeXBuffer_ = nullptr;
+    //! Remote location of PME force data buffer
+    void* remotePmeFBuffer_ = nullptr;
+    //! communicator for simulation
+    MPI_Comm comm_;
+    //! Rank of PME task
+    int pmeRank_ = -1;
+    //! Buffer for staging PME force on GPU
+    rvec* d_pmeForces_ = nullptr;
+    //! number of atoms in PME force staging array
+    int d_pmeForcesSize_ = -1;
+    //! number of atoms allocated in recvbuf array
+    int d_pmeForcesSizeAlloc_ = -1;
+    //! Event recorded when PME forces are ready on PME task
+    GpuEventSynchronizer forcesReadySynchronizer_;
+    //! Event recorded when coordinates have been transferred to PME task
+    GpuEventSynchronizer pmeCoordinatesSynchronizer_;
 };
 
 } // namespace gmx