DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
MPICommunicatorP2PKernels.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 dftfeMPICommunicatorP2PKernels_h
23#define dftfeMPICommunicatorP2PKernels_h
24
25#include <MemorySpaceType.h>
26#include <MemoryStorage.h>
27#include <TypeConfig.h>
28#include <DataTypeOverloads.h>
29#ifdef DFTFE_WITH_DEVICE
30# include <DeviceTypeConfig.h>
31#endif
32namespace dftfe
33{
34 namespace utils
35 {
36 template <typename ValueType, dftfe::utils::MemorySpace memorySpace>
38 {
39 public:
41
42 /**
43 * @brief Function template for architecture adaptable gather kernel to send buffer
44 * @tparam ValueType the type of the number
45 * @tparam memorySpace
46 * @param[in] dataArray data array with locally owned entries
47 * @param[in] ownedLocalIndicesForTargetProcs
48 * @param[in] blockSize
49 * @param[out] sendBuffer
50 */
51 template <typename ValueTypeComm>
52 static void
55 const SizeTypeVector &ownedLocalIndicesForTargetProcs,
56 const size_type blockSize,
58
59 /**
60 * @brief Function template for architecture adaptable accumulate add kernel from recv buffer
61 * @tparam ValueType the type of the number
62 * @tparam memorySpace
63 * @param[in] recvBuffer
64 * @param[in] ownedLocalIndicesForTargetProcs
65 * @param[in] blockSize
66 * @param[out] dataArray
67 */
68 template <typename ValueTypeComm>
69 static void
72 const SizeTypeVector & ownedLocalIndicesForTargetProcs,
73 const size_type blockSize,
74 const size_type locallyOwnedSize,
75 const size_type ghostSize,
77
78 /**
79 * @brief Function template for architecture adaptable accumulate insert kernel from recv buffer
80 * @tparam ValueType the type of the number
81 * @tparam memorySpace
82 * @param[in] recvBuffer
83 * @param[in] ownedLocalIndicesForTargetProcs
84 * @param[in] blockSize
85 * @param[out] dataArray
86 */
87 template <typename ValueTypeComm>
88 static void
91 const SizeTypeVector & ownedLocalIndicesForTargetProcs,
92 const size_type blockSize,
93 const size_type locallyOwnedSize,
94 const size_type ghostSize,
96
97 /**
98 * @brief Function template for copying type1 to type2
99 * @param[in] blockSize
100 * @param[in] type1Array
101 * @param[out] type2Array
102 */
103 template <typename ValueType1, typename ValueType2>
104 static void
106 const ValueType1 *type1Array,
107 ValueType2 * type2Array);
108 };
109
110#ifdef DFTFE_WITH_DEVICE
111 template <typename ValueType>
112 class MPICommunicatorP2PKernels<ValueType,
114 {
115 public:
116 template <typename ValueTypeComm>
117 static void
120 &dataArray,
122 & ownedLocalIndicesForTargetProcs,
123 const size_type blockSize,
125 & sendBuffer,
126 dftfe::utils::deviceStream_t deviceCommStream);
127
128 template <typename ValueTypeComm>
129 static void
132 &recvBuffer,
134 & ownedLocalIndicesForTargetProcs,
135 const size_type blockSize,
136 const size_type locallyOwnedSize,
137 const size_type ghostSize,
139 dftfe::utils::deviceStream_t deviceCommStream);
140
141 /**
142 * @brief Function template for architecture adaptable accumulate insert kernel from recv buffer
143 * @tparam ValueType the type of the number
144 * @tparam memorySpace
145 * @param[in] recvBuffer
146 * @param[in] ownedLocalIndicesForTargetProcs
147 * @param[in] blockSize
148 * @param[out] dataArray
149 */
150 template <typename ValueTypeComm>
151 static void
154 &recvBuffer,
156 & ownedLocalIndicesForTargetProcs,
157 const size_type blockSize,
158 const size_type locallyOwnedSize,
159 const size_type ghostSize,
161 dftfe::utils::deviceStream_t deviceCommStream);
162
163 /**
164 * @brief Function template for copying type1 to type2
165 * @param[in] blockSize
166 * @param[in] type1Array
167 * @param[out] type2Array
168 */
169 template <typename ValueType1, typename ValueType2>
170 static void
172 const size_type blockSize,
173 const ValueType1 * type1Array,
174 ValueType2 * type2Array,
175 dftfe::utils::deviceStream_t deviceCommStream);
176 };
177#endif
178 } // namespace utils
179} // namespace dftfe
180
181
182#endif
Definition MPICommunicatorP2PKernels.h:38
static void copyValueType1ArrToValueType2Arr(const size_type blockSize, const ValueType1 *type1Array, ValueType2 *type2Array)
Function template for copying type1 to type2.
static void accumAddLocallyOwnedContrRecvBufferFromTargetProcs(const MemoryStorage< ValueTypeComm, memorySpace > &recvBuffer, const SizeTypeVector &ownedLocalIndicesForTargetProcs, const size_type blockSize, const size_type locallyOwnedSize, const size_type ghostSize, MemoryStorage< ValueType, memorySpace > &dataArray)
Function template for architecture adaptable accumulate add kernel from recv buffer.
utils::MemoryStorage< size_type, memorySpace > SizeTypeVector
Definition MPICommunicatorP2PKernels.h:40
static void accumInsertLocallyOwnedContrRecvBufferFromTargetProcs(const MemoryStorage< ValueTypeComm, memorySpace > &recvBuffer, const SizeTypeVector &ownedLocalIndicesForTargetProcs, const size_type blockSize, const size_type locallyOwnedSize, const size_type ghostSize, MemoryStorage< ValueType, memorySpace > &dataArray)
Function template for architecture adaptable accumulate insert kernel from recv buffer.
static void gatherLocallyOwnedEntriesSendBufferToTargetProcs(const MemoryStorage< ValueType, memorySpace > &dataArray, const SizeTypeVector &ownedLocalIndicesForTargetProcs, const size_type blockSize, MemoryStorage< ValueTypeComm, memorySpace > &sendBuffer)
Function template for architecture adaptable gather kernel to send buffer.
Definition MemoryStorage.h:33
Definition Cell.h:36
cudaStream_t deviceStream_t
Definition DeviceTypeConfig.cu.h:27
@ DEVICE
Definition MemorySpaceType.h:36
Definition pseudoPotentialToDftfeConverter.cc:34
unsigned int size_type
Definition TypeConfig.h:6