You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/darray.md
+26-28Lines changed: 26 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,8 +211,6 @@ across the workers in the Julia cluster in a relatively even distribution;
211
211
future operations on a `DArray` may produce a different distribution from the
212
212
one chosen by previous calls.
213
213
214
-
<!---->
215
-
216
214
### Explicit Processor Mapping of DArray Blocks
217
215
218
216
This feature allows you to control how `DArray` blocks (chunks) are assigned to specific processors within the cluster. Controlling data locality is crucial for optimizing the performance of distributed algorithms.
@@ -227,31 +225,33 @@ The `assignment` argument accepts the following values:
227
225
228
226
*`:blockrow`:
229
227
230
-
* Divides the matrix blocks row-wise (vertically in the terminal). Each processor gets a contiguous chunk of row blocks.
228
+
* Divides the matrix blocks row-wise (vertically in the terminal). Each processor gets a contiguous chunk of row blocks.
231
229
232
230
*`:blockcol`:
233
231
234
232
* Divides the matrix blocks column-wise (horizontally in the terminal). Each processor gets a contiguous chunk of column blocks.
235
233
236
234
*`:cyclicrow`:
235
+
237
236
* Assigns row-blocks to processors in a round-robin fashion. Blocks are distributed one row-block at a time. Useful for parallel row-wise tasks.
238
237
239
238
*`:cycliccol`:
239
+
240
240
* Assigns column-blocks to processors in a round-robin fashion. Blocks are distributed one column-block at a time. Useful for parallel column-wise tasks.
241
241
242
242
* Any other symbol used for `assignment` results in an error.
243
243
244
244
*`AbstractArray{<:Int, N}`:
245
245
246
246
* Provide an integer **N**-dimensional array of worker IDs. The dimension **N** must match the number of dimensions of the `DArray`.
247
-
* Dagger maps blocks to worker IDs in a block-cyclic manner according to this processor-array. The block at index `(i,j,...)` is assigned to the first thread of the processor with ID `assignment[mod1(i, size(assignment,1)), mod1(j, size(assignment,2)), ...]`. This pattern repeats block-cyclically across all dimensions.
247
+
* Dagger maps blocks to worker IDs in a block-cyclic manner according to this processor-array. The block at index `(i,j,...)` is assigned to the first CPU thread of the worker with ID `assignment[mod1(i, size(assignment,1)), mod1(j, size(assignment,2)), ...]`. This pattern repeats block-cyclically across all dimensions.
248
248
249
249
*`AbstractArray{<:Processor, N}`:
250
250
251
251
* Provide an **N**-dimensional array of `Processor` objects. The dimension **N** must match the number of dimensions of the `DArray` blocks.
252
252
* Blocks are mapped in a block-cyclic manner according to the `Processor` objects in the assignment array. The block at index `(i,j,...)` is assigned to the processor at `assignment[mod1(i, size(assignment,1)), mod1(j, size(assignment,2)), ...]`. This pattern repeats block-cyclically across all dimensions.
253
253
254
-
#### Examples and Usage
254
+
#### Examples and Usage
255
255
256
256
The `assignment` argument works similarly for `DArray`, `DVector`, and `DMatrix`, as well as the `distribute` function. The key difference lies in the dimensionality of the resulting distributed array. For functions like `rand`, `randn`, `sprand`, `ones`, and `zeros`, `assignment` is an keyword argument.
257
257
@@ -261,11 +261,11 @@ The `assignment` argument works similarly for `DArray`, `DVector`, and `DMatrix`
261
261
262
262
*`DMatrix`: Specifically for 2-dimensional distributed arrays.
263
263
264
-
*`distribute`: General function to distribute arrays.
264
+
*`distribute`: General function to distribute arrays of any dimensionality.
265
265
266
266
*`rand`, `randn`, `sprand`, `ones`, `zeros`: Functions to create DArrays with initial values, also supporting `assignment`.
267
267
268
-
Here are some examples using a setup with one master processor and three worker processors.
268
+
Here are some examples using a setup with one master process and three worker processes.
269
269
270
270
First, let's create some sample arrays for `distribute` (and constructor functions):
271
271
@@ -281,10 +281,10 @@ M = zeros(5, 5, 5) # 3D array
The assignment is a integer matrix of `Processor` ID’s, the blocks are assigned in block-cyclic manner to first thread `Processor` ID’s. The assignment for`Ad` (and `Rd`) would be
422
+
The assignment is an integer matrix of worker IDs, the blocks are assigned in block-cyclic manner to the first CPU thread of each worker. The assignment for`Ad` (and `Rd`) would be:
423
423
424
424
```julia
425
425
4×6 Matrix{Dagger.ThreadProc}:
@@ -434,22 +434,22 @@ M = zeros(5, 5, 5) # 3D array
The assignment is a matrix of `Processor` objects, the blocks are assigned in block-cyclic manner to `Processor` objects. The assignment for`Ad` (and `Rd`) would be:
452
+
The assignment is a matrix of `Processor` objects, the blocks are assigned in block-cyclic manner to each processor. The assignment for`Ad` (and `Rd`) would be:
0 commit comments