1#include <kernel/base_header.hpp>
2#include <kernel/util/cuda_util.hpp>
3#include <kernel/voxel_assembly/burgers_velo_material_assembler.hpp>
4#include <kernel/lafem/matrix_gather_scatter_helper.hpp>
5#include <kernel/lafem/vector_gather_scatter_helper.hpp>
6#include <kernel/voxel_assembly/helper/space_helper.hpp>
7#include <kernel/lafem/vector_mirror.hpp>
8#include <kernel/global/vector.hpp>
9#include <kernel/util/tiny_algebra.hpp>
10#include <kernel/util/cuda_math.cuh>
17 namespace VoxelAssembly
22 /**************************************************************************************************************/
24 /**************************************************************************************************************/
26 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_, typename ViscoDFunc_, bool stream_diff_, FEAT::Intern::MatrixGatherScatterPolicy pol_ = FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps>
27 __global__ void full_burgers_vm_assembler_matrix1_bcsr(DT_* __restrict__ matrix_data, const DT_* __restrict__ conv_data,
28 const IT_* __restrict__ matrix_row_ptr, const IT_* __restrict__ matrix_col_idx, Index matrix_num_rows, Index matrix_num_cols,
29 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ cub_pt,
30 const DT_* __restrict__ cub_wg, int num_cubs, DT_ alpha,
31 const IT_* __restrict__ cell_to_dof, [[maybe_unused]] Index cell_num,
32 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ nodes, [[maybe_unused]] Index node_size,
33 const int* __restrict__ coloring_map, Index coloring_size, const IT_* __restrict__ cell_to_dof_sorter,
34 const VoxelAssembly::AssemblyBurgersData<DT_> burgers_params, const VoxelAssembly::AssemblyMaterialData<DT_> material_params,
35 const ViscoFunc_ visco_func, const ViscoDFunc_ visco_d_func)
37 Index idx = threadIdx.x + blockDim.x * blockIdx.x;
38 if(idx >= coloring_size)
41 typedef Space_ SpaceType;
43 typedef IT_ IndexType;
45 const DataType& beta{burgers_params.beta};
46 const DataType& sd_delta{burgers_params.sd_delta};
47 const DataType& sd_v_norm{burgers_params.sd_v_norm};
49 const DataType tol_eps = CudaMath::cuda_get_sqrt_eps<DataType>();
50 const bool need_streamline = (CudaMath::cuda_abs(sd_delta) > DataType(0)) && (sd_v_norm > tol_eps);
51 const bool need_convection = CudaMath::cuda_abs(beta) > DataType(0);
53 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
55 constexpr int dim = SpaceHelp::dim;
58 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
59 //get number of nodes per element
60 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
63 typedef Tiny::Vector<DataType, dim> VecValueType;
64 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
65 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
66 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
69 // define local coefficients
70 Tiny::Matrix<DataType, dim, num_loc_verts> local_coeffs;
72 LocalMatrixType loc_mat;
73 LocalVectorType local_conv_dofs(DataType(0));
74 // now do work for this cell
75 Index cell = Index(coloring_map[idx]);
76 // std::cout << "Starting with cell " << cell << std::endl;
77 const IndexSetWrapper<IndexType> local_dofs_w{cell_to_dof, IndexType(num_loc_dofs)};
78 const IndexType* local_dofs = cell_to_dof + cell*num_loc_dofs;
79 const IndexType* local_dof_sorter = cell_to_dof_sorter + cell*num_loc_dofs;
81 SpaceHelp::set_coefficients(local_coeffs, local_dofs_w, nodes, cell);
82 //if we need to, gather local convection vector
83 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_conv_dofs,
84 (const VecValueType*)conv_data, IndexType(matrix_num_rows), local_dofs,DataType(1));
86 VoxelAssembly::Kernel::burgers_velo_material_mat_assembly_kernel<SpaceHelp, LocalMatrixType, LocalVectorType, dim, num_loc_verts, ViscoFunc_, ViscoDFunc_, stream_diff_>(
87 loc_mat, local_conv_dofs, local_coeffs, cub_pt, cub_wg, num_cubs, burgers_params, material_params, need_convection, tol_eps, visco_func, visco_d_func);
90 LAFEM::template MatrixGatherScatterHelper<SpaceType, DataType, IndexType, pol_>::scatter_matrix_csr(loc_mat, (MatValueType*)matrix_data, local_dofs, local_dofs, IndexType(matrix_num_rows), IndexType(matrix_num_cols), matrix_row_ptr, matrix_col_idx, alpha, local_dof_sorter);
94 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_, typename ViscoDFunc_, bool stream_diff_, FEAT::Intern::MatrixGatherScatterPolicy pol_ = FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps>
95 __global__ void full_burgers_vm_assembler_matrix1_bcsr_warp_based(DT_* __restrict__ matrix_data, const DT_* __restrict__ conv_data,
96 const IT_* __restrict__ matrix_row_ptr, const IT_* __restrict__ matrix_col_idx, Index matrix_num_rows, Index matrix_num_cols,
97 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ cub_pt,
98 const DT_* __restrict__ cub_wg, int num_cubs, DT_ alpha,
99 const IT_* __restrict__ cell_to_dof, [[maybe_unused]] Index cell_num,
100 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ nodes, [[maybe_unused]] Index node_size,
101 const int* __restrict__ coloring_map, Index coloring_size, const IT_* __restrict__/* cell_to_dof_sorter*/,
102 const VoxelAssembly::AssemblyBurgersData<DT_> burgers_params, const VoxelAssembly::AssemblyMaterialData<DT_> material_params,
103 const ViscoFunc_ visco_func, const ViscoDFunc_ visco_d_func, const int loc_block_size)
105 // this is a warp based/block based approach
106 // The number of threads calculating one element depend on the chosen block size!
107 // Hence you should at least take a multiple of 32 as blocksize
108 // the base idea is load node ptrs, local csr ptr and so on into shared arrays
109 // but first of all, calculate thread idx, the block index and the local (warp intern) idx
110 // get cooperative group
111 cg::thread_block tb = cg::this_thread_block();
112 const Index t_idx = tb.thread_rank();
114 // for now, we will use 3 threads per local matrix row, to optimize for 3D kernels
115 // define a few constexpr variables which decide on the size of our local arrays
117 typedef Space_ SpaceType;
118 typedef DT_ DataType;
119 typedef IT_ IndexType;
121 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
123 constexpr int dim = SpaceHelp::dim;
126 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
127 //get number of nodes per element
128 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
130 // define our shared array, into which we define our local array by offsets
131 // for now, this does not necessarily be allocated dynamiclly, since the local sizes are all static
132 // so, its not necessary that the size of this has to be sufficiently initilized at kernel launch time
133 // constexpr int shared_size = dim * num_loc_verts + num_loc_dofs*(num_loc_dofs+3);
134 // __shared__ __align__(CudaMath::cuda_get_min_align<DataType, IndexType>()) unsigned char shared_array[shared_size];
135 // we need a shared array to hold our vertices
136 // define local coefficients as shared array
137 // Our static size shared arrays <- this works only when we use whole thread group and not warp groups...
138 // __shared__ DataType local_coeffs[dim*num_loc_verts];
139 // __shared__ IndexType local_dofs[num_loc_dofs];
140 // // __shared__ IndexType local_dofs_sorter[num_loc_dofs];
141 // __shared__ DataType loc_mat[num_loc_dofs*dim*num_loc_dofs*dim];
142 // __shared__ DataType local_conv_dofs[num_loc_dofs*dim];
143 // with external array, we have to be extremly careful with alignment, for this reason, first index the DataTypes (except local mat, since this will require special handling)
144 extern __shared__ unsigned char shared_array[];
146 typedef BurgersSharedDataGlobalWrapper<SpaceHelp> BSDGWrapper;
147 typedef BurgersMatSharedDataKernelWrapper<SpaceHelp, stream_diff_> BSDKWrapper;
149 BSDGWrapper* shared_meta_wrapper =
150 reinterpret_cast<BSDGWrapper*>(&shared_array[0]);
151 // first define local_coeffs, since this will be cast to a tiny matrix, which is required to be aligned...
152 DataType* local_coeffs = &(shared_meta_wrapper->local_coeffs[0]);
153 DataType* local_conv_dofs = &(shared_meta_wrapper->local_conv_dofs[0]);
154 IndexType* local_dofs = &(shared_meta_wrapper->local_dofs[0]);
155 // dummy ptr, since we do not use this...
156 IndexType* local_dofs_sorter = nullptr;
158 // these can be defined in shared memory
159 DataType& tol_eps = shared_meta_wrapper->tol_eps;
160 bool& need_streamline = shared_meta_wrapper->need_streamline;
161 bool& need_convection = shared_meta_wrapper->need_convection;
163 BSDKWrapper* shared_kernel_wrapper = (BSDKWrapper*)(shared_meta_wrapper+1);
164 // TODO: Also gather node coefficients into cell local arrays? <- Increased data size, but better access?
165 // DataType* loc_nodes = (DataType*)&local_conv_dofs[std::size_t(num_loc_dofs)];
166 // offset of shared data in kernel is...
167 DataType* loc_mat = VoxelAssembly::get_aligned_address<DataType>((void*)(&shared_array[0]+sizeof(BSDGWrapper)+sizeof(BSDKWrapper)));
169 //stride based for loop
170 for(int b_idx = blockIdx.x; b_idx < int(coloring_size); b_idx += gridDim.x)
172 //get our actual cell index
173 const Index cell = Index(coloring_map[b_idx]);
175 // start the memcpy calls before formating to overlap dataloading and calculation
176 cg::memcpy_async(tb, local_dofs, cell_to_dof+num_loc_dofs*cell, num_loc_dofs*sizeof(IndexType));
177 // cg::memcpy_async(tb, local_dofs_sorter, cell_to_dof_sorter+num_loc_dofs*cell, num_loc_dofs*sizeof(IndexType));
178 // cg::memcpy_async(tb, loc_nodes, (DT_*)(nodes+cell*num_loc_verts), num_loc_verts); // does not work yet, due to mesh nodes
181 VoxelAssembly::coalesced_format(tb, local_coeffs, dim*num_loc_verts);
182 VoxelAssembly::coalesced_format(tb, loc_mat, loc_block_size*dim*dim);
183 VoxelAssembly::coalesced_format(tb, local_conv_dofs, num_loc_dofs*dim);
187 const DataType& beta{burgers_params.beta};
188 const DataType& sd_delta{burgers_params.sd_delta};
189 const DataType& sd_v_norm{burgers_params.sd_v_norm};
191 //let the first thread rank initialize these
192 cg::invoke_one(tb, [&]()
194 tol_eps = CudaMath::cuda_get_sqrt_eps<DataType>();
195 need_streamline = (CudaMath::cuda_abs(sd_delta) > DataType(0)) && (sd_v_norm > tol_eps);
196 need_convection = CudaMath::cuda_abs(beta) > DataType(0);
199 //wait for everything to be finished
203 //our local datatypes
204 typedef Tiny::Vector<DataType, dim> VecValueType;
205 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
206 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
207 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
210 // std::cout << "Starting with cell " << cell << std::endl;
211 const SharedIndexSetWrapper<IndexType> local_dofs_w{local_dofs};
213 // gather local vector
214 SpaceHelp::grouped_set_coefficients(tb, local_coeffs, local_dofs_w, nodes, cell);
215 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::template grouped_gather_vector_dense<cg::thread_block, dim>(tb, local_conv_dofs,
216 conv_data, IndexType(matrix_num_rows), local_dofs, num_loc_dofs, DataType(1));
219 for(int mat_offset = 0; mat_offset < num_loc_dofs*num_loc_dofs; mat_offset += loc_block_size)
221 // VoxelAssembly::coalesced_format(tb, local_coeffs, dim*num_loc_verts);
222 VoxelAssembly::coalesced_format(tb, loc_mat, loc_block_size*dim*dim);
223 // VoxelAssembly::coalesced_format(tb, local_conv_dofs, num_loc_dofs*dim);
227 VoxelAssembly::Kernel::template grouped_burgers_velo_material_mat_assembly_kernel<cg::thread_block, SpaceHelp, ViscoFunc_, ViscoDFunc_, stream_diff_>(tb, shared_kernel_wrapper, CudaMath::cuda_min(loc_block_size, num_loc_dofs*num_loc_dofs-mat_offset), mat_offset, loc_mat, local_conv_dofs, *((Tiny::Matrix<DataType, dim, num_loc_verts>*)local_coeffs), cub_pt, cub_wg, num_cubs, burgers_params,
228 material_params, need_convection, tol_eps, visco_func, visco_d_func);
233 LAFEM::template MatrixGatherScatterHelper<SpaceType, DataType, IndexType, pol_>::template grouped_scatter_matrix_csr<cg::thread_block, dim, dim>(tb, CudaMath::cuda_min(loc_block_size, num_loc_dofs*num_loc_dofs-mat_offset), mat_offset, loc_mat, matrix_data, local_dofs, local_dofs, IndexType(matrix_num_rows), IndexType(matrix_num_cols), matrix_row_ptr, matrix_col_idx, num_loc_dofs, num_loc_dofs, alpha, local_dofs_sorter);
241 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_>
242 __global__ void full_burgers_vm_assembler_vector_bd(DT_* __restrict__ vector_data,
243 const DT_* conv_data, const DT_* primal_data, Index vec_size,
244 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ cub_pt,
245 const DT_* __restrict__ cub_wg, int num_cubs, DT_ alpha,
246 const IT_* __restrict__ cell_to_dof, [[maybe_unused]] Index cell_num,
247 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ nodes, [[maybe_unused]] Index node_size,
248 const int* __restrict__ coloring_map, Index coloring_size,
249 const VoxelAssembly::AssemblyBurgersData<DT_> burgers_params,
250 const ViscoFunc_ visco_func)
252 Index idx = threadIdx.x + blockDim.x * blockIdx.x;
253 if(idx >= coloring_size)
256 typedef Space_ SpaceType;
257 typedef DT_ DataType;
258 typedef IT_ IndexType;
260 const DataType& beta{burgers_params.beta};
262 const bool need_convection = CudaMath::cuda_abs(beta) > DataType(0);
264 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
266 constexpr int dim = SpaceHelp::dim;
269 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
270 //get number of nodes per element
271 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
273 //our local datatypes
274 typedef Tiny::Vector<DataType, dim> VecValueType;
275 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
276 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
277 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
280 LocalVectorType loc_vec(DataType(0));
281 LocalVectorType local_conv_dofs(DataType(0));
282 LocalVectorType local_prim_dofs(DataType(0));
283 // typename NewSpaceHelp::ImagePointType img_point;
284 Tiny::Matrix<DataType, dim, num_loc_verts> local_coeffs;
286 //now do work for this cell
287 Index cell = Index(coloring_map[idx]);
288 const IndexSetWrapper<IndexType> local_dofs_w{cell_to_dof, IndexType(num_loc_dofs)};
289 const IndexType* local_dofs = cell_to_dof + cell*num_loc_dofs;
290 SpaceHelp::set_coefficients(local_coeffs, local_dofs_w, nodes, cell);
291 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_prim_dofs,
292 (const VecValueType*)primal_data, IndexType(vec_size), local_dofs, DataType(1));
294 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_conv_dofs,
295 (const VecValueType*)conv_data, IndexType(vec_size), local_dofs, DataType(1));
297 VoxelAssembly::Kernel::burgers_velo_material_defect_assembly_kernel<SpaceHelp>(loc_vec, local_prim_dofs, local_conv_dofs, local_coeffs, cub_pt, cub_wg, num_cubs,
298 burgers_params, need_convection, visco_func);
300 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::scatter_vector_dense(loc_vec,
301 (VecValueType*)vector_data, IndexType(vec_size), local_dofs, alpha);
305 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_>
306 __global__ void full_burgers_vm_assembler_vector_bd_warp_based(DT_* __restrict__ vector_data,
307 const DT_* conv_data, const DT_* primal_data, Index vec_size,
308 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ cub_pt,
309 const DT_* __restrict__ cub_wg, int num_cubs, DT_ alpha,
310 const IT_* __restrict__ cell_to_dof, [[maybe_unused]] Index cell_num,
311 const Tiny::Vector<DT_, Space_::world_dim>* __restrict__ nodes, [[maybe_unused]] Index node_size,
312 const int* __restrict__ coloring_map, Index coloring_size,
313 const VoxelAssembly::AssemblyBurgersData<DT_> burgers_params,
314 const ViscoFunc_ visco_func,
315 const int loc_block_size)
317 cg::thread_block tb = cg::this_thread_block();
318 const Index t_idx = tb.thread_rank();
320 typedef Space_ SpaceType;
321 typedef DT_ DataType;
322 typedef IT_ IndexType;
324 const DataType& beta{burgers_params.beta};
326 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
328 constexpr int dim = SpaceHelp::dim;
331 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
332 //get number of nodes per element
333 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
335 //our local datatypes
336 typedef Tiny::Vector<DataType, dim> VecValueType;
337 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
338 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
339 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
341 extern __shared__ unsigned char shared_array[];
343 typedef BurgersDefectSharedDataGlobalWrapper<SpaceHelp> BSDGWrapper;
344 typedef BurgersMatSharedDataKernelWrapper<SpaceHelp, false> BSDKWrapper;
346 BSDGWrapper* shared_meta_wrapper =
347 reinterpret_cast<BSDGWrapper*>(&shared_array[0]);
348 // first define local_coeffs, since this will be cast to a tiny matrix, which is required to be aligned...
349 DataType* local_coeffs = &(shared_meta_wrapper->local_coeffs[0]);
350 DataType* local_conv_dofs = &(shared_meta_wrapper->local_conv_dofs[0]);
351 DataType* local_prim_dofs = &(shared_meta_wrapper->local_prim_dofs[0]);
352 IndexType* local_dofs = &(shared_meta_wrapper->local_dofs[0]);
354 // these can be defined in shared memory
355 bool& need_convection = shared_meta_wrapper->need_convection;
356 cg::invoke_one(tb, [&](){
357 need_convection = CudaMath::cuda_abs(beta) > DataType(0);
359 // shared array for kernel
360 BSDKWrapper* shared_kernel_wrapper = (BSDKWrapper*)(shared_meta_wrapper+1);
361 // the shared array for the local vector to be written out
362 DataType* loc_vec = VoxelAssembly::get_aligned_address<DataType>((void*)(&shared_array[0]+sizeof(BSDGWrapper)+sizeof(BSDKWrapper)));
363 // now do work for this cell
364 //stride based for loop
365 for(int b_idx = blockIdx.x; b_idx < int(coloring_size); b_idx += gridDim.x)
367 //get our actual cell index
368 const Index cell = Index(coloring_map[b_idx]);
370 cg::memcpy_async(tb, local_dofs, cell_to_dof+num_loc_dofs*cell, num_loc_dofs*sizeof(IndexType));
371 VoxelAssembly::coalesced_format(tb, local_coeffs, dim*num_loc_verts);
372 VoxelAssembly::coalesced_format(tb, loc_vec, loc_block_size*dim);
373 VoxelAssembly::coalesced_format(tb, local_conv_dofs, num_loc_dofs*dim);
374 VoxelAssembly::coalesced_format(tb, local_prim_dofs, num_loc_dofs*dim);
379 const SharedIndexSetWrapper<IndexType> local_dofs_w{local_dofs};
380 SpaceHelp::grouped_set_coefficients(tb, local_coeffs, local_dofs_w, nodes, cell);
381 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::template grouped_gather_vector_dense<cg::thread_block, dim>(tb, local_prim_dofs,
382 primal_data, IndexType(vec_size), local_dofs, num_loc_dofs, DataType(1));
384 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::template grouped_gather_vector_dense<cg::thread_block, dim>(tb, local_conv_dofs,
385 conv_data, IndexType(vec_size), local_dofs, num_loc_dofs, DataType(1));
387 for(int vec_offset = 0; vec_offset < num_loc_dofs; vec_offset += loc_block_size)
389 VoxelAssembly::coalesced_format(tb, loc_vec, loc_block_size*dim);
393 VoxelAssembly::Kernel::template grouped_burgers_velo_material_defect_assembly_kernel<cg::thread_block, SpaceHelp, ViscoFunc_>(tb, shared_kernel_wrapper, CudaMath::cuda_min(loc_block_size, num_loc_dofs-vec_offset), vec_offset, loc_vec,
394 local_prim_dofs, local_conv_dofs, *((Tiny::Matrix<DataType, dim, num_loc_verts>*)local_coeffs), cub_pt, cub_wg, num_cubs,
395 burgers_params, need_convection, visco_func);
399 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::template grouped_scatter_vector_dense<cg::thread_block, dim>(tb, CudaMath::cuda_min(loc_block_size, num_loc_dofs-vec_offset), vec_offset, loc_vec,
400 vector_data, IndexType(vec_size), local_dofs, num_loc_dofs, alpha);
407 /**************************************************************************************************************/
408 /* CUDA Host OMP Kernels */
409 /**************************************************************************************************************/
411 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_, typename ViscoDFunc_,
412 FEAT::Intern::MatrixGatherScatterPolicy pol_ = FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps>
413 void full_burgers_vm_assembler_matrix1_bcsr_host(DT_* matrix_data, const DT_* conv_data,
414 const IT_* matrix_row_ptr, const IT_* matrix_col_idx, Index matrix_num_rows, Index matrix_num_cols,
415 const Tiny::Vector<DT_, Space_::world_dim>* cub_pt,
416 const DT_* cub_wg, int num_cubs, DT_ alpha,
417 const IT_* cell_to_dof, [[maybe_unused]] Index cell_num,
418 const Tiny::Vector<DT_, Space_::world_dim>* nodes, [[maybe_unused]] Index node_size,
419 const int* coloring_map, Index coloring_size, const IT_* cell_to_dof_sorter,
420 const VoxelAssembly::AssemblyBurgersData<DT_>& burgers_params,
421 const VoxelAssembly::AssemblyMaterialData<DT_>& material_params,
422 const ViscoFunc_& visco_func, const ViscoDFunc_& visco_d_func)
425 typedef Space_ SpaceType;
426 typedef DT_ DataType;
427 typedef IT_ IndexType;
429 const DataType& beta{burgers_params.beta};
430 const DataType& sd_delta{burgers_params.sd_delta};
431 const DataType& sd_v_norm{burgers_params.sd_v_norm};
433 const DataType tol_eps = CudaMath::cuda_get_sqrt_eps<DataType>();
434 const bool need_streamline = (CudaMath::cuda_abs(sd_delta) > DataType(0)) && (sd_v_norm > tol_eps);
435 const bool need_convection = CudaMath::cuda_abs(beta) > DataType(0);
437 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
439 constexpr int dim = SpaceHelp::dim;
442 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
443 //get number of nodes per element
444 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
446 //our local datatypes
447 typedef Tiny::Vector<DataType, dim> VecValueType;
448 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
449 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
450 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
452 FEAT_PRAGMA_OMP(parallel for)
453 for(Index idx = 0; idx < coloring_size; ++idx)
455 // define local coefficients
456 Tiny::Matrix<DataType, dim, num_loc_verts> local_coeffs;
458 LocalMatrixType loc_mat;
459 LocalVectorType local_conv_dofs(DataType(0));
460 // now do work for this cell
461 int cell = coloring_map[idx];
462 // std::cout << "Starting with cell " << cell << std::endl;
463 const IndexSetWrapper<IndexType> local_dofs_w{cell_to_dof, IndexType(num_loc_dofs)};
464 const IndexType* local_dofs = cell_to_dof + IndexType(cell)*num_loc_dofs;
465 const IndexType* local_dof_sorter = cell_to_dof_sorter + IndexType(cell)*num_loc_dofs;
467 SpaceHelp::set_coefficients(local_coeffs, local_dofs_w, nodes, cell);
468 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_conv_dofs,
469 (const VecValueType*)conv_data, IndexType(matrix_num_rows), local_dofs,DataType(1));
473 VoxelAssembly::Kernel::burgers_velo_material_mat_assembly_kernel<SpaceHelp, LocalMatrixType, LocalVectorType, dim, num_loc_verts, ViscoFunc_, ViscoDFunc_, true>(
474 loc_mat, local_conv_dofs, local_coeffs, cub_pt, cub_wg, num_cubs, burgers_params, material_params, need_convection, tol_eps, visco_func, visco_d_func);
478 VoxelAssembly::Kernel::burgers_velo_material_mat_assembly_kernel<SpaceHelp, LocalMatrixType, LocalVectorType, dim, num_loc_verts, ViscoFunc_, ViscoDFunc_, false>(
479 loc_mat, local_conv_dofs, local_coeffs, cub_pt, cub_wg, num_cubs, burgers_params, material_params, need_convection, tol_eps, visco_func, visco_d_func);
483 LAFEM::template MatrixGatherScatterHelper<SpaceType, DataType, IndexType, pol_>::scatter_matrix_csr(loc_mat, (MatValueType*)matrix_data, local_dofs, local_dofs, IndexType(matrix_num_rows), IndexType(matrix_num_cols), matrix_row_ptr, matrix_col_idx, alpha, local_dof_sorter);
488 template<typename Space_, typename DT_, typename IT_, typename ViscoFunc_>
489 void full_burgers_vm_assembler_vector_bd_host(DT_* vector_data,
490 const DT_* conv_data, const DT_* primal_data, Index vec_size,
491 const Tiny::Vector<DT_, Space_::world_dim>* cub_pt,
492 const DT_* cub_wg, int num_cubs, DT_ alpha,
493 const IT_* cell_to_dof, [[maybe_unused]] Index cell_num,
494 const Tiny::Vector<DT_, Space_::world_dim>* nodes, [[maybe_unused]] Index node_size,
495 const int* coloring_map, Index coloring_size,
496 const VoxelAssembly::AssemblyBurgersData<DT_>& burgers_params,
497 const ViscoFunc_& visco_func)
500 typedef Space_ SpaceType;
501 typedef DT_ DataType;
502 typedef IT_ IndexType;
504 const DataType& beta{burgers_params.beta};
506 const bool need_convection = CudaMath::cuda_abs(beta) > DataType(0);
508 typedef VoxelAssembly::SpaceHelper<SpaceType, DT_, IT_> SpaceHelp;
510 constexpr int dim = SpaceHelp::dim;
513 constexpr int num_loc_dofs = SpaceType::DofMappingType::dof_count;
514 //get number of nodes per element
515 constexpr int num_loc_verts = SpaceType::MeshType::template IndexSet<dim, 0>::Type::num_indices;
517 //our local datatypes
518 typedef Tiny::Vector<DataType, dim> VecValueType;
519 typedef Tiny::Matrix<DataType, dim, dim> MatValueType;
520 typedef Tiny::Vector<VecValueType, num_loc_dofs> LocalVectorType;
521 typedef Tiny::Matrix<MatValueType, num_loc_dofs, num_loc_dofs> LocalMatrixType;
523 FEAT_PRAGMA_OMP(parallel for)
524 for(Index idx = 0; idx < coloring_size; ++idx)
527 LocalVectorType loc_vec(DataType(0));
528 LocalVectorType local_conv_dofs(DataType(0));
529 LocalVectorType local_prim_dofs(DataType(0));
530 // typename NewSpaceHelp::ImagePointType img_point;
531 Tiny::Matrix<DataType, dim, num_loc_verts> local_coeffs;
533 //now do work for this cell
534 int cell = coloring_map[idx];
535 const IndexSetWrapper<IndexType> local_dofs_w{cell_to_dof, IndexType(num_loc_dofs)};
536 const IndexType* local_dofs = cell_to_dof + IndexType(cell)*num_loc_dofs;
537 SpaceHelp::set_coefficients(local_coeffs, local_dofs_w, nodes, cell);
538 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_prim_dofs,
539 (const VecValueType*)primal_data, IndexType(vec_size), local_dofs, DataType(1));
541 //if we need to, gather local convection vector
542 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::gather_vector_dense(local_conv_dofs,
543 (const VecValueType*)conv_data, IndexType(vec_size), local_dofs, DataType(1));
545 VoxelAssembly::Kernel::burgers_velo_material_defect_assembly_kernel<SpaceHelp>(loc_vec, local_prim_dofs, local_conv_dofs, local_coeffs, cub_pt, cub_wg, num_cubs,
546 burgers_params, need_convection, visco_func);
548 LAFEM::template VectorGatherScatterHelper<SpaceType, DataType, IndexType>::scatter_vector_dense(loc_vec,
549 (VecValueType*)vector_data, IndexType(vec_size), local_dofs, alpha);
558 // template<typename Space_, typename DT_, typename IT_>
559 // void assemble_burgers_velo_material_csr_old([[maybe_unused]] const Space_& space,
560 // const CSRMatrixData<DT_, IT_>& matrix_data,
561 // const DT_* conv_data,
562 // const AssemblyCubatureData<DT_>& cubature,
563 // const AssemblyMappingData<DT_, IT_>& dof_mapping,
564 // const std::vector<int*>& coloring_maps,
565 // const std::vector<Index>& coloring_map_sizes,
566 // DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
567 // const AssemblyMaterialData<DT_>& material_params,
568 // MaterialType material_type)
570 // const Index blocksize = Util::cuda_blocksize_blocked_assembly;
571 // // const Index blocksize = 64;
572 // typedef DT_ DataType;
573 // const DataType tol_eps = CudaMath::cuda_get_sqrt_eps<DataType>();
574 // const bool need_streamline = (CudaMath::cuda_abs(burgers_params.sd_delta) > DataType(0)) && (burgers_params.sd_v_norm > tol_eps);
576 // for(Index col = 0; col < coloring_maps.size(); ++col)
580 // block.x = (unsigned int)blocksize;
581 // grid.x = (unsigned int)ceil(double(coloring_map_sizes[col])/double(block.x));
583 // if(need_streamline)
585 // switch(material_type)
587 // case FEAT::VoxelAssembly::MaterialType::carreau:
589 // //kernel call, since this uses the standard stream, sync before next call is enforced:
590 // VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>,
591 // Intern::ViscoDFunctor<DT_, MaterialType::carreau>, true, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper><<< grid, block >>>(
592 // matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
593 // (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
594 // cubature.cub_wg, cubature.num_cubs, alpha,
595 // cell_to_dof_view.get_r(), dof_mapping.cell_num,
596 // nodes_view.get_r(), dof_mapping.node_size,
597 // (const int*) coloring_maps[col], coloring_map_sizes[col], cell_to_dof_sorter_view.get_r(),
598 // burgers_params, material_params, Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
599 // Intern::ViscoDFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T}
603 // case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
605 // //kernel call, since this uses the standard stream, sync before next call is enforced:
606 // VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>,
607 // Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, true, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper><<< grid, block >>>(
608 // matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
609 // (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
610 // cubature.cub_wg, cubature.num_cubs, alpha,
611 // cell_to_dof_view.get_r(), dof_mapping.cell_num,
612 // nodes_view.get_r(), dof_mapping.node_size,
613 // (const int*) coloring_maps[col], coloring_map_sizes[col], cell_to_dof_sorter_view.get_r(),
614 // burgers_params, material_params,
615 // Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
616 // Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T, material_params.yasuda_a, material_params.mu_inf}
624 // switch(material_type)
626 // case FEAT::VoxelAssembly::MaterialType::carreau:
628 // //kernel call, since this uses the standard stream, sync before next call is enforced:
629 // VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>,
630 // Intern::ViscoDFunctor<DT_, MaterialType::carreau>, false, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper><<< grid, block >>>(
631 // matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
632 // (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
633 // cubature.cub_wg, cubature.num_cubs, alpha,
634 // cell_to_dof_view.get_r(), dof_mapping.cell_num,
635 // nodes_view.get_r(), dof_mapping.node_size,
636 // (const int*) coloring_maps[col], coloring_map_sizes[col], cell_to_dof_sorter_view.get_r(),
637 // burgers_params, material_params, Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
638 // Intern::ViscoDFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T}
642 // case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
644 // //kernel call, since this uses the standard stream, sync before next call is enforced:
645 // VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>,
646 // Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, false, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper><<< grid, block >>>(
647 // matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
648 // (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
649 // cubature.cub_wg, cubature.num_cubs, alpha,
650 // cell_to_dof_view.get_r(), dof_mapping.cell_num,
651 // nodes_view.get_r(), dof_mapping.node_size,
652 // (const int*) coloring_maps[col], coloring_map_sizes[col], cell_to_dof_sorter_view.get_r(),
653 // burgers_params, material_params,
654 // Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
655 // Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T, material_params.yasuda_a, material_params.mu_inf}
662 // //check for cuda error in our kernel
663 // Util::cuda_check_last_error();
666 template<typename Space_, typename DT_, typename IT_>
667 inline int get_num_block_warp(MaterialType mat_type, bool need_streamdiff, int blocksize, int shared_mem)
671 case FEAT::VoxelAssembly::MaterialType::carreau:
674 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>, Intern::ViscoDFunctor<DT_, MaterialType::carreau>, true>, blocksize, shared_mem);
676 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>, Intern::ViscoDFunctor<DT_, MaterialType::carreau>, false>, blocksize, shared_mem);
679 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
682 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>, Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, true>, blocksize, shared_mem);
684 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>, Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, false>, blocksize, shared_mem);
689 XABORTM("Not implemented!");
694 template<typename Space_, typename DT_, typename IT_>
695 inline int get_num_block_warp_defect(MaterialType mat_type, int blocksize, int shared_mem)
699 case FEAT::VoxelAssembly::MaterialType::carreau:
701 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>>, blocksize, shared_mem);
704 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
706 return Util::cuda_get_occupancy(VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>>, blocksize, shared_mem);
711 XABORTM("Not implemented!");
716 template<typename Space_, typename DT_, typename IT_>
717 inline bool set_shared_mem_attribute(MaterialType mat_type, bool need_streamdiff, int shared_mem)
721 case FEAT::VoxelAssembly::MaterialType::carreau:
724 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>, Intern::ViscoDFunctor<DT_, MaterialType::carreau>, true>, cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
726 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>, Intern::ViscoDFunctor<DT_, MaterialType::carreau>, false>, cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
729 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
732 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>, Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, true>, cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
734 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>, Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, false>, cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
739 XABORTM("Not implemented!");
744 template<typename Space_, typename DT_, typename IT_>
745 inline bool set_shared_mem_attribute_defect(MaterialType mat_type, int shared_mem)
749 case FEAT::VoxelAssembly::MaterialType::carreau:
751 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>>,cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
754 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
756 return cudaSuccess == cudaFuncSetAttribute(VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>>,cudaFuncAttributeMaxDynamicSharedMemorySize, shared_mem);
761 XABORTM("Not implemented!");
766 template<typename Space_, typename DT_, typename IT_>
767 inline int get_min_shared_size(bool streamline)
769 return sizeof(VoxelAssembly::BurgersSharedDataGlobalWrapper<VoxelAssembly::SpaceHelper<Space_, DT_, IT_>>) +
770 (streamline ? sizeof(VoxelAssembly::BurgersMatSharedDataKernelWrapper<VoxelAssembly::SpaceHelper<Space_, DT_, IT_>, true>) :
771 sizeof(VoxelAssembly::BurgersMatSharedDataKernelWrapper<VoxelAssembly::SpaceHelper<Space_, DT_, IT_>, false>));
774 template<typename Space_, typename DT_, typename IT_>
775 void assemble_burgers_velo_material_csr([[maybe_unused]] const Space_& space,
776 const CSRMatrixData<DT_, IT_>& matrix_data,
777 const DT_* conv_data,
778 const AssemblyCubatureData<DT_>& cubature,
779 const AssemblyMappingData<DT_, IT_>& dof_mapping,
780 const Adjacency::ColoringDataHandler& coloring_data,
781 DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
782 const AssemblyMaterialData<DT_>& material_params,
783 MaterialType material_type, const Util::RuntimeParameter& runtime_params)
785 // unpack the runtime kernel launch parameters
786 const int shared_mem = runtime_params.shared_mem;
787 const int blocksize = runtime_params.blocksize;
788 const int gridsize = runtime_params.gridsize;
789 const bool print_occupancy = runtime_params.print_occupancy;
790 // get the size of all necessary shared memory
791 typedef DT_ DataType;
792 const DataType tol_eps = CudaMath::cuda_get_sqrt_eps<DataType>();
793 constexpr int dim = Space_::ShapeType::dimension;
794 constexpr int num_loc_dofs = Space_::DofMappingType::dof_count;
795 const bool need_streamline = (CudaMath::cuda_abs(burgers_params.sd_delta) > DataType(0)) && (burgers_params.sd_v_norm > tol_eps);
796 // overestimate necessary memory a bit... else this gets to complicated...?!
797 const int shared_size_nec = get_min_shared_size<Space_, DT_, IT_>(need_streamline);
798 const int loc_mat_shared_mem = shared_mem - shared_size_nec;
799 XASSERTM(loc_mat_shared_mem > 0, String("Not enough assigned shared memory\n Minimum required: ") + stringify(shared_size_nec)
800 + String("\nProvided: ") + stringify(shared_mem));
802 const int loc_block_size = CudaMath::cuda_min(loc_mat_shared_mem / int(sizeof(DT_)*dim*dim), num_loc_dofs*num_loc_dofs);
803 XASSERTM(loc_block_size > 0, "Not enough memory assigned to assemble a single matrix entry!");
804 XASSERTM(loc_block_size >= num_loc_dofs, "Not enough memory assigned to assemble a single matrix row!");
808 int numBlocksWarp = get_num_block_warp<Space_, DT_, IT_>(material_type, need_streamline, blocksize, shared_mem);
809 const int max_blocks_per_sm = int(Util::cuda_get_max_blocks_per_sm());
810 printf("Numblocks/Occupancy per SM for device number %i: %i, %f\n", Util::cuda_device_number, numBlocksWarp, double(numBlocksWarp*(blocksize/32))/double(max_blocks_per_sm));
813 if(shared_mem > 48000)
815 if(!set_shared_mem_attribute<Space_, DT_, IT_>(material_type, need_streamline, shared_mem))
817 XABORTM("cudaFuncSetAttribute failed.");
820 // const Index blocksize = 64;
822 const Memory::TypedView<int> color_view = coloring_data.color_map_view(Memory::Location::cuda, Memory::Access::read);
823 const Memory::TypedView<IT_> cell_to_dof_view(dof_mapping.cell_to_dof.view(Memory::Location::cuda, Memory::Access::read));
824 const Memory::TypedView<Tiny::Vector<DT_, Space_::world_dim>> nodes_view(dof_mapping.nodes.view(Memory::Location::cuda, Memory::Access::read));
826 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
830 block.x = (unsigned int)blocksize;
831 grid.x = (unsigned int)gridsize;
835 switch(material_type)
837 case FEAT::VoxelAssembly::MaterialType::carreau:
839 //kernel call, since this uses the standard stream, sync before next call is enforced:
840 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>,
841 Intern::ViscoDFunctor<DT_, MaterialType::carreau>, true, FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps><<< grid, block, shared_mem >>>(
842 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
843 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
844 cubature.cub_wg, cubature.num_cubs, alpha,
845 cell_to_dof_view.get_r(), dof_mapping.cell_num,
846 nodes_view.get_r(), dof_mapping.node_size,
847 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), nullptr,
848 burgers_params, material_params, Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
849 Intern::ViscoDFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
854 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
856 //kernel call, since this uses the standard stream, sync before next call is enforced:
857 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>,
858 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, true, FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps><<< grid, block, shared_mem >>>(
859 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
860 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
861 cubature.cub_wg, cubature.num_cubs, alpha,
862 cell_to_dof_view.get_r(), dof_mapping.cell_num,
863 nodes_view.get_r(), dof_mapping.node_size,
864 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), nullptr,
865 burgers_params, material_params,
866 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
867 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T, material_params.yasuda_a, material_params.mu_inf},
876 switch(material_type)
878 case FEAT::VoxelAssembly::MaterialType::carreau:
880 //kernel call, since this uses the standard stream, sync before next call is enforced:
881 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>,
882 Intern::ViscoDFunctor<DT_, MaterialType::carreau>, false, FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps><<< grid, block, shared_mem >>>(
883 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
884 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
885 cubature.cub_wg, cubature.num_cubs, alpha,
886 cell_to_dof_view.get_r(), dof_mapping.cell_num,
887 nodes_view.get_r(), dof_mapping.node_size,
888 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), nullptr,
889 burgers_params, material_params, Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
890 Intern::ViscoDFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
895 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
897 //kernel call, since this uses the standard stream, sync before next call is enforced:
898 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>,
899 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, false, FEAT::Intern::MatrixGatherScatterPolicy::useLocalOps><<< grid, block, shared_mem >>>(
900 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
901 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
902 cubature.cub_wg, cubature.num_cubs, alpha,
903 cell_to_dof_view.get_r(), dof_mapping.cell_num,
904 nodes_view.get_r(), dof_mapping.node_size,
905 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), nullptr,
906 burgers_params, material_params,
907 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
908 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T, material_params.yasuda_a, material_params.mu_inf},
916 //check for cuda error in our kernel
917 if(runtime_params.synchronize)
918 Util::cuda_check_last_error();
922 template<typename Space_, typename DT_, typename IT_>
923 void assemble_burgers_velo_material_defect_old([[maybe_unused]] const Space_& space,
925 const DT_* conv_data,
926 const DT_* primal_data,
927 const AssemblyCubatureData<DT_>& cubature,
928 const AssemblyMappingData<DT_, IT_>& dof_mapping,
929 const Adjacency::ColoringDataHandler& coloring_data,
930 DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
931 const AssemblyMaterialData<DT_>& material_params,
932 MaterialType material_type)
934 const Index blocksize = Util::cuda_blocksize_scalar_assembly;
935 // const Index blocksize = 64;
938 cudaDeviceGetLimit(&pValue, cudaLimit::cudaLimitStackSize);
939 std::cout << "Current maximum thread cache: " << pValue << std::endl;
942 const Memory::TypedView<int> color_view = coloring_data.color_map_view(Memory::Location::cuda, Memory::Access::read);
943 const Memory::TypedView<IT_> cell_to_dof_view(dof_mapping.cell_to_dof.view(Memory::Location::cuda, Memory::Access::read));
944 const Memory::TypedView<Tiny::Vector<DT_, Space_::world_dim>> nodes_view(dof_mapping.nodes.view(Memory::Location::cuda, Memory::Access::read));
946 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
950 block.x = (unsigned int)blocksize;
951 grid.x = (unsigned int)ceil(double(coloring_data.get_color_size(col))/double(block.x));
952 switch(material_type)
954 case FEAT::VoxelAssembly::MaterialType::carreau:
956 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>><<< grid, block >>>(vector_data, conv_data, primal_data,
957 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
958 cubature.cub_wg, cubature.num_cubs, alpha,
959 cell_to_dof_view.get_r(), dof_mapping.cell_num,
960 nodes_view.get_r(), dof_mapping.node_size,
961 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
962 Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T}
966 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
968 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>><<< grid, block >>>(vector_data, conv_data, primal_data,
969 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
970 cubature.cub_wg, cubature.num_cubs, alpha,
971 cell_to_dof_view.get_r(), dof_mapping.cell_num,
972 nodes_view.get_r(), dof_mapping.node_size,
973 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
974 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf}
981 //check for cuda error (also synchronizes)
982 Util::cuda_check_last_error();
985 template<typename Space_, typename DT_, typename IT_>
986 void assemble_burgers_velo_material_defect([[maybe_unused]] const Space_& space,
988 const DT_* conv_data,
989 const DT_* primal_data,
990 const AssemblyCubatureData<DT_>& cubature,
991 const AssemblyMappingData<DT_, IT_>& dof_mapping,
992 const Adjacency::ColoringDataHandler& coloring_data,
993 DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
994 const AssemblyMaterialData<DT_>& material_params,
995 MaterialType material_type,
996 const Util::RuntimeParameter& runtime_params)
998 // unpack the runtime kernel launch parameters
999 const int shared_mem = runtime_params.shared_mem;
1000 const int blocksize = runtime_params.blocksize;
1001 const int gridsize = runtime_params.gridsize;
1002 const bool print_occupancy = runtime_params.print_occupancy;
1003 // get the size of all necessary shared memory
1004 constexpr int dim = Space_::ShapeType::dimension;
1005 constexpr int num_loc_dofs = Space_::DofMappingType::dof_count;
1006 const int shared_size_nec = get_min_shared_size<Space_, DT_, IT_>(false);
1007 const int loc_vec_shared_mem = shared_mem - shared_size_nec;
1008 XASSERTM(loc_vec_shared_mem > 0, String("Not enough assigned shared memory\n Minimum required: ") + stringify(shared_size_nec)
1009 + String("\nProvided: ") + stringify(shared_mem));
1011 const int loc_block_size = CudaMath::cuda_min(loc_vec_shared_mem / int(sizeof(DT_)*dim), num_loc_dofs);
1012 XASSERTM(loc_block_size > 0, "Not enough memory assigned to assemble a single defect entry!");
1016 int numBlocksWarp = get_num_block_warp_defect<Space_, DT_, IT_>(material_type, blocksize, shared_mem);
1017 const int max_blocks_per_sm = int(Util::cuda_get_max_blocks_per_sm());
1018 printf("Numblocks/Occupancy per SM for device number %i: %i, %f\n", Util::cuda_device_number, numBlocksWarp, double(numBlocksWarp*(blocksize/32))/double(max_blocks_per_sm));
1021 if(shared_mem > 48000)
1023 if(!set_shared_mem_attribute_defect<Space_, DT_, IT_>(material_type, shared_mem))
1025 XABORTM("cudaFuncSetAttribute failed.");
1029 const Memory::TypedView<int> color_view = coloring_data.color_map_view(Memory::Location::cuda, Memory::Access::read);
1030 const Memory::TypedView<IT_> cell_to_dof_view(dof_mapping.cell_to_dof.view(Memory::Location::cuda, Memory::Access::read));
1031 const Memory::TypedView<Tiny::Vector<DT_, Space_::world_dim>> nodes_view(dof_mapping.nodes.view(Memory::Location::cuda, Memory::Access::read));
1033 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
1037 block.x = (unsigned int)blocksize;
1038 grid.x = (unsigned int)gridsize;
1039 switch(material_type)
1041 case FEAT::VoxelAssembly::MaterialType::carreau:
1043 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>><<< grid, block, shared_mem >>>(vector_data, conv_data, primal_data,
1044 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1045 cubature.cub_wg, cubature.num_cubs, alpha,
1046 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1047 nodes_view.get_r(), dof_mapping.node_size,
1048 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
1049 Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
1054 case FEAT::VoxelAssembly::MaterialType::carreauYasuda:
1056 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_warp_based<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>><<< grid, block, shared_mem >>>(vector_data, conv_data, primal_data,
1057 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1058 cubature.cub_wg, cubature.num_cubs, alpha,
1059 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1060 nodes_view.get_r(), dof_mapping.node_size,
1061 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
1062 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
1070 //check for cuda error (also synchronizes)
1071 if(runtime_params.synchronize)
1072 Util::cuda_check_last_error();
1075 template<typename Space_, typename DT_, typename IT_>
1076 void assemble_burgers_velo_material_csr_host([[maybe_unused]] const Space_& space,
1077 const CSRMatrixData<DT_, IT_>& matrix_data,
1078 const DT_* conv_data,
1079 const AssemblyCubatureData<DT_>& cubature,
1080 const AssemblyMappingData<DT_, IT_>& dof_mapping,
1081 const Adjacency::ColoringDataHandler& coloring_data,
1082 DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
1083 const AssemblyMaterialData<DT_>& material_params, MaterialType material_type)
1085 const Memory::TypedView<int> color_view = coloring_data.color_map_view(Memory::Location::main, Memory::Access::read);
1086 const Memory::TypedView<IT_> cell_to_dof_view(dof_mapping.cell_to_dof.view(Memory::Location::main, Memory::Access::read));
1087 const Memory::TypedView<IT_> cell_to_dof_sorter_view(dof_mapping.cell_to_dof_sorter.view(Memory::Location::main, Memory::Access::read));
1088 const Memory::TypedView<Tiny::Vector<DT_, Space_::world_dim>> nodes_view(dof_mapping.nodes.view(Memory::Location::main, Memory::Access::read));
1089 switch(material_type)
1091 case MaterialType::carreau:
1093 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
1095 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_host<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreau>,
1096 Intern::ViscoDFunctor<DT_, MaterialType::carreau>, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper>(
1097 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
1098 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1099 cubature.cub_wg, cubature.num_cubs, alpha,
1100 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1101 nodes_view.get_r(), dof_mapping.node_size,
1102 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), cell_to_dof_sorter_view.get_r(),
1103 burgers_params, material_params, Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T},
1104 Intern::ViscoDFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T}
1109 case MaterialType::carreauYasuda:
1111 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
1113 VoxelAssembly::Kernel::template full_burgers_vm_assembler_matrix1_bcsr_host<Space_, DT_, IT_, Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>,
1114 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>, FEAT::Intern::MatrixGatherScatterPolicy::useLocalSortHelper>(
1115 matrix_data.data, conv_data, matrix_data.row_ptr, matrix_data.col_idx, matrix_data.num_rows, matrix_data.num_cols,
1116 (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1117 cubature.cub_wg, cubature.num_cubs, alpha,
1118 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1119 nodes_view.get_r(), dof_mapping.node_size,
1120 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), cell_to_dof_sorter_view.get_r(),
1121 burgers_params, material_params,
1122 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf},
1123 Intern::ViscoDFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T, material_params.yasuda_a, material_params.mu_inf}
1131 template<typename Space_, typename DT_, typename IT_>
1132 void assemble_burgers_velo_material_defect_host([[maybe_unused]] const Space_& space,
1134 const DT_* conv_data,
1135 const DT_* primal_data,
1136 const AssemblyCubatureData<DT_>& cubature,
1137 const AssemblyMappingData<DT_, IT_>& dof_mapping,
1138 const Adjacency::ColoringDataHandler& coloring_data,
1139 DT_ alpha, const AssemblyBurgersData<DT_>& burgers_params,
1140 const AssemblyMaterialData<DT_>& material_params, MaterialType material_type)
1144 cudaDeviceGetLimit(&pValue, cudaLimit::cudaLimitStackSize);
1145 std::cout << "Current maximum thread cache: " << pValue << std::endl;
1147 const Memory::TypedView<int> color_view = coloring_data.color_map_view(Memory::Location::main, Memory::Access::read);
1148 const Memory::TypedView<IT_> cell_to_dof_view(dof_mapping.cell_to_dof.view(Memory::Location::main, Memory::Access::read));
1149 const Memory::TypedView<Tiny::Vector<DT_, Space_::world_dim>> nodes_view(dof_mapping.nodes.view(Memory::Location::main, Memory::Access::read));
1151 switch(material_type)
1153 case MaterialType::carreau:
1155 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
1157 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_host<Space_, DT_, IT_>(vector_data, conv_data, primal_data,
1158 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1159 cubature.cub_wg, cubature.num_cubs, alpha,
1160 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1161 nodes_view.get_r(), dof_mapping.node_size,
1162 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
1163 Intern::ViscoFunctor<DT_, MaterialType::carreau>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T}
1168 case MaterialType::carreauYasuda:
1170 for(Index col = 0; col < coloring_data.get_num_colors(); ++col)
1172 VoxelAssembly::Kernel::template full_burgers_vm_assembler_vector_bd_host<Space_, DT_, IT_>(vector_data, conv_data, primal_data,
1173 space.get_num_dofs(), (const typename Tiny::Vector<DT_, Space_::world_dim>*) cubature.cub_pt,
1174 cubature.cub_wg, cubature.num_cubs, alpha,
1175 cell_to_dof_view.get_r(), dof_mapping.cell_num,
1176 nodes_view.get_r(), dof_mapping.node_size,
1177 &color_view.get_r()[coloring_data.get_color_offset(col)], coloring_data.get_color_size(col), burgers_params,
1178 Intern::ViscoFunctor<DT_, MaterialType::carreauYasuda>{material_params.mu_0, material_params.exp, material_params.lambda, material_params.a_T,material_params.yasuda_a, material_params.mu_inf}
1189using namespace FEAT;
1190using namespace FEAT::VoxelAssembly;
1192/*******************************************************2D implementations***************************************************/
1193template void Arch::assemble_burgers_velo_material_csr(const Q2StandardQuad&, const CSRMatrixData<double, std::uint32_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1194 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1195template void Arch::assemble_burgers_velo_material_csr(const Q2StandardQuad&, const CSRMatrixData<float, std::uint32_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1196 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1197template void Arch::assemble_burgers_velo_material_csr(const Q2StandardQuad&, const CSRMatrixData<double, std::uint64_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1198 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1199template void Arch::assemble_burgers_velo_material_csr(const Q2StandardQuad&, const CSRMatrixData<float, std::uint64_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1200 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1202template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardQuad&, const CSRMatrixData<double, std::uint32_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1203 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1204template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardQuad&, const CSRMatrixData<float, std::uint32_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1205 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1206template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardQuad&, const CSRMatrixData<double, std::uint64_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1207 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1208template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardQuad&, const CSRMatrixData<float, std::uint64_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1209 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1211template void Arch::assemble_burgers_velo_material_defect(const Q2StandardQuad&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1212 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1213template void Arch::assemble_burgers_velo_material_defect(const Q2StandardQuad&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1214 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1215template void Arch::assemble_burgers_velo_material_defect(const Q2StandardQuad&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1216 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1217template void Arch::assemble_burgers_velo_material_defect(const Q2StandardQuad&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1218 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1220template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardQuad&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1221 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1222template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardQuad&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1223 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1224template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardQuad&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1225 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1226template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardQuad&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1227 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1229/*********************************************************3D implementations**************************************************************************************/
1231template void Arch::assemble_burgers_velo_material_csr(const Q2StandardHexa&, const CSRMatrixData<double, std::uint32_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1232 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1233template void Arch::assemble_burgers_velo_material_csr(const Q2StandardHexa&, const CSRMatrixData<float, std::uint32_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1234 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1235template void Arch::assemble_burgers_velo_material_csr(const Q2StandardHexa&, const CSRMatrixData<double, std::uint64_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1236 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1237template void Arch::assemble_burgers_velo_material_csr(const Q2StandardHexa&, const CSRMatrixData<float, std::uint64_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1238 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1240template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardHexa&, const CSRMatrixData<double, std::uint32_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1241 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1242template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardHexa&, const CSRMatrixData<float, std::uint32_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1243 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1244template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardHexa&, const CSRMatrixData<double, std::uint64_t>&, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1245 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1246template void Arch::assemble_burgers_velo_material_csr_host(const Q2StandardHexa&, const CSRMatrixData<float, std::uint64_t>&, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1247 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1249template void Arch::assemble_burgers_velo_material_defect(const Q2StandardHexa&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1250 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1251template void Arch::assemble_burgers_velo_material_defect(const Q2StandardHexa&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1252 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1253template void Arch::assemble_burgers_velo_material_defect(const Q2StandardHexa&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1254 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType, const Util::RuntimeParameter&);
1255template void Arch::assemble_burgers_velo_material_defect(const Q2StandardHexa&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1256 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType, const Util::RuntimeParameter&);
1258template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardHexa&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint32_t>&,
1259 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1260template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardHexa&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint32_t>&,
1261 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);
1262template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardHexa&, double*, const double*, const double*, const AssemblyCubatureData<double>&, const AssemblyMappingData<double, std::uint64_t>&,
1263 const Adjacency::ColoringDataHandler&, double, const AssemblyBurgersData<double>&, const AssemblyMaterialData<double>&, MaterialType);
1264template void Arch::assemble_burgers_velo_material_defect_host(const Q2StandardHexa&, float*, const float*, const float*, const AssemblyCubatureData<float>&, const AssemblyMappingData<float, std::uint64_t>&,
1265 const Adjacency::ColoringDataHandler&, float, const AssemblyBurgersData<float>&, const AssemblyMaterialData<float>&, MaterialType);