Skip to content

Commit dbd04d4

Browse files
tpappfredrikekre
authored andcommitted
Add a documentation stub for the Future stdlib (#31720)
* Fix Documenter error due to two Futures
1 parent 618c910 commit dbd04d4

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

doc/src/manual/parallel-computing.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ A remote reference is an object that can be used from any process to refer to an
531531
on a particular process. A remote call is a request by one process to call a certain function
532532
on certain arguments on another (possibly the same) process.
533533

534-
Remote references come in two flavors: [`Future`](@ref) and [`RemoteChannel`](@ref).
534+
Remote references come in two flavors: [`Future`](@ref Distributed.Future) and [`RemoteChannel`](@ref).
535535

536-
A remote call returns a [`Future`](@ref) to its result. Remote calls return immediately; the process
536+
A remote call returns a [`Future`](@ref Distributed.Future) to its result. Remote calls return immediately; the process
537537
that made the call proceeds to its next operation while the remote call happens somewhere else.
538-
You can wait for a remote call to finish by calling [`wait`](@ref) on the returned [`Future`](@ref),
538+
You can wait for a remote call to finish by calling [`wait`](@ref) on the returned [`Future`](@ref Distributed.Future),
539539
and you can obtain the full value of the result using [`fetch`](@ref).
540540

541541
On the other hand, [`RemoteChannel`](@ref) s are rewritable. For example, multiple processes can
@@ -615,8 +615,8 @@ on the process that owns `r`, so the [`fetch`](@ref) will be a no-op (no work is
615615
(It is worth noting that [`@spawn`](@ref) is not built-in but defined in Julia as a [macro](@ref man-macros).
616616
It is possible to define your own such constructs.)
617617

618-
An important thing to remember is that, once fetched, a [`Future`](@ref) will cache its value
619-
locally. Further [`fetch`](@ref) calls do not entail a network hop. Once all referencing [`Future`](@ref)s
618+
An important thing to remember is that, once fetched, a [`Future`](@ref Distributed.Future) will cache its value
619+
locally. Further [`fetch`](@ref) calls do not entail a network hop. Once all referencing [`Future`](@ref Distributed.Future)s
620620
have fetched, the remote stored value is deleted.
621621

622622
[`@async`](@ref) is similar to [`@spawn`](@ref), but only runs tasks on the local process. We
@@ -981,8 +981,8 @@ Here each iteration applies `f` to a randomly-chosen sample from a vector `a` sh
981981

982982
As you could see, the reduction operator can be omitted if it is not needed. In that case, the
983983
loop executes asynchronously, i.e. it spawns independent tasks on all available workers and returns
984-
an array of [`Future`](@ref) immediately without waiting for completion. The caller can wait for
985-
the [`Future`](@ref) completions at a later point by calling [`fetch`](@ref) on them, or wait
984+
an array of [`Future`](@ref Distributed.Future) immediately without waiting for completion. The caller can wait for
985+
the [`Future`](@ref Distributed.Future) completions at a later point by calling [`fetch`](@ref) on them, or wait
986986
for completion at the end of the loop by prefixing it with [`@sync`](@ref), like `@sync @distributed for`.
987987

988988
In some cases no reduction operator is needed, and we merely wish to apply a function to all integers
@@ -1008,7 +1008,7 @@ Remote references always refer to an implementation of an `AbstractChannel`.
10081008

10091009
A concrete implementation of an `AbstractChannel` (like `Channel`), is required to implement
10101010
[`put!`](@ref), [`take!`](@ref), [`fetch`](@ref), [`isready`](@ref) and [`wait`](@ref).
1011-
The remote object referred to by a [`Future`](@ref) is stored in a `Channel{Any}(1)`, i.e., a
1011+
The remote object referred to by a [`Future`](@ref Distributed.Future) is stored in a `Channel{Any}(1)`, i.e., a
10121012
`Channel` of size 1 capable of holding objects of `Any` type.
10131013

10141014
[`RemoteChannel`](@ref), which is rewritable, can point to any type and size of channels, or any
@@ -1111,9 +1111,9 @@ Objects referred to by remote references can be freed only when *all* held refer
11111111
in the cluster are deleted.
11121112

11131113
The node where the value is stored keeps track of which of the workers have a reference to it.
1114-
Every time a [`RemoteChannel`](@ref) or a (unfetched) [`Future`](@ref) is serialized to a worker,
1114+
Every time a [`RemoteChannel`](@ref) or a (unfetched) [`Future`](@ref Distributed.Future) is serialized to a worker,
11151115
the node pointed to by the reference is notified. And every time a [`RemoteChannel`](@ref) or
1116-
a (unfetched) [`Future`](@ref) is garbage collected locally, the node owning the value is again
1116+
a (unfetched) [`Future`](@ref Distributed.Future) is garbage collected locally, the node owning the value is again
11171117
notified. This is implemented in an internal cluster aware serializer. Remote references are only
11181118
valid in the context of a running cluster. Serializing and deserializing references to and from
11191119
regular `IO` objects is not supported.
@@ -1122,12 +1122,12 @@ The notifications are done via sending of "tracking" messages--an "add reference
11221122
a reference is serialized to a different process and a "delete reference" message when a reference
11231123
is locally garbage collected.
11241124

1125-
Since [`Future`](@ref)s are write-once and cached locally, the act of [`fetch`](@ref)ing a
1126-
[`Future`](@ref) also updates reference tracking information on the node owning the value.
1125+
Since [`Future`](@ref Distributed.Future)s are write-once and cached locally, the act of [`fetch`](@ref)ing a
1126+
[`Future`](@ref Distributed.Future) also updates reference tracking information on the node owning the value.
11271127

11281128
The node which owns the value frees it once all references to it are cleared.
11291129

1130-
With [`Future`](@ref)s, serializing an already fetched [`Future`](@ref) to a different node also
1130+
With [`Future`](@ref Distributed.Future)s, serializing an already fetched [`Future`](@ref Distributed.Future) to a different node also
11311131
sends the value since the original remote store may have collected the value by this time.
11321132

11331133
It is important to note that *when* an object is locally garbage collected depends on the size
@@ -1136,9 +1136,9 @@ of the object and the current memory pressure in the system.
11361136
In case of remote references, the size of the local reference object is quite small, while the
11371137
value stored on the remote node may be quite large. Since the local object may not be collected
11381138
immediately, it is a good practice to explicitly call [`finalize`](@ref) on local instances
1139-
of a [`RemoteChannel`](@ref), or on unfetched [`Future`](@ref)s. Since calling [`fetch`](@ref)
1140-
on a [`Future`](@ref) also removes its reference from the remote store, this is not required on
1141-
fetched [`Future`](@ref)s. Explicitly calling [`finalize`](@ref) results in an immediate message
1139+
of a [`RemoteChannel`](@ref), or on unfetched [`Future`](@ref Distributed.Future)s. Since calling [`fetch`](@ref)
1140+
on a [`Future`](@ref Distributed.Future) also removes its reference from the remote store, this is not required on
1141+
fetched [`Future`](@ref Distributed.Future)s. Explicitly calling [`finalize`](@ref) results in an immediate message
11421142
sent to the remote node to go ahead and remove its reference to the value.
11431143

11441144
Once finalized, a reference becomes invalid and cannot be used in any further calls.
@@ -1147,7 +1147,7 @@ Once finalized, a reference becomes invalid and cannot be used in any further ca
11471147
## Local invocations(@id man-distributed-local-invocations)
11481148

11491149
Data is necessarily copied over to the remote node for execution. This is the case for both
1150-
remotecalls and when data is stored to a[`RemoteChannel`](@ref) / [`Future`](@ref) on
1150+
remotecalls and when data is stored to a[`RemoteChannel`](@ref) / [`Future`](@ref Distributed.Future) on
11511151
a different node. As expected, this results in a copy of the serialized objects
11521152
on the remote node. However, when the destination node is the local node, i.e.
11531153
the calling process id is the same as the remote node id, it is executed

stdlib/Distributed/docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ Distributed.pmap
1818
Distributed.RemoteException
1919
Distributed.Future
2020
Distributed.RemoteChannel
21-
Distributed.fetch(::Future)
21+
Distributed.fetch(::Distributed.Future)
2222
Distributed.fetch(::RemoteChannel)
2323
Distributed.remotecall(::Any, ::Integer, ::Any...)
2424
Distributed.remotecall_wait(::Any, ::Integer, ::Any...)
2525
Distributed.remotecall_fetch(::Any, ::Integer, ::Any...)
2626
Distributed.remote_do(::Any, ::Integer, ::Any...)
2727
Distributed.put!(::RemoteChannel, ::Any...)
28-
Distributed.put!(::Future, ::Any)
28+
Distributed.put!(::Distributed.Future, ::Any)
2929
Distributed.take!(::RemoteChannel, ::Any...)
3030
Distributed.isready(::RemoteChannel, ::Any...)
31-
Distributed.isready(::Future)
31+
Distributed.isready(::Distributed.Future)
3232
Distributed.AbstractWorkerPool
3333
Distributed.WorkerPool
3434
Distributed.CachingPool

stdlib/Future/docs/src/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Future
2+
3+
The `Future` module implements future behavior of already existing functions,
4+
which will replace the current version in a future release of Julia.
5+
6+
```@meta
7+
DocTestSetup = :(using Future)
8+
```
9+
10+
```@docs
11+
Future.copy!
12+
Future.randjump
13+
```
14+
15+
```@meta
16+
DocTestSetup = nothing
17+
```

0 commit comments

Comments
 (0)