Skip to content

Commit 0a96893

Browse files
authored
Merge pull request #7 from christinerose/edit_readme
initial suggestions for ReadMe
2 parents 1179f3e + 9deb289 commit 0a96893

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
# OCaml 5 Tutorial
22

33
A hands-on tutorial on the new parallelism features in OCaml 5. This tutorial
4-
was run on 19th May 2022.
4+
was run on the 19th of May 2022 at the [Tarides retreat](https://tarides.com/blog/2022-06-23-team-tarides-visits-a-17th-century-chateau). Currently, the alpha version of OCaml 5 has been released, and the full version is set for release in September 2022.
55

66
## Installation
77

8-
This tutorial works on x86-64 and Arm64 architectures on Linux and macOS.
8+
This tutorial works on x86-64 and Arm64 architectures on Linux and macOS.
99

10-
With `opam` version >= 2.1:
10+
Before we move on to the instructions, check your version of opam with `opam --version`, then follow the instructions below for your version. You can also quickly update to the latest version of opam (currently 2.1.2) by running:
11+
12+
```
13+
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
14+
```
15+
16+
With opam version >= 2.1:
1117

1218
```bash
1319
opam update
14-
opam switch create 5.0.0+trunk --repo=default,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git
20+
opam switch create 5.0.0~alpha0 --repo=default,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git
1521
opam install . --deps-only
22+
eval $(opam env)
1623
```
1724

18-
with `opam` version < 2.1:
25+
with opam version < 2.1:
1926

2027
```bash
2128
opam update
22-
opam switch create 5.0.0+trunk --repo=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git
29+
opam switch create 5.0.0~alpha0 --repo=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git
2330
opam install . --deps-only
31+
eval $(opam env)
2432
```
2533

2634
Since we will be doing performance measurements, it is recommended that you also
27-
install [`hyperfine`](https://github.com/sharkdp/hyperfine).
35+
install [`hyperfine`](https://github.com/sharkdp/hyperfine).
2836

2937
## Domains for Parallelism
3038

31-
### Concurrency vs Parallelism
39+
### Concurrency vs. Parallelism
3240

3341
OCaml 5 distinguishes concurrency and parallelism. Concurrency is **overlapped**
3442
execution of concurrent tasks. Parallelism is **simultaneous** execution of
@@ -39,7 +47,7 @@ parallelism.
3947

4048
We will focus on the parallelism features in this tutorial.
4149

42-
### Programming with domains
50+
### Programming with Domains
4351

4452
Domains are units of parallel computation. New domains can be spawned using
4553
`Domain.spawn` primitive:
@@ -53,14 +61,18 @@ I ran in parallel
5361
- : unit Domain.t = <abstr>
5462
```
5563
64+
Use `Ctrl+D` to exit.
65+
66+
(If you get the error "Cannot find file topfind," run `opam install ocamlfind`, part of the `findlib` package.)
67+
5668
The same example is also in [src/par.ml](src/par.ml):
5769
5870
```bash
5971
$ cat src/par.ml
6072
Domain.spawn (fun _ -> print_endline "I ran in parallel")
6173
```
6274
63-
The dune command compiles the native version of the above program and runs it:
75+
The `dune` command compiles the native version of the above program and runs it:
6476
6577
```bash
6678
$ dune exec src/par.exe
@@ -139,7 +151,7 @@ Benchmark 1: dune exec src/fib_twice.exe 40
139151
You can see that computing the nth Fibonacci number twice almost took the same
140152
time as computing it once thanks to parallelism.
141153
142-
### Nature of domains
154+
### Nature of Domains
143155
144156
Domains are heavy-weight entities. Each domain directly maps to an operating
145157
system thread. Hence, they are relatively expensive to create and tear down.

0 commit comments

Comments
 (0)