Module Rpc_parallel__.Map_reduce
module Config : sig ... endmodule type Worker = sig ... endMap functions
module type Map_function = sig ... endmodule type Map_function_with_init_spec = sig ... endmodule Make_map_function_with_init : functor (S : Map_function_with_init_spec) -> Map_function with type Param.t = S.Param.t and type Input.t = S.Input.t and type Output.t = S.Output.tmodule type Map_function_spec = sig ... endmodule Make_map_function : functor (S : Map_function_spec) -> Map_function with type Param.t = unit and type Input.t = S.Input.t and type Output.t = S.Output.tval map_unordered : Config.t -> 'a Async.Pipe.Reader.t -> m:(module Map_function with type Input.t = 'a and type Output.t = 'b and type Param.t = 'param) -> param:'param -> ('b * int) Async.Pipe.Reader.t Async.Deferred.tThe
map_unorderedoperation takes'a Pipe.Reader.talong with aMap_functionand sends the'avalues to workers for mapping. Each pair in the resulting('b * int) Pipe.Reader.tcontains the mapped value and the index of the value in the input pipe.
val map : Config.t -> 'a Async.Pipe.Reader.t -> m:(module Map_function with type Input.t = 'a and type Output.t = 'b and type Param.t = 'param) -> param:'param -> 'b Async.Pipe.Reader.t Async.Deferred.tThe
mapoperation is similar tomap_unordered, but the result is a'b Pipe.Reader.twhere the mapped values are guaranteed to be in the same order as the input values.
val find_map : Config.t -> 'a Async.Pipe.Reader.t -> m:(module Map_function with type Input.t = 'a and type Output.t = 'b option and type Param.t = 'param) -> param:'param -> 'b option Async.Deferred.tThe
find_mapoperation takes'a Pipe.Reader.talong with aMap_functionthat returns'b optionvalues. As soon asmapreturnsSome value, all workers are stopped andSome valueis returned. Ifmapnever returnsSome valuethenNoneis returned. If more than one worker returnsSome value, one value is chosen arbitrarily and returned.
Map-reduce
functions
module type Map_reduce_function = sig ... endmodule type Map_reduce_function_with_init_spec = sig ... endmodule Make_map_reduce_function_with_init : functor (S : Map_reduce_function_with_init_spec) -> Map_reduce_function with type Param.t = S.Param.t and type Accum.t = S.Accum.t and type Input.t = S.Input.tmodule type Map_reduce_function_spec = sig ... endmodule Make_map_reduce_function : functor (S : Map_reduce_function_spec) -> Map_reduce_function with type Param.t = unit and type Accum.t = S.Accum.t and type Input.t = S.Input.tval map_reduce_commutative : Config.t -> 'a Async.Pipe.Reader.t -> m:(module Map_reduce_function with type Accum.t = 'accum and type Input.t = 'a and type Param.t = 'param) -> param:'param -> 'accum option Async.Deferred.tThe
map_reduce_commutativeoperation takes'a Pipe.Reader.talong with aMap_reduce_functionand applies themapfunction to'avalues (in an unspecified order), resulting in'accumvalues. Thecombinefunction is then called to combine the'accumvalues (in an unspecified order) into a single'accumvalue. Commutative map-reduce assumes thatcombineis associative and commutative.
val map_reduce : Config.t -> 'a Async.Pipe.Reader.t -> m:(module Map_reduce_function with type Accum.t = 'accum and type Input.t = 'a and type Param.t = 'param) -> param:'param -> 'accum option Async.Deferred.tThe
map_reduceoperation makes strong guarantees about the order in which the values are processed bycombine. For a list a_0, a_1, a_2, ..., a_n of'avalues, the noncommutative map-reduce operation applies themapfunction to produceacc_{i,i+1}from eacha_i. Thecombinefunction is used to computecombine acc_{i,j} acc_{j,k}for i<j<k, producingacc_{i,k}. Themapandcombinefunctions are called repeatedly until the entire list is reduced to a singleacc_{0,n+1}value. Noncommutative map-reduce assumes thatcombineis associative.