Skip to content

Conversation

Kakadu
Copy link

@Kakadu Kakadu commented Jun 24, 2024

I tried to make a demo, but it never works correctly. Usually Fatal error: exception Stdlib.Queue.Empty is raised.
What should I do to get a domain level parallelism and report progress in the main thread/domain?

I mention @dinosaure because as the most active person in the repo :)

Update: It works, thanks to @dinosaure . I added a mutex to synchronize printing the output, because Format module is not domain safe. There is also an idea, that we can get the same result by using Progress.Config.v but at the moment I didn't succeeded without a mutex :)

Spoiler warning: old error output
➜  progress git:(ocaml5-buggy) ✗ OCAMLRUNPARAM=b dune exec examples/ocaml5.exe                                                                                                                         5.2+flambda
⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]    ⠋ [---⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]    ⠋ [---⠋ [-----⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]  ⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]    ⠋ [---⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]    ⠋ [---⠋ [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]    ⠋ [---[########---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]  211/4950
Fatal error: exception Stdlib.Queue.Empty
Raised at Stdlib__Queue.take in file "queue.ml", line 73, characters 11-22
✔ [########-------------------------------------------------------------------------------------------------------------------------------�-------------------------------------------------------------]  211/ 4950Called from Stdlib__Format.advance_left in file "format.ml", line 436, characters 6-31
Called from Stdlib__Format.output_acc in file "format.ml", line 1373, characters 32-48----------------------------------------------------------------------------------------------------------------]  211/4950
Called from Stdlib__Format.kfprintf.(fun) in file "format.ml", line 1420, characters 16-34
✔ [########------------------------------------------------- ----------------######-------------------------------------------------------------------------------------------------------------------------------Called from Dune__exe__Ocaml5.(fun) in file "examples/ocaml5.ml", line 26, characters 20-28
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 226, characters 24-28
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.do_task in file "lib/task.ml", line 43, characters 14-18
-�� [########------------------------------------------------- ----------------######------------------------------------------------------------------------------------------------------------------------------- ------- 211----------------------/--------49---------------------]  211/4950Re-raised at Stdlib__Effect.Deep.discontinue_with_backtrace.(fun) in file "effect.ml", line 68, characters 41-75
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 226, characters 24-28
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.do_task in file "lib/task.ml", line 43, characters 14-18
✔ [########---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]  211/495Re-raised at Stdlib__Effect.Deep.discontinue_with_backtrace.(fun) in file "effect.ml", line 68, characters 41-75
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.parallel_for.work in file "lib/task.ml", line 230, characters 6-26
Called from Domainslib__Task.do_task in file "lib/task.ml", line 43, characters 14-18
Re-raised at Domainslib__Task.run.loop in file "lib/task.ml", line 128, characters 23-57
Called from Stdlib__Fun.protect in file "fun.ml", line 34, characters 8-15
Re-raised at Stdlib__Fun.protect in file "fun.ml", line 39, characters 6-52
Called from Progress_engine__Renderer.Make.Reporters.apply_all in file "src/progress/engine/renderer.ml", line 504, characters 54-59
Called from Stdlib__Fun.protect in file "fun.ml", line 34, characters 8-15
4950Re-raised at Stdlib__Fun.protect in file "fun.ml", line 39, characters 6-52
Called from Dune__exe__Ocaml5 in file "examples/ocaml5.ml", lines 20-27, characters 2-40
✔ [########---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]  211/495 

@Kakadu Kakadu changed the title How to use it with OCaml 5? How to use it with OCaml 5? [dont merge] Jun 24, 2024
Signed-off-by: Kakadu <[email protected]>
@Kakadu Kakadu changed the title How to use it with OCaml 5? [dont merge] A demo about domain level parallelism Jun 25, 2024
@giltho giltho mentioned this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant