48
48
49
49
50
50
namespace PMacc
51
+ {
52
+ namespace exec
51
53
{
52
54
/* * configured kernel object
53
- *
55
+ *
54
56
* this objects contains the functor and the starting parameter
55
- *
57
+ *
56
58
* @tparam T_Kernel pmacc Kernel object
57
- * @tparam T_VectorGrid type which defines the grid extents (type must be cast able to CUDA dim3)
58
- * @tparam T_VectorBlock type which defines the block extents (type must be cast able to CUDA dim3)
59
+ * @tparam T_VectorGrid type which defines the grid extents (type must be castable to CUDA dim3)
60
+ * @tparam T_VectorBlock type which defines the block extents (type must be castable to CUDA dim3)
59
61
*/
60
62
template <
61
63
typename T_Kernel,
62
64
typename T_VectorGrid,
63
65
typename T_VectorBlock
64
66
>
65
67
struct KernelStarter ;
66
-
68
+
67
69
/* * wrapper for the user kernel functor
68
- *
69
- * contains debug information like filename and lien of the kernel call
70
+ *
71
+ * contains debug information like filename and line of the kernel call
70
72
*/
71
73
template < typename T_KernelFunctor >
72
74
struct Kernel
@@ -79,11 +81,11 @@ namespace PMacc
79
81
size_t const m_line;
80
82
81
83
/* *
82
- *
84
+ *
83
85
* @param gridExtent grid extent configuration for the kernel
84
- * @param blockExtent block extent configuration for the kernel
86
+ * @param blockExtent block extent configuration for the kernel
85
87
* @param sharedMemByte dynamic shared memory used by the kernel (in byte )
86
- * @return
88
+ * @return
87
89
*/
88
90
HINLINE Kernel (
89
91
T_KernelFunctor const & kernelFunctor,
@@ -98,15 +100,15 @@ namespace PMacc
98
100
}
99
101
100
102
/* * configured kernel object
101
- *
103
+ *
102
104
* this objects contains the functor and the starting parameter
103
- *
104
- * @tparam T_VectorGrid type which defines the grid extents (type must be cast able to CUDA dim3)
105
- * @tparam T_VectorBlock type which defines the block extents (type must be cast able to CUDA dim3)
106
- *
105
+ *
106
+ * @tparam T_VectorGrid type which defines the grid extents (type must be castable to CUDA dim3)
107
+ * @tparam T_VectorBlock type which defines the block extents (type must be castable to CUDA dim3)
108
+ *
107
109
* @param gridExtent grid extent configuration for the kernel
108
- * @param blockExtent block extent configuration for the kernel
109
- * @param sharedMemByte dynamic shared memory used by the kernel (in byte )
110
+ * @param blockExtent block extent configuration for the kernel
111
+ * @param sharedMemByte dynamic shared memory used by the kernel (in byte)
110
112
*/
111
113
template <
112
114
typename T_VectorGrid,
@@ -119,15 +121,15 @@ namespace PMacc
119
121
T_VectorBlock const & blockExtent,
120
122
size_t const sharedMemByte = 0
121
123
) const
122
- -> KernelStarter<
124
+ -> KernelStarter<
123
125
Kernel,
124
126
T_VectorGrid,
125
127
T_VectorBlock
126
128
>;
127
129
};
128
130
129
131
130
- template <
132
+ template <
131
133
typename T_Kernel,
132
134
typename T_VectorGrid,
133
135
typename T_VectorBlock
@@ -140,11 +142,11 @@ namespace PMacc
140
142
T_VectorGrid const m_gridExtent;
141
143
/* * block extents for the kernel */
142
144
T_VectorBlock const m_blockExtent;
143
- /* * dynamic shared memory consumed by the kernel (in byte)*/
145
+ /* * dynamic shared memory consumed by the kernel (in byte) */
144
146
size_t const m_sharedMemByte;
145
147
146
148
/* * kernel starter object
147
- *
149
+ *
148
150
* @param kernel pmacc Kernel
149
151
*/
150
152
HINLINE KernelStarter (
@@ -162,10 +164,10 @@ namespace PMacc
162
164
}
163
165
164
166
/* * execute the kernel functor
165
- *
167
+ *
166
168
* @tparam T_Args types of the arguments
167
169
* @param args arguments for the kernel functor
168
- *
170
+ *
169
171
* @{
170
172
*/
171
173
template <
@@ -180,8 +182,8 @@ namespace PMacc
180
182
181
183
std::string const kernelName = typeid ( m_kernel.m_kernelFunctor ).name ();
182
184
std::string const kernelInfo = kernelName +
183
- std::string ( " [" ) + m_kernel.m_file + std::string ( " :" ) +
184
- std::to_string ( m_kernel.m_line ) + std::string ( " ]" );
185
+ std::string ( " [" ) + m_kernel.m_file + std::string ( " :" ) +
186
+ std::to_string ( m_kernel.m_line ) + std::string ( " ]" );
185
187
186
188
CUDA_CHECK_KERNEL_MSG (
187
189
cudaDeviceSynchronize ( ),
@@ -197,21 +199,21 @@ namespace PMacc
197
199
T_VectorGrid
198
200
>::value
199
201
> gridExtent ( m_gridExtent );
200
-
202
+
201
203
DataSpace<
202
204
traits::GetNComponents<
203
205
T_VectorBlock
204
206
>::value
205
207
> blockExtent ( m_blockExtent );
206
-
208
+
207
209
nvidia::gpuEntryFunction<<<
208
210
gridExtent,
209
211
blockExtent,
210
212
m_sharedMemByte,
211
213
taskKernel->getCudaStream ()
212
- >>>(
213
- m_kernel.m_kernelFunctor ,
214
- args ...
214
+ >>>(
215
+ m_kernel.m_kernelFunctor ,
216
+ args ...
215
217
);
216
218
CUDA_CHECK_KERNEL_MSG (
217
219
cudaGetLastError ( ),
@@ -227,26 +229,26 @@ namespace PMacc
227
229
std::string ( " Crash after kernel activation" ) + kernelInfo
228
230
);
229
231
}
230
-
232
+
231
233
template <
232
234
typename ... T_Args
233
235
>
234
236
HINLINE
235
237
void
236
238
operator ()(
237
239
T_Args const &... args
238
- )
240
+ )
239
241
{
240
242
return static_cast < const KernelStarter >(*this )( args ... );
241
243
}
242
-
244
+
243
245
/* * @} */
244
246
245
247
};
246
248
247
249
248
250
/* * creates a kernel object
249
- *
251
+ *
250
252
* @tparam T_KernelFunctor type of the kernel functor
251
253
* @param kernelFunctor instance of the functor
252
254
* @param file file name (for debug)
@@ -257,32 +259,32 @@ namespace PMacc
257
259
T_KernelFunctor const & kernelFunctor,
258
260
std::string const & file = std::string(),
259
261
size_t const line = 0
260
- ) -> PMacc:: Kernel< T_KernelFunctor >
262
+ ) -> Kernel< T_KernelFunctor >
261
263
{
262
- return PMacc:: Kernel< T_KernelFunctor >(
264
+ return Kernel< T_KernelFunctor >(
263
265
kernelFunctor,
264
266
file,
265
267
line
266
268
);
267
269
}
268
-
270
+ } // namespace exec
269
271
} // namespace PMacc
270
272
271
273
272
274
/* * create a kernel object out of a functor instance
273
- *
275
+ *
274
276
* this macro add the current filename and line number to the kernel object
275
- *
277
+ *
276
278
* @param ... instance of kernel functor
277
279
*/
278
- #define PMACC_KERNEL ( ... ) PMacc::kernel( __VA_ARGS__, __FILE__, static_cast < size_t >( __LINE__ ) )
280
+ #define PMACC_KERNEL ( ... ) PMacc::exec:: kernel( __VA_ARGS__, __FILE__, static_cast < size_t >( __LINE__ ) )
279
281
280
282
/* * create a kernel object out of a functor type name
281
- *
283
+ *
282
284
* this macro add the current filename and line number to the kernel object
283
- *
284
- * @param ... type of the kernel functor
285
- */
286
- #define PMACC_TYPEKERNEL ( ... ) PMacc::kernel( __VA_ARGS__{}, __FILE__, static_cast < size_t >( __LINE__ ) )
285
+ *
286
+ * @param ... type of the kernel functor
287
+ */
288
+ #define PMACC_TYPEKERNEL ( ... ) PMacc::exec:: kernel( __VA_ARGS__{}, __FILE__, static_cast < size_t >( __LINE__ ) )
287
289
288
290
#include " eventSystem/events/kernelEvents.tpp"
0 commit comments