ocannl

NOTE TO POTENTIAL CONTRIBUTORS: reach out so I can adjust my work style -- start using branches for refactoring. Otherwise you face frustration as the code might be broken. Tagged versions of the code are guaranteed to work as well as the given stage of the project permitted.

NEWS: the upcoming version 0.4.0 has significant design changes around the backend API and synchronization, with Cuda streams exposed as virtual devices. Version 0.4.1 will come soon after, with tests for (and small improvements to) mixed precision computation; it will require OCaml 5.2.

OCANNL is sponsored by Ahrefs! Visit the Ahrefs website.

OCANNL -- OCaml Compiles Algorithms for Neural Networks Learning

Usage

A possible route to learning OCANNL:

  1. Get some basic grasp of the aims and design of the project by reading or skimming files in test/ and bin/.
  2. Read the syntax extensions documentation lib/syntax_extensions.md.
  3. Read the introductory part of the shape inference documentation lib/shape_inference.md.
  4. Improve your understanding by reading or skimming lib/shape.mli, lib/tensor.mli, lib/operation.ml, lib/train.ml, and (since 0.4.1) lib/nn_blocks.ml.
  5. Read arrayjit/lib/writing_a_backend.md.
  6. Read the implementation overview:

    1. Shape inference details lib/shape_inference.md.
    2. Backend-independent optimizations arrayjit/lib/lowering_and_inlining.md -- lowering means translating (compiling) from the high-level representation (as assignments) to the low-level representation.
    3. More documentation to come.

Upcoming milestones

This is very tentative.

Releases

For more details, see CHANGES.

Why not just use OWL?

OCANNL follows different design choices than OWL. For example:

Installation

Although the project is called ocannl, the main package is called neural_nets_lib, to avoid the (opam linter's) complaint that the name can be confused with other packages. This also clarifies that ocannl is composed of arrayjit and neural_nets_lib.

The dependency on ocaml-cudajit is optional, so you have to install it first to enable the Cuda backend.