File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ depends: [
2525 "stdio"
2626 "num"
2727 "saturn_lockfree"
28+ "poll"
2829 "ppxlib"
2930 "ppx_jane"
3031 "ppx_expect"
Original file line number Diff line number Diff line change 1212 ctypes
1313 ctypes.foreign
1414 saturn_lockfree
15+ poll
1516 (select
1617 gcc_backend.ml
1718 from
Original file line number Diff line number Diff line change @@ -556,6 +556,18 @@ type waiter = {
556556}
557557(* * Note: this waiter is meant for sequential waiting. *)
558558
559+ let poll pipe_inp =
560+ let poll = Poll. create () in
561+ Poll. set poll pipe_inp Poll.Event. read;
562+ let rec wait () =
563+ Poll. clear poll;
564+ match Poll. wait poll (Poll.Timeout. after 10_000_000L ) with
565+ | `Timeout -> ()
566+ | `Ok -> ()
567+ | exception Unix. Unix_error (Unix. EINTR, _ , _ ) -> wait ()
568+ in
569+ wait
570+
559571let waiter ~name () =
560572 let is_open = Atomic. make true in
561573 (* TODO: since OCaml 5.2, consider [make_contended]? *)
@@ -564,6 +576,7 @@ let waiter ~name () =
564576 let pipe_inp, pipe_out =
565577 try Unix. pipe ~cloexec: true () with e -> Exn. reraise e @@ " waiter " ^ name ^ " : Unix.pipe"
566578 in
579+ let poll = poll pipe_inp in
567580 let await ~keep_waiting =
568581 let % track_l_sexp rec wait () : bool =
569582 if Atomic. compare_and_set is_released true false then (
@@ -574,10 +587,7 @@ let waiter ~name () =
574587 assert (n = 1 );
575588 true )
576589 else if keep_waiting () then
577- let _, _, _ =
578- try Unix. select [ pipe_inp ] [] [] 5.0
579- with e -> Exn. reraise e @@ " waiter " ^ name ^ " : Unix.select"
580- in
590+ let () = try poll () with e -> Exn. reraise e @@ " waiter " ^ name ^ " : poll error" in
581591 wait ()
582592 else false
583593 in
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ let cuda_benchmarks =
171171 List. concat_map [ 1 ; 3 ; 6 ; 12 (* ; 16; 32; 64 *) ] ~f: (fun num_devices ->
172172 List. concat_map [ 64 ; 128 (* ; 256 *) ] ~f: (fun batch_size ->
173173 List. concat_map [ 0 ; 1 (* ; 2; 3; 4 *) ] ~f: (fun seed ->
174- List. concat_map [ (* "gccjit" ; *) " cc" ; " cuda" ] ~f: (fun backend_name ->
174+ List. concat_map [ (* "gccjit" ; *) " pipes_cc " (* ; " cc"; "cuda" *) ] ~f: (fun backend_name ->
175175 [
176176 classify_moons ~seed ~on_device: true ~inlining_cutoff ~num_devices
177177 ~batch_size ~backend_name ~value_prec: CDSL. single ~grad_prec: CDSL. single;
Original file line number Diff line number Diff line change 6666 stdio
6767 num
6868 saturn_lockfree
69+ poll
6970 ppxlib
7071 ppx_jane
7172 ppx_expect
You can’t perform that action at this time.
0 commit comments