I’m writing a model using Owl in which some operations involve moderately complicated processing in OCaml code–i.e. some things have to be done using calculations on individual values, rows, and columns of matrices. I don’t think the algorithms can be can be translated into pure matrix operations, which could then be handed off to OpenBLAS. Now that I’ve gotten the code working on toy examples, I’m finding that if I process reasonably large matrices such as 1000x1000, some operations can take a very long time. No doubt my code can be optimized further, although I suspect the speed improvements would not be worth the additional effort. I have to investigate further. In any event, I was thinking that moving from bytecode to native code might improve speed significantly, and would be easy to test.
I know how to make a native code application. I have done that with a related project. However, what’s most useful, for many purposes, is to be able to experiment with the models in a REPL of some kind. That will always be true, even when I get to the point where it’s useful to standardize some sequences of operations as a separate application. utop is a great environment for experimenting with the model, except that it’s inconvenient to sit and wait many minutes for an operation to finish. I’d rather run the slow operations in native code, but I want to be able to do that in a REPL.
Do I have to write my own REPL into a native code application in order to do this? If is there some way to do this that’s not too difficult, given that
ocaml already include routines that allow construction of a REPL? (I’m thinking about traditional lisps where you really can just compose the functions
print in a loop to get a … REPL.)