-
Notifications
You must be signed in to change notification settings - Fork 124
How To?
This can be achieved by simply pulling Owl's docker image.
docker pull ryanrhymes/owl
docker run -t -i ryanrhymes/owl
If you want to run Owl on different platforms such as ARM, please refer here for more details.
You can edit the .ocamlinit
file in your home directory by adding the following lines.
#use "topfind"
#require "owl"
open Owl
If you don't want to open Owl module, please remove the open Owl
. If you use utop
rather than OCaml's default toplevel, remove the redundant #use "topfind"
.
Calling the Linalg.Generic.peakflops ()
function will return you the number of float operations per second (flops). This number is derived by calculating the amount of time spent in multiplying two 2000 x 2000
matrices. Julia provides the same function and you can use this to compare two.
Owl.Utils.time
function can be used to measure the time spent in one operation. It takes a function of type (unit -> 'a)
as input and returns a float number represent the time in ms
. Here is an example.
let x = Mat.uniform 1000 1000 in
let f () = Mat.sum x in
Owl.Utils.time f;;
Arr.concatenate ~axis:0 [|x; y; z|];;
Arr.split ~axis:0 [|2;4;2|] x;;
let x = Mat.zeros 4 4;;
Mat.set_index x [| Utils.range 0 3; [|3;2;1;0|] |] [|1.|];;
Mat.get_slice [ R []; L [1;2;3;0] ] x;;
All matrices can be serialised to storage by using save
. Later, you can load a matrix using load
function.
Mat.save x "m0.mat";; (* save x to m0.mat file *)
Mat.load "m0.mat";; (* load m0.mat back to the memory *)
There are also corresponding save_txt
and load_txt
functions for a simple tab-delimited, human-readable format. Note the performance is much worse than the corresponding save
and load
.