DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
MPICommunicatorP2P.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18/*
19 * @author Sambit Das
20 */
21
22#ifndef dftfeMPICommunicatorP2P_h
23#define dftfeMPICommunicatorP2P_h
24
25#include <MemorySpaceType.h>
26#include <MPIPatternP2P.h>
27#include <TypeConfig.h>
28#include <MemoryStorage.h>
29#include <DataTypeOverloads.h>
30#include <dftfeDataTypes.h>
31#ifdef DFTFE_WITH_DEVICE
32# include <DeviceTypeConfig.h>
33# if defined(DFTFE_WITH_CUDA_NCCL)
34# include <nccl.h>
35# elif defined(DFTFE_WITH_HIP_RCCL)
36# include <rccl.h>
37# endif
38#endif
39
40
41namespace dftfe
42{
43 namespace utils
44 {
45 namespace mpi
46 {
53
59
60
61 template <typename ValueType, MemorySpace memorySpace>
63 {
64 public:
66 std::shared_ptr<const MPIPatternP2P<memorySpace>> mpiPatternP2P,
67 const size_type blockSize);
68
69 void
71 const size_type communicationChannel = 0);
72
73 void
76 const size_type communicationChannel = 0);
77
78
79 void
81 const size_type communicationChannel = 0);
82
83 void
85
86 void
89 const size_type communicationChannel = 0);
90
91 void
94
95 /*
96 * @Brief This function copies the value from the ghost nodes
97 * to its corresponding local node
98 */
99 void
102 const size_type communicationChannel = 0);
103
104 void
107 const size_type communicationChannel = 0);
108
109 void
112
113 std::shared_ptr<const MPIPatternP2P<memorySpace>>
115
116 int
118
119 void
121
122 private:
123 std::shared_ptr<const MPIPatternP2P<memorySpace>> d_mpiPatternP2P;
124
126
128
130
132
134
136
138
140
143 memorySpace>
145
148 memorySpace>
150
151#ifdef DFTFE_WITH_DEVICE
152 std::shared_ptr<MemoryStorage<ValueType, MemorySpace::HOST_PINNED>>
153 d_ghostDataCopyHostPinnedPtr;
154
155 std::shared_ptr<MemoryStorage<ValueType, MemorySpace::HOST_PINNED>>
156 d_sendRecvBufferHostPinnedPtr;
157
158 std::shared_ptr<MemoryStorage<
161 d_ghostDataCopySinglePrecHostPinnedPtr;
162
163 std::shared_ptr<MemoryStorage<
166 d_sendRecvBufferSinglePrecHostPinnedPtr;
167#endif // DFTFE_WITH_DEVICE
168
169 std::vector<MPI_Request> d_requestsUpdateGhostValues;
170 std::vector<MPI_Request> d_requestsAccumulateAddLocallyOwned;
173#ifdef DFTFE_WITH_DEVICE
174 dftfe::utils::deviceStream_t d_deviceCommStream;
175#endif
178 };
179
180 } // namespace mpi
181 } // namespace utils
182} // namespace dftfe
183#endif // dftfeMPICommunicatorP2P_h
Definition MemoryStorage.h:33
void accumulateInsertLocallyOwnedBegin(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > d_ghostDataCopySinglePrec
Definition MPICommunicatorP2P.h:149
std::shared_ptr< const MPIPatternP2P< memorySpace > > getMPIPatternP2P() const
size_type d_ghostSize
Definition MPICommunicatorP2P.h:129
void accumulateAddLocallyOwnedEnd(MemoryStorage< ValueType, memorySpace > &dataArray)
MemoryStorage< ValueType, memorySpace > d_sendRecvBuffer
Definition MPICommunicatorP2P.h:131
void setCommunicationPrecision(communicationPrecision precision)
std::vector< MPI_Request > d_requestsAccumulateAddLocallyOwned
Definition MPICommunicatorP2P.h:170
MemoryStorage< double, memorySpace > d_tempDoubleImagArrayForAtomics
Definition MPICommunicatorP2P.h:135
void accumulateInsertLocallyOwned(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
MPI_Comm d_mpiCommunicator
Definition MPICommunicatorP2P.h:172
MemoryStorage< float, memorySpace > d_tempFloatRealArrayForAtomics
Definition MPICommunicatorP2P.h:137
std::shared_ptr< const MPIPatternP2P< memorySpace > > d_mpiPatternP2P
Definition MPICommunicatorP2P.h:123
std::vector< MPI_Request > d_requestsUpdateGhostValues
Definition MPICommunicatorP2P.h:169
void updateGhostValuesBegin(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > d_sendRecvBufferSinglePrec
Definition MPICommunicatorP2P.h:144
MemoryStorage< double, memorySpace > d_tempDoubleRealArrayForAtomics
Definition MPICommunicatorP2P.h:133
size_type d_locallyOwnedSize
Definition MPICommunicatorP2P.h:127
communicationProtocol d_commProtocol
Definition MPICommunicatorP2P.h:176
std::vector< MPI_Request > d_requestsAccumulateInsertLocallyOwned
Definition MPICommunicatorP2P.h:171
void accumulateInsertLocallyOwnedEnd(MemoryStorage< ValueType, memorySpace > &dataArray)
size_type d_blockSize
Definition MPICommunicatorP2P.h:125
MemoryStorage< float, memorySpace > d_tempFloatImagArrayForAtomics
Definition MPICommunicatorP2P.h:139
void updateGhostValuesEnd(MemoryStorage< ValueType, memorySpace > &dataArray)
MPICommunicatorP2P(std::shared_ptr< const MPIPatternP2P< memorySpace > > mpiPatternP2P, const size_type blockSize)
void accumulateAddLocallyOwned(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
communicationPrecision d_commPrecision
Definition MPICommunicatorP2P.h:177
void accumulateAddLocallyOwnedBegin(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
void updateGhostValues(MemoryStorage< ValueType, memorySpace > &dataArray, const size_type communicationChannel=0)
A class template to store the communication pattern (i.e., which entries/nodes to receive from which ...
Definition MPIPatternP2P.h:57
Definition MPICommunicatorP2P.h:46
communicationPrecision
Definition MPICommunicatorP2P.h:55
@ single
Definition MPICommunicatorP2P.h:56
@ full
Definition MPICommunicatorP2P.h:57
communicationProtocol
Definition MPICommunicatorP2P.h:48
@ nccl
Definition MPICommunicatorP2P.h:51
@ mpiDevice
Definition MPICommunicatorP2P.h:50
@ mpiHost
Definition MPICommunicatorP2P.h:49
Definition Cell.h:36
cudaStream_t deviceStream_t
Definition DeviceTypeConfig.cu.h:27
@ HOST_PINNED
Definition MemorySpaceType.h:35
Definition pseudoPotentialToDftfeConverter.cc:34
unsigned int size_type
Definition TypeConfig.h:6
T type
Definition dftfeDataTypes.h:115