Skip to content

Commit df6a588

Browse files
Clarify slab decomposition and optional arguments (#7)
* Clarify slab decomposition and optional arguments * Minor update * Minor update * Typo * Minor update * Minor update * Update api_domain.rst * Update api_domain.rst * Update api_domain.rst * Update api_domain.rst * Replace \times -> x Doesn't seem to be supported by github markdown... --------- Co-authored-by: Paul Bartholomew <[email protected]>
1 parent caf8391 commit df6a588

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

docs/source/pages/api_domain.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,33 @@ using the following call
146146
call decomp_2d_init(nx, ny, nz, p_row, p_col)
147147

148148
where ``nx``, ``ny`` and ``nz`` are the size of 3D global data to be distributed over
149-
a 2D processor grid :math:`p_row \times p_col`.
149+
a 2D processor grid ``p_row x p_col``.
150150
Note that none of the dimensions need to be divisible by ``p_row`` or ``p_col``, i.e. the library can handle non-evenly distributed data.
151151
In case of ``p_row=p_col=0`` an automatic decomposition is selected among all possible combination available.
152152
The algorithm will choose the closest combination such as
153153

154-
.. math::
154+
$$ n\_{row} = n\_{col} = {nproc}^{1/2} $$
155155

156-
n\_proc=n\_col=\sqrt{nproc}
157-
158-
In case the root is not exact the closest combitation to have :math:`n\_proc \approx n\_col` with
159-
`n\_proc < n\_col` is used.
156+
In case the root is not exact the closest combination to $n_{row} = n_{col}$ with $n_{row} < n_{col}$ is used.
157+
If a 1D slab decomposition is needed instead of a 2D pencil one, it is recommended to set ``p_row`` to unity and ``p_col`` to ``nproc``.
160158

161159
An optional parameter may be passed to this initialisation routine:
162160

163161
::
164162

165-
call decomp_2d_init(nx, ny, nz, p_row, p_col,periodic_bc)
163+
call decomp_2d_init(nx, ny, nz, p_row, p_col, periodic_bc)
166164
167-
Here periodic_bc is a 1D array containing 3 logical values that specify whether periodic boundary condition
165+
Here ``periodic_bc`` is a 1D array containing 3 logical values that specify whether periodic boundary condition
168166
should apply in certain dimensions. Note this is only applicable if halo-cell communication is to be used.
169167

168+
Another optional parameter may be passed at the initialization stage:
169+
170+
::
171+
172+
call decomp_2d_init(nx, ny, nz, p_row, p_col, periodic_bc, comm)
173+
174+
Here ``comm`` is the MPI communicator that the library will use. By default, MPI_COMM_WORLD is used.
175+
170176
A key element of this library is a set of communication routines that actually perform the data transpositions.
171177
As mentioned, one needs to perform 4 global transpositions to go through all 3 pencil orientations.
172178
Correspondingly, the library provides 4 communication subroutines:
@@ -227,7 +233,7 @@ different data sets as 2D pencils.
227233
call decomp_info_init(n1, n2, n3, new_decomp)
228234

229235
Here decomp is an instance of Fortran derived data type DECOMP_INFO encapsulating
230-
the 2D decomposition information associated with one particular global size :math:`n1\times n2 \times n3`.
236+
the 2D decomposition information associated with one particular global size ``n1 x n2 x n3``.
231237
The decomposition object can be initialised using the ``decomp_info_init`` routine as:
232238

233239
::

0 commit comments

Comments
 (0)