Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document use of @eval with @everywhere for broadcast of local variables. #15960

Merged
merged 1 commit into from
Apr 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 14 additions & 1 deletion doc/stdlib/parallel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down