An OCaml Numerical Library

Owl is an emerging numerical library for scientific computing and engineering. The library is developed in the OCaml language and inherits all its powerful features such as static type checking, powerful module system, and superior runtime efficiency. Owl allows you to write succinct type-safe numerical applications in functional language without sacrificing performance, significantly reduces the cost from prototype to production use.

Behind the scene, Owl builds the advanced numerical functions atop of its solid implementation of n-dimensional arrays. Quite different from other libraries, algorithmic differentiation and distributed computing have been included as integral components in the core library to maximise developers' productivity. Owl is young but grows fast, the current features include:

  • N-dimensional array (both dense and sparse)
  • Various number types: float32, float64, complex32, complex64, int8, int16, int32 ...
  • Linear algebra and full interface to CBLAS and LAPACKE
  • Algorithmic differentiation (or automatic differentiation)
  • Neural network module for deep learning applications
  • Dynamic computational graph allowing greatest flexibility for applications
  • Parallel and Distributed engine (map-reduce, parameter server, etc.)
  • Advanced math and stats functions (e.g., hypothesis tests, MCMC, etc.)
  • Zoo system for efficient scripting and code sharing
  • GPU support (work in progress ...)

You can reach us in the following ways, looking forward to hearing from you!


Owl's documentation contains a lot of learning materials to help you start. The full documentation consists of two parts: Tutorial Book and API Reference. Both are perfectly synchronised with the code in the repository by the automatic building system. You can access both parts with the following link.


Owl requires OCaml >=4.06.0. The installation is rather trivial. There are four possible ways to try out Owl, as shown below, from the most straightforward one to the least one.

Option 1: Install from OPAM

You can simply type the following in the command line to start.

opam install owl

Owl's current version on OPAM is 0.2.9, and it lags way behind the master branch (current 0.3.4) and misses many new features. If you want to try the newest version, I recommend the other three ways to install.

Option 2: Pull from Docker Hub

You only need to pull in Owl's docker image and start a container, then play with it in utop. The source code is stored in /root/owl directory.

docker pull owlbarn/owl
docker run -t -i owlbarn/owl

There are several Linux distributions provided including an ARM-based Ubuntu. You can pull in a specific Owl image with corresponding tags.

docker pull owlbarn/owl:ubuntu
docker pull owlbarn/owl:debian
docker pull owlbarn/owl:alpine
docker pull owlbarn/owl:centos
docker pull owlbarn/owl:opensuse
docker pull owlbarn/owl:fedora

All these images are perfectly synced with the master branch by automatic building. You can check the building history on Docker Hub.

Option 3: Pin the Dev-Repo

opam pin allows us to pin the local code to Owl's development repository on Github. The first command opam depext installs all the dependencies Owl needs.

opam depext owl
opam pin add owl --dev-repo

Option 4: Compile from Source

First, you need to clone the repository.

git clone git@github.com:owlbarn/owl.git

or with

git clone https://github.com/owlbarn/owl.git

Second, you need to figure out the missing dependencies and install them.

jbuilder external-lib-deps --missing @install

Last, this is perhaps the most classic step.

make && make install


The most important dependency is OpenBLAS. Linking to the correct OpenBLAS is the key to achieve the best performance. Depending on the specific platform, you can use yum, apt-get, brew to install the binary format. For example on Mac OSX,

brew install openblas

However, installing from OpenBLAS source code leads to way better performance in my own experiment. In future, the dependency on OpenBLAS should also be resolved by opam automatically.

Integration to Toplevel

Owl is well integrated with utop. You can use utop to try out the experiments in our tutorials. If you want utop to automatically load Owl for you, you can also edit .ocamlinit file in your home folder by adding the following lines. (Note that the library name is owl with lowercase o.)


AuthorLiang Wang
Issue Trackerhttps://github.com/owlbarn/owl/issues
MaintainerLiang Wang <ryanrhymes@gmail.com>
Source [http] https://github.com/owlbarn/owl/releases/download/0.4.0/owl-0.4.0.tbz
Required by