Skip to content

Commit 1042275

Browse files
authored
Merge pull request #418 from pszufe/doc-update-2loop
Update Dagger README and docs with a use case sceanario
2 parents 5bbb9d1 + 65bcc6f commit 1042275

File tree

5 files changed

+228
-80
lines changed

5 files changed

+228
-80
lines changed

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,54 @@ At the core of Dagger.jl is a scheduler heavily inspired by [Dask](https://docs.
1919

2020
## Installation
2121

22-
Dagger.jl can be installed using the Julia package manager. Enter the Pkg REPL mode by typing "]" in the Julia REPL and then run:
22+
Dagger.jl can be installed using the Julia package manager. Enter the Pkg REPL
23+
mode by typing "]" in the Julia REPL and then run:
2324

2425
```julia
2526
pkg> add Dagger
2627
```
27-
Or, equivalently, via the Pkg API:
28+
29+
Or, equivalently, install Dagger via the Pkg API:
30+
2831
```julia
2932
julia> import Pkg; Pkg.add("Dagger")
3033
```
3134

3235
## Usage
3336

34-
Once installed, the `Dagger` package can by used like so
37+
Once installed, the `Dagger` package can be loaded with `using Dagger`, or if
38+
you want to use Dagger for distributed computing, it can be loaded as:
3539

3640
```julia
37-
using Distributed; addprocs() # get us some workers
41+
using Distributed; addprocs() # Add one Julia worker per CPU core
3842
using Dagger
43+
```
44+
45+
You can run the following example to see how Dagger exposes easy parallelism:
46+
47+
```julia
48+
# This runs first:
49+
a = Dagger.@spawn rand(100, 100)
3950

40-
# do some stuff in parallel!
41-
a = Dagger.@spawn 1+3
42-
b = Dagger.@spawn rand(a, 4)
43-
c = Dagger.@spawn sum(b)
44-
fetch(c) # some number!
51+
# These run in parallel:
52+
b = Dagger.@spawn sum(a)
53+
c = Dagger.@spawn prod(a)
54+
55+
# Finally, this runs:
56+
wait(Dagger.@spawn println("b: ", b, ", c: ", c))
4557
```
58+
59+
## Use Cases
60+
61+
Dagger can support a variety of use cases that benefit from easy, automatic
62+
parallelism, such as:
63+
64+
- [Parallelizing Nested Loops](https://juliaparallel.github.io/Dagger.jl/dev/use-cases/#Parallel-Nested-Loops)
65+
66+
This isn't an exhaustive list of the use cases that Dagger supports. There are
67+
more examples in the docs, and more use cases examples are welcome (just file
68+
an issue or PR).
69+
4670
## Contributing Guide
4771
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
4872
[![GitHub issues](https://img.shields.io/github/issues/JuliaParallel/Dagger.jl)](https://github.com/JuliaParallel/Dagger.jl/issues)

0 commit comments

Comments
 (0)