Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce header inclusions of index_set.h in evaluation_kernels #14022

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions include/deal.II/base/mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <deal.II/base/config.h>

#include <deal.II/base/array_view.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/mpi_tags.h>
#include <deal.II/base/numbers.h>
#include <deal.II/base/template_constraints.h>
#include <deal.II/base/utilities.h>

#include <boost/signals2.hpp>

Expand Down Expand Up @@ -116,9 +116,10 @@ namespace Utilities
* return the @p my_partition_id 's IndexSet.
*/
IndexSet
create_evenly_distributed_partitioning(const unsigned int my_partition_id,
const unsigned int n_partitions,
const IndexSet::size_type total_size);
create_evenly_distributed_partitioning(
const unsigned int my_partition_id,
const unsigned int n_partitions,
const types::global_dof_index total_size);

/**
* A namespace for utility functions that abstract certain operations using
Expand Down Expand Up @@ -485,8 +486,9 @@ namespace Utilities
* starts at the index one larger than the last one stored on process p.
*/
std::vector<IndexSet>
create_ascending_partitioning(const MPI_Comm & comm,
const IndexSet::size_type locally_owned_size);
create_ascending_partitioning(
const MPI_Comm & comm,
const types::global_dof_index locally_owned_size);

/**
* Given the total number of elements @p total_size, create an evenly
Expand All @@ -497,8 +499,8 @@ namespace Utilities
*/
IndexSet
create_evenly_distributed_partitioning(
const MPI_Comm & comm,
const IndexSet::size_type total_size);
const MPI_Comm & comm,
const types::global_dof_index total_size);

#ifdef DEAL_II_WITH_MPI
/**
Expand Down
12 changes: 10 additions & 2 deletions include/deal.II/matrix_free/dof_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
#include <deal.II/base/config.h>

#include <deal.II/base/exceptions.h>
#include <deal.II/base/partitioner.h>
#include <deal.II/base/vectorization.h>

#include <deal.II/matrix_free/face_info.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/matrix_free/task_info.h>
#include <deal.II/matrix_free/vector_data_exchange.h>

#include <array>
Expand All @@ -48,6 +46,8 @@ namespace internal

template <typename, typename>
struct FPArrayComparator;

struct TaskInfo;
} // namespace MatrixFreeFunctions
} // namespace internal

Expand All @@ -62,6 +62,14 @@ class TriaIterator;
template <int, int, bool>
class DoFCellAccessor;

namespace Utilities
{
namespace MPI
{
class Partitioner;
}
} // namespace Utilities

#endif

namespace internal
Expand Down
1 change: 0 additions & 1 deletion include/deal.II/matrix_free/fe_evaluation_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <deal.II/matrix_free/dof_info.h>
#include <deal.II/matrix_free/mapping_info_storage.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/matrix_free/type_traits.h>


DEAL_II_NAMESPACE_OPEN
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/matrix_free/task_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <deal.II/base/config.h>

#include <deal.II/base/exceptions.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/memory_consumption.h>
#include <deal.II/base/mpi.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/thread_management.h>
#include <deal.II/base/utilities.h>
Expand Down
19 changes: 18 additions & 1 deletion include/deal.II/matrix_free/vector_data_exchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,28 @@

#include <deal.II/base/config.h>

#include <deal.II/base/partitioner.h>
#include <deal.II/base/array_view.h>
#include <deal.II/base/mpi.h>

#include <deal.II/lac/vector_operation.h>


DEAL_II_NAMESPACE_OPEN

#ifndef DOXYGEN

// forward declaration
namespace Utilities
{
namespace MPI
{
class Partitioner;
}
} // namespace Utilities

#endif


namespace internal
{
namespace MatrixFreeFunctions
Expand Down
35 changes: 24 additions & 11 deletions source/base/mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ DEAL_II_NAMESPACE_OPEN
namespace Utilities
{
IndexSet
create_evenly_distributed_partitioning(const unsigned int my_partition_id,
const unsigned int n_partitions,
const IndexSet::size_type total_size)
create_evenly_distributed_partitioning(
const unsigned int my_partition_id,
const unsigned int n_partitions,
const types::global_dof_index total_size)
{
static_assert(
std::is_same<types::global_dof_index, IndexSet::size_type>::value,
"IndexSet::size_type must match types::global_dof_index for "
"using this function");
const unsigned int remain = total_size % n_partitions;

const IndexSet::size_type min_size = total_size / n_partitions;
Expand Down Expand Up @@ -214,9 +219,14 @@ namespace Utilities


std::vector<IndexSet>
create_ascending_partitioning(const MPI_Comm & comm,
const IndexSet::size_type locally_owned_size)
create_ascending_partitioning(
const MPI_Comm & comm,
const types::global_dof_index locally_owned_size)
{
static_assert(
std::is_same<types::global_dof_index, IndexSet::size_type>::value,
"IndexSet::size_type must match types::global_dof_index for "
"using this function");
const unsigned int n_proc = n_mpi_processes(comm);
const std::vector<IndexSet::size_type> sizes =
all_gather(comm, locally_owned_size);
Expand All @@ -238,8 +248,9 @@ namespace Utilities


IndexSet
create_evenly_distributed_partitioning(const MPI_Comm & comm,
const IndexSet::size_type total_size)
create_evenly_distributed_partitioning(
const MPI_Comm & comm,
const types::global_dof_index total_size)
{
const unsigned int this_proc = this_mpi_process(comm);
const unsigned int n_proc = n_mpi_processes(comm);
Expand Down Expand Up @@ -663,15 +674,17 @@ namespace Utilities


std::vector<IndexSet>
create_ascending_partitioning(const MPI_Comm & /*comm*/,
const IndexSet::size_type locally_owned_size)
create_ascending_partitioning(
const MPI_Comm & /*comm*/,
const types::global_dof_index locally_owned_size)
{
return std::vector<IndexSet>(1, complete_index_set(locally_owned_size));
}

IndexSet
create_evenly_distributed_partitioning(const MPI_Comm & /*comm*/,
const IndexSet::size_type total_size)
create_evenly_distributed_partitioning(
const MPI_Comm & /*comm*/,
const types::global_dof_index total_size)
{
return complete_index_set(total_size);
}
Expand Down
1 change: 1 addition & 0 deletions source/matrix_free/vector_data_exchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <deal.II/base/mpi.templates.h>
#include <deal.II/base/mpi_compute_index_owner_internal.h>
#include <deal.II/base/mpi_consensus_algorithms.h>
#include <deal.II/base/partitioner.h>
#include <deal.II/base/timer.h>

#include <deal.II/matrix_free/vector_data_exchange.h>
Expand Down