diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index 487488f77dd59..0cfc299fb07e0 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -144,7 +144,19 @@ download @everywhere Execute an expression on all processes. Errors on any of the processes are collected into a -`CompositeException` and thrown. +`CompositeException` and thrown. For example : + + @everywhere bar=1 + +will define `bar` under module `Main` on all processes. + +Unlike `@spawn` and `@spawnat`, `@everywhere` does not capture any local variables. Prefixing +`@everywhere` with `@eval` allows us to broadcast local variables using interpolation : + + foo = 1 + @eval @everywhere bar=\$foo + + """ :@everywhere diff --git a/doc/stdlib/parallel.rst b/doc/stdlib/parallel.rst index 27c1cd9c8cc25..39c4b21660dd9 100644 --- a/doc/stdlib/parallel.rst +++ b/doc/stdlib/parallel.rst @@ -502,7 +502,20 @@ General Parallel Computing Support .. Docstring generated from Julia source - Execute an expression on all processes. Errors on any of the processes are collected into a ``CompositeException`` and thrown. + Execute an expression on all processes. Errors on any of the processes are collected into a ``CompositeException`` and thrown. For example : + + .. code-block:: julia + + @everywhere bar=1 + + will define ``bar`` under module ``Main`` on all processes. + + Unlike ``@spawn`` and ``@spawnat``\ , ``@everywhere`` does not capture any local variables. Prefixing ``@everywhere`` with ``@eval`` allows us to broadcast local variables using interpolation : + + .. code-block:: julia + + foo = 1 + @eval @everywhere bar=$foo .. function:: Base.remoteref_id(r::AbstractRemoteRef) -> (whence, id)