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

simon/move to picos #30

Merged
merged 54 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f1ff17d
feat: depend on picos, use picos.exn_bt
c-cube Aug 26, 2024
dd60666
refactor: remove dla
c-cube Aug 26, 2024
465919a
non optional dependency on thread-local-storage
c-cube Aug 26, 2024
f93248a
wip: use picos computations
c-cube Aug 26, 2024
5cdda79
disable t_fib1 test, way too flaky
c-cube Aug 1, 2024
b9c3e1f
feat `fut`: wrap picos computations
c-cube Aug 27, 2024
2780b15
detail in fut
c-cube Aug 27, 2024
c733956
gitignore
c-cube Aug 28, 2024
9fb23be
refactor core: use picos for schedulers; add Worker_loop_
c-cube Aug 28, 2024
6b81d1f
github actions
c-cube Aug 28, 2024
e1105f4
feat fut: add `on_result_ignore`
c-cube Aug 28, 2024
a0068b0
details
c-cube Aug 28, 2024
07a7fc3
wip: port to picos
c-cube Aug 28, 2024
6e05b92
test: wip porting tests
c-cube Aug 28, 2024
b0e4fa4
fix fut: trigger failing to attach doesn't signal it
c-cube Aug 29, 2024
a36342d
fix pool: only return No_more_tasks when local and global q empty
c-cube Aug 29, 2024
31bc5be
format
c-cube Aug 29, 2024
914bf9f
chore: fix CI by installing picos first
c-cube Aug 29, 2024
10f77d2
more CI
c-cube Aug 29, 2024
993ee3a
test: re-enable t_fib1 but with a single core fifo pool
c-cube Aug 29, 2024
21f3447
fixes after reviews
c-cube Aug 29, 2024
40ed8f3
bump minimal OCaml version to 4.13
c-cube Aug 29, 2024
8712fc5
use `exn_bt`, not `picos.exn_bt`
c-cube Aug 29, 2024
e53986d
feat: optional dep on hmap, for inheritable FLS data
c-cube Aug 29, 2024
cdb80c8
format
c-cube Aug 29, 2024
24a8a85
chore: depend on picos explicitly
c-cube Aug 29, 2024
44e335e
feat: move hmap-fls to Fiber.Fls
c-cube Aug 29, 2024
328ecf4
change API for local FLS hmap
c-cube Aug 29, 2024
7df8c06
refactor: move optional hmap FLS stuff into core/task_local_storage
c-cube Aug 30, 2024
0545a39
add Task_local_storage.remove_in_local_hmap
c-cube Aug 30, 2024
5463a1a
chore: try to fix CI
c-cube Aug 30, 2024
5d731a9
format
c-cube Aug 30, 2024
fb8b612
chore: CI
c-cube Aug 30, 2024
940ab83
fix
c-cube Aug 30, 2024
164440f
feat: add `Fls.with_in_local_hmap`
c-cube Aug 30, 2024
c03949d
chore: depend on hmap for tests
c-cube Aug 30, 2024
0da3ce4
fix test for FLS
c-cube Aug 30, 2024
b81ab9f
chore: CI
c-cube Aug 30, 2024
83f0355
require OCaml 4.14 :/
c-cube Aug 30, 2024
704ebda
feat: add `moonpool.sync` with await-friendly abstractions
c-cube Aug 30, 2024
3193a25
fix: catch TLS.Not_set
c-cube Aug 30, 2024
76a881e
fix: `LS.get` shouldn't raise
c-cube Aug 30, 2024
12978d4
fix
c-cube Aug 30, 2024
3df7c8b
update to merged picos PR
c-cube Sep 3, 2024
0b84154
chore: CI
c-cube Sep 3, 2024
8582f6f
fix dep
c-cube Sep 3, 2024
ec5ac64
feat: add `Event.of_fut`
c-cube Sep 3, 2024
6eccc46
chore: CI
c-cube Sep 3, 2024
a131448
remove dep on now defunct `exn_bt`
c-cube Sep 3, 2024
d16ae86
feat: add moonpool-io
c-cube Sep 3, 2024
dc4e5cf
chore: CI
c-cube Sep 3, 2024
070f283
version constraint on moonpool-io
c-cube Sep 3, 2024
fd89c81
add Event.Infix
c-cube Sep 4, 2024
09b5a34
move to picos_io
c-cube Sep 4, 2024
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
9 changes: 5 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ jobs:
dune-cache: true
allow-prerelease-opam: true

