DOLFINx 0.12.0.0
DOLFINx C++
Loading...
Searching...
No Matches
partitioners.h
1// Copyright (C) 2020-2026 Garth N. Wells and Igor A. Baratta
2//
3// This file is part of DOLFINx (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#include "partition.h"
10#include <array>
11#include <optional>
12#include <span>
13
14namespace dolfinx::graph
15{
16
28template <typename T>
29graph::AdjacencyList<int> compute_destination_ranks(
30 MPI_Comm comm, const graph::AdjacencyList<std::int64_t>& graph,
31 const std::vector<T>& node_disp, const std::vector<T>& part);
32
33namespace scotch
34{
35#ifdef HAS_PTSCOTCH
39enum class strategy : std::uint8_t
40{
43 none,
44 balance,
45 quality,
46 safety,
47 speed,
48 scalability
49};
50
66graph::partition_fn partitioner(scotch::strategy strategy = strategy::speed,
67 double imbalance = 0.025, int seed = 0);
68#endif
69
70} // namespace scotch
71
72namespace parmetis
73{
74#ifdef HAS_PARMETIS
87graph::partition_fn partitioner(double imbalance = 1.02,
88 std::array<int, 3> options = {1, 0, 5});
89
118graph::partition_fn repartitioner(double ipc2redist = 1000.0,
119 double imbalance = 1.02,
120 std::array<int, 3> options = {1, 0, 5});
121
153std::vector<int>
154geom_partitioner(MPI_Comm comm, int nparts, std::span<const double> x, int gdim,
155 std::optional<std::span<const std::int32_t>> node_weights);
156
180graph::hybrid_partition_fn geom_partitioner_kway(double imbalance = 1.02,
181 std::array<int, 3> options
182 = {1, 0, 5});
183#endif
184} // namespace parmetis
185
187namespace kahip
188{
189#ifdef HAS_KAHIP
199graph::partition_fn partitioner(int mode = 1, int seed = 1,
200 double imbalance = 0.03,
201 bool suppress_output = true);
202#endif
203} // namespace kahip
204
205} // namespace dolfinx::graph
Interfaces to KaHIP parallel partitioner.
Definition partitioners.h:188
graph::partition_fn partitioner(int mode=1, int seed=1, double imbalance=0.03, bool suppress_output=true)
Create a graph partitioning function that uses KaHIP.
Definition partitioners.cpp:837
Graph data structures and algorithms.
Definition AdjacencyList.h:23
std::function< graph::AdjacencyList< std::int32_t >( MPI_Comm, int, const AdjacencyList< std::int64_t > &, std::span< const double >, std::optional< std::span< const std::int32_t > >, std::optional< std::span< const std::int32_t > >, bool)> hybrid_partition_fn
Signature of functions for computing the parallel partitioning of a distributed graph using both its ...
Definition partition.h:102
std::function< graph::AdjacencyList< std::int32_t >( MPI_Comm, int, const AdjacencyList< std::int64_t > &, std::optional< std::span< const std::int32_t > >, std::optional< std::span< const std::int32_t > >, bool)> partition_fn
Signature of functions for computing the parallel partitioning of a distributed graph,...
Definition partition.h:38
graph::AdjacencyList< int > compute_destination_ranks(MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &graph, const std::vector< T > &node_disp, const std::vector< T > &part)
Definition partitioners.cpp:45