1 /*============================================================================
2 * Definition of advanced options relative to parallelism.
3 *============================================================================*/
4
5 /* VERS */
6
7 /*
8 This file is part of Code_Saturne, a general-purpose CFD tool.
9
10 Copyright (C) 1998-2021 EDF S.A.
11
12 This program is free software; you can redistribute it and/or modify it under
13 the terms of the GNU General Public License as published by the Free Software
14 Foundation; either version 2 of the License, or (at your option) any later
15 version.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
24 Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 */
26
27 /*----------------------------------------------------------------------------*/
28
29 #include "cs_defs.h"
30
31 /*----------------------------------------------------------------------------
32 * Standard C library headers
33 *----------------------------------------------------------------------------*/
34
35 #include <assert.h>
36 #include <math.h>
37 #include <stdarg.h>
38 #include <stdlib.h>
39 #include <stdio.h>
40 #include <string.h>
41
42 /*----------------------------------------------------------------------------
43 * Local headers
44 *----------------------------------------------------------------------------*/
45
46 #include "cs_headers.h"
47
48 /*----------------------------------------------------------------------------*/
49
50 BEGIN_C_DECLS
51
52 /*----------------------------------------------------------------------------*/
53 /*!
54 * \file cs_user_performance_tuning-partition.c
55 *
56 * \brief Partitioning option setting example.
57 *
58 * See \ref cs_user_performance_tuning for examples.
59 */
60 /*----------------------------------------------------------------------------*/
61
62 /*============================================================================
63 * User function definitions
64 *============================================================================*/
65
66 /*----------------------------------------------------------------------------*/
67 /*!
68 * \brief Define advanced partitioning options.
69 */
70 /*----------------------------------------------------------------------------*/
71
72 void
cs_user_partition(void)73 cs_user_partition(void)
74 {
75 /*! [performance_tuning_partition_1] */
76 {
77 /* Example:
78
79 Force PT-SCOTCH or SCOTCH for preprocessing partitioning,
80 and Hilbert SFC for main partitioning;
81
82 Available algorithms (subject to build with external libraries for
83 SCOTCH and METIS) are:
84
85 CS_PARTITION_DEFAULT Default partitioning, based on stage
86 CS_PARTITION_SFC_MORTON_BOX Morton (Z) curve in bounding box
87 CS_PARTITION_SFC_MORTON_CUBE Morton (Z) curve in bounding cube
88 CS_PARTITION_SFC_HILBERT_BOX Peano-Hilbert curve in bounding box
89 CS_PARTITION_SFC_HILBERT_CUBE Peano-Hilbert curve in bounding cube
90 CS_PARTITION_SCOTCH PT-SCOTCH or SCOTCH
91 CS_PARTITION_METIS ParMETIS or METIS
92 CS_PARTITION_BLOCK Unoptimized (naive) block partitioning */
93
94 cs_partition_set_algorithm(CS_PARTITION_FOR_PREPROCESS,
95 CS_PARTITION_SCOTCH,
96 1, /* rank_step */
97 false); /* ignore periodicity in graph */
98 cs_partition_set_algorithm(CS_PARTITION_MAIN,
99 CS_PARTITION_SFC_HILBERT_BOX,
100 1, /* rank_step */
101 false); /* ignore periodicity in graph */
102
103 }
104 /*! [performance_tuning_partition_1] */
105
106 /*! [performance_tuning_partition_2] */
107 {
108 /* Example: set partitioning write to file option.
109 *
110 * value of write flag: 0: never
111 * 1: for graph-based partitioning only (default)
112 * 2: always */
113
114 cs_partition_set_write_level(0);
115
116 }
117 /*! [performance_tuning_partition_2] */
118
119
120 /*! [performance_tuning_partition_3] */
121 {
122 /* Example: force activation/deactivation of initial partitioning
123 * for preprocessing. */
124
125 cs_partition_set_preprocess(false);
126 }
127 /*! [performance_tuning_partition_3] */
128
129
130 /*! [performance_tuning_partition_4] */
131 {
132 /* Example: define list of extra partitionings to build.
133 *
134 * Partitionings in this list will be output to file, and may be used for
135 * subsequent calculations.
136 *
137 * When partitioning for both preprocessing and calculation stages, output to
138 * file of partioning data or generation of additional partitionings
139 * (see \ref cs_partition_add_partitions) will only be done for the
140 * second stage. */
141
142 int n_extra_partitions = 3;
143 int extra_partitions_list[] = {12, 24, 48};
144 cs_partition_add_partitions(n_extra_partitions, extra_partitions_list);
145 }
146 /*! [performance_tuning_partition_4] */
147
148 }
149
150 /*----------------------------------------------------------------------------*/
151
152 END_C_DECLS
153