From d673f3a07457329cf313a1a53e2f5a215b6bc5d5 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 27 Nov 2018 15:46:55 +0100 Subject: [PATCH] Use shared_ptr for Partitioner in CUDAWrappers::MatrixFree --- include/deal.II/matrix_free/cuda_hanging_nodes_internal.h | 4 ++-- include/deal.II/matrix_free/cuda_matrix_free.h | 4 ++-- include/deal.II/matrix_free/cuda_matrix_free.templates.h | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h b/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h index 4a4df3be8e..b7d8e5d18a 100644 --- a/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h @@ -61,7 +61,7 @@ namespace CUDAWrappers setup_constraints( std::vector & dof_indices, const CellIterator & cell, - const std::unique_ptr &partitioner, + const std::shared_ptr &partitioner, unsigned int & mask) const; private: @@ -276,7 +276,7 @@ namespace CUDAWrappers HangingNodes::setup_constraints( std::vector & dof_indices, const CellIterator & cell, - const std::unique_ptr &partitioner, + const std::shared_ptr &partitioner, unsigned int & mask) const { mask = 0; diff --git a/include/deal.II/matrix_free/cuda_matrix_free.h b/include/deal.II/matrix_free/cuda_matrix_free.h index a8932d9b32..5c57033113 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.h @@ -428,10 +428,10 @@ namespace CUDAWrappers std::vector block_dim; /** - * Unique pointer to a Partitioner for distributed Vectors used in + * Shared pointer to a Partitioner for distributed Vectors used in * cell_loop. When MPI is not used the pointer is null. */ - std::unique_ptr partitioner; + std::shared_ptr partitioner; // Parallelization parameters unsigned int cells_per_block; 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 9e8c5e35f5..23f84bf896 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -23,7 +23,6 @@ # include # include -# include # include @@ -147,7 +146,7 @@ namespace CUDAWrappers get_cell_data( const CellFilter & cell, const unsigned int cell_id, - const std::unique_ptr &partitioner); + const std::shared_ptr &partitioner); void alloc_and_copy_arrays(const unsigned int cell); @@ -287,7 +286,7 @@ namespace CUDAWrappers ReinitHelper::get_cell_data( const CellFilter & cell, const unsigned int cell_id, - const std::unique_ptr &partitioner) + const std::shared_ptr &partitioner) { cell->get_dof_indices(local_dof_indices); // When using MPI, we need to transform the local_dof_indices, which @@ -843,7 +842,7 @@ namespace CUDAWrappers { DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs); - partitioner = std_cxx14::make_unique( + partitioner = std::make_shared( dof_handler.locally_owned_dofs(), locally_relevant_dofs, *comm); } for (unsigned int i = 0; i < n_colors; ++i) -- 2.39.5