From ea73e587466d23604f61b16337ba5dade1b794be Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 1 Aug 2015 04:59:08 -0500 Subject: [PATCH] Re-export localindexes [ci skip] --- base/exports.jl | 1 + doc/manual/parallel-computing.rst | 4 ++-- doc/stdlib/parallel.rst | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/base/exports.jl b/base/exports.jl index 7794fd0d5ee44..3fdef1f9f9514 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -1243,6 +1243,7 @@ export # shared arrays sdata, indexpids, + localindexes, # paths and file names abspath, diff --git a/doc/manual/parallel-computing.rst b/doc/manual/parallel-computing.rst index f58438dc2139b..0877a6e543f7c 100644 --- a/doc/manual/parallel-computing.rst +++ b/doc/manual/parallel-computing.rst @@ -509,7 +509,7 @@ Here's a brief example: 3 4 - julia> S = SharedArray(Int, (3,4), init = S -> S[Base.localindexes(S)] = myid()) + julia> S = SharedArray(Int, (3,4), init = S -> S[localindexes(S)] = myid()) 3x4 SharedArray{Int64,2}: 2 2 3 4 2 3 3 4 @@ -524,7 +524,7 @@ Here's a brief example: 2 3 3 4 2 7 4 4 -:func:`Base.localindexes` provides disjoint one-dimensional ranges of indexes, +:func:`localindexes` provides disjoint one-dimensional ranges of indexes, and is sometimes convenient for splitting up tasks among processes. You can, of course, divide the work any way you wish: diff --git a/doc/stdlib/parallel.rst b/doc/stdlib/parallel.rst index 31ec2abfb10ac..cc3a9b02c070e 100644 --- a/doc/stdlib/parallel.rst +++ b/doc/stdlib/parallel.rst @@ -383,8 +383,8 @@ General Parallel Computing Support Execute an expression on all processes. Errors on any of the processes are collected into a `CompositeException` and thrown. -Shared Arrays (Experimental, UNIX-only feature) ------------------------------------------------ +Shared Arrays +------------- .. function:: SharedArray(T::Type, dims::NTuple; init=false, pids=Int[]) @@ -412,6 +412,17 @@ Shared Arrays (Experimental, UNIX-only feature) Returns the index of the current worker into the ``pids`` vector, i.e., the list of workers mapping the SharedArray +.. function:: localindexes(S::SharedArray) + + A range describing the "default" indexes to be handled by the local + process. This range should be interpreted in the sense of linear + indexing, i.e., as a sub-range of 1:length(S). + Returns an empty range if no local part exists on the calling process. + + All indexes should be equally fast for each worker process; + ``localindexes`` exists purely as a convenience, and you can + partition work on the array among workers any way you wish. + Cluster Manager Interface ------------------------- This interface provides a mechanism to launch and manage Julia workers on different cluster environments.