- name: Deps
run: opam install odig moonpool moonpool-lwt
# temporary until it's in a release
- run: opam pin https://github.com/ocaml-multicore/picos.git -y -n

- name: Build
run: opam exec -- odig odoc --cache-dir=_doc/ moonpool moonpool-lwt
- run: opam install odig moonpool moonpool-lwt moonpool-io

- run: opam exec -- odig odoc --cache-dir=_doc/ moonpool moonpool-lwt

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
os:
- ubuntu-latest
ocaml-compiler:
- '4.08'
- '4.14'
- '5.2'

Expand All @@ -30,14 +29,17 @@ jobs:
dune-cache: true
allow-prerelease-opam: true

- run: opam install -t moonpool moonpool-lwt --deps-only
# temporary until it's in a release
- run: opam pin https://github.com/ocaml-multicore/picos.git -y -n

- run: opam install -t moonpool moonpool-lwt moonpool-io --deps-only
if: matrix.ocaml-compiler == '5.2'
- run: opam install -t moonpool --deps-only
if: matrix.ocaml-compiler != '5.2'
- run: opam exec -- dune build @install

# install some depopts
- run: opam install thread-local-storage trace domain-local-await
- run: opam install thread-local-storage trace hmap
if: matrix.ocaml-compiler == '5.2'

- run: opam exec -- dune build --profile=release --force @install @runtest
Expand All @@ -63,7 +65,10 @@ jobs:
dune-cache: true
allow-prerelease-opam: true

- run: opam install -t moonpool moonpool-lwt --deps-only
# temporary until it's in a release
- run: opam pin https://github.com/ocaml-multicore/picos.git -y -n

- run: opam install -t moonpool moonpool-lwt moonpool-io --deps-only
- run: opam exec -- dune build @install
# install some depopts
- run: opam install thread-local-storage trace domain-local-await
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build
_opam
*.tmp
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ clean:
test:
@dune runtest $(DUNE_OPTS)

test-autopromote:
@dune runtest $(DUNE_OPTS) --auto-promote

doc:
@dune build $(DUNE_OPTS) @doc

Expand Down
24 changes: 20 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@
(name moonpool)
(synopsis "Pools of threads supported by a pool of domains")
(depends
(ocaml (>= 4.08))
(ocaml (>= 4.14))
dune
(either (>= 1.0))
(trace :with-test)
(trace-tef :with-test)
(qcheck-core (and :with-test (>= 0.19)))
(thread-local-storage (and (>= 0.2) (< 0.3)))
(odoc :with-doc)
(hmap :with-test)
(picos (and (>= 0.5) (< 0.6)))
(picos_std (and (>= 0.5) (< 0.6)))
(mdx
(and
(>= 1.9.0)
:with-test)))
(depopts
(trace (>= 0.6))
thread-local-storage)
(conflicts (thread-local-storage (< 0.2)))
hmap
(trace (>= 0.6)))
(tags
(thread pool domain futures fork-join)))

Expand All @@ -47,4 +50,17 @@
(trace-tef :with-test)
(odoc :with-doc)))

(package
(name moonpool-io)
(synopsis "Async IO for moonpool, relying on picos")
(allow_empty) ; on < 5.0
(depends
(moonpool (= :version))
(picos_io (and (>= 0.5) (< 0.6)))
(ocaml (>= 5.0))
(trace :with-test)
(trace-tef :with-test)
(odoc :with-doc)))


; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
33 changes: 33 additions & 0 deletions moonpool-io.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.6"
synopsis: "Async IO for moonpool, relying on picos"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]
license: "MIT"
homepage: "https://github.com/c-cube/moonpool"
bug-reports: "https://github.com/c-cube/moonpool/issues"
depends: [
"dune" {>= "3.0"}
"moonpool" {= version}
"picos_io" {>= "0.5" & < "0.6"}
"ocaml" {>= "5.0"}
"trace" {with-test}
"trace-tef" {with-test}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/c-cube/moonpool.git"
11 changes: 6 additions & 5 deletions moonpool.opam
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ tags: ["thread" "pool" "domain" "futures" "fork-join"]
homepage: "https://github.com/c-cube/moonpool"
bug-reports: "https://github.com/c-cube/moonpool/issues"
depends: [
"ocaml" {>= "4.08"}
"ocaml" {>= "4.14"}
"dune" {>= "3.0"}
"either" {>= "1.0"}
"trace" {with-test}
"trace-tef" {with-test}
"qcheck-core" {with-test & >= "0.19"}
"thread-local-storage" {>= "0.2" & < "0.3"}
c-cube marked this conversation as resolved.
Show resolved Hide resolved
"odoc" {with-doc}
"hmap" {with-test}
"picos" {>= "0.5" & < "0.6"}
"picos_std" {>= "0.5" & < "0.6"}
"mdx" {>= "1.9.0" & with-test}
]
depopts: [
"hmap"
"trace" {>= "0.6"}
"thread-local-storage"
]
conflicts: [
"thread-local-storage" {< "0.2"}
]
build: [
["dune" "subst"] {dev}
Expand Down
13 changes: 11 additions & 2 deletions src/core/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
(library
(public_name moonpool)
(name moonpool)
(libraries moonpool.private moonpool.dpool)
(libraries
moonpool.private
(re_export thread-local-storage)
c-cube marked this conversation as resolved.
Show resolved Hide resolved
(select
hmap_ls_.ml
from
(hmap -> hmap_ls_.real.ml)
(-> hmap_ls_.dummy.ml))
moonpool.dpool
(re_export picos))
(flags :standard -open Moonpool_private)
(private_modules types_ util_pool_)
(private_modules util_pool_)
(preprocess
(action
(run %{project_root}/src/cpp/cpp.exe %{input-file}))))
11 changes: 7 additions & 4 deletions src/core/exn_bt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ type t = exn * Printexc.raw_backtrace
let[@inline] make exn bt : t = exn, bt
let[@inline] exn (e, _) = e
let[@inline] bt (_, bt) = bt
let show self = Printexc.to_string (exn self)
let pp out self = Format.pp_print_string out (show self)
let[@inline] raise (e, bt) = Printexc.raise_with_backtrace e bt

let[@inline] get exn =
let bt = Printexc.get_raw_backtrace () in
Expand All @@ -12,8 +15,8 @@ let[@inline] get_callstack n exn =
let bt = Printexc.get_callstack n in
make exn bt

let show self = Printexc.to_string (fst self)
let pp out self = Format.pp_print_string out (show self)
let[@inline] raise self = Printexc.raise_with_backtrace (exn self) (bt self)

type nonrec 'a result = ('a, t) result

let[@inline] unwrap = function
| Ok x -> x
| Error ebt -> raise ebt
20 changes: 11 additions & 9 deletions src/core/exn_bt.mli
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
(** Exception with backtrace.

Type changed @since NEXT_RELEASE

@since 0.6 *)

type t = exn * Printexc.raw_backtrace
(** An exception bundled with a backtrace *)

type t = exn * Printexc.raw_backtrace

val exn : t -> exn
val bt : t -> Printexc.raw_backtrace

val make : exn -> Printexc.raw_backtrace -> t
(** Trivial builder *)

val raise : t -> 'a
val get : exn -> t
(** [get exn] is [make exn (get_raw_backtrace ())] *)

val get_callstack : int -> exn -> t

val raise : t -> 'a
(** Raise the exception with its save backtrace *)
val make : exn -> Printexc.raw_backtrace -> t
(** Trivial builder *)

val show : t -> string
(** Simple printing *)

val pp : Format.formatter -> t -> unit

type nonrec 'a result = ('a, t) result

val unwrap : 'a result -> 'a
(** [unwrap (Ok x)] is [x], [unwrap (Error ebt)] re-raises [ebt].
@since NEXT_RELEASE *)
Loading