From: Bruno Turcksin Date: Tue, 13 Mar 2018 00:58:31 +0000 (-0400) Subject: Do not use macros in the cuda matrix-free X-Git-Tag: v9.0.0-rc1~326^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6043%2Fhead;p=dealii.git Do not use macros in the cuda matrix-free --- diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index 49e3eb6fa4..d564f18165 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -21,6 +21,7 @@ #ifdef DEAL_II_WITH_CUDA +#include #include #include #include @@ -28,7 +29,6 @@ #include #include -#define BLOCK_SIZE 128 DEAL_II_NAMESPACE_OPEN @@ -37,10 +37,10 @@ namespace CUDAWrappers namespace internal { // These variables are stored in the device constant memory. - // TODO: use a template parameter instead of a macro -#define MAX_ELEM_DEGREE 10 - __constant__ double global_shape_values[(MAX_ELEM_DEGREE+1) * (MAX_ELEM_DEGREE+1)]; - __constant__ double global_shape_gradients[(MAX_ELEM_DEGREE+1) * (MAX_ELEM_DEGREE+1)]; + // TODO: use a template parameter + constexpr unsigned int max_elem_degree = 10; + __constant__ double global_shape_values[(max_elem_degree+1) * (max_elem_degree+1)]; + __constant__ double global_shape_gradients[(max_elem_degree+1) * (max_elem_degree+1)]; template using CUDAVector = ::dealii::LinearAlgebra::CUDAWrappers::Vector; @@ -523,13 +523,13 @@ namespace CUDAWrappers { const unsigned int constraint_n_blocks = std::ceil(static_cast(n_constrained_dofs) / - static_cast(BLOCK_SIZE)); + static_cast(block_size)); const unsigned int constraint_x_n_blocks = std::round(std::sqrt(constraint_n_blocks)); const unsigned int constraint_y_n_blocks = std::ceil(static_cast(constraint_n_blocks) / static_cast(constraint_x_n_blocks)); constraint_grid_dim = dim3(constraint_x_n_blocks, constraint_y_n_blocks); - constraint_block_dim = dim3(BLOCK_SIZE); + constraint_block_dim = dim3(block_size); std::vector constrained_dofs_host(n_constrained_dofs);