Source file owl_computation_engine.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 1 "src/base/compute/owl_computation_engine.ml"
(*
 * OWL - OCaml Scientific and Engineering Computing
 * Copyright (c) 2016-2018 Liang Wang <liang.wang@cl.cam.ac.uk>
 *)


(**
  This functor takes a device as its input, then it generates the computation
  graph module without flattening the module hierarchy.
 *)

module Make_Graph
  (Device : Owl_types_computation_device.Sig)
  = struct

  include
    Owl_computation_graph.Make (
      Owl_computation_optimiser.Make (
        Owl_computation_operator.Make (
          Owl_computation_symbol.Make (
            Owl_computation_shape.Make (
              Owl_computation_type.Make (Device)
            )
          )
        )
      )
    )

end


(**
  This functor takes an engine as its input, flattens all its embedded modules
  into the same level. Therefore the generated module has all the functions
  sit at the top level, then can be passed to other functors like Algodiff.
 *)

module Flatten
  (Engine : Owl_types_computation_engine.Sig)
  = struct

  include Engine

  include Graph

  include Optimiser

  include Operator

  include Symbol

  include Shape

  include Type

  include Device

  let number = A.number

end