Tuesday, May 22, 2012

Initial Work

Hi, I am Max Brister, a student working on JIT compilation in GNU Octave for google summer of code. My project proposal can be found on melange. In this blog I plan to explore implementation details, mark my progress, and present intermediary results.

I have already implemented a simple proof of concept which shows some promise. The simple script
a = 1;
b = 1;
for i=1:10000
  for j=1:10000
    a = a + b;
executes on my computer in 0.178s using my jit branch, and in 253.124s using Octave 3.6.1. A speedup of 1422 is not bad.

There is still quite a ways to go before the code is ready for users though. I need to take another look at type inference, ensure error cases are handled correctly, and the current implementation requires the inner loop bounds to be constant for type inference.

You can view my current progress by checking out my code from
hg clone http://inversethought.com/hg/octave-max
The specific revision this post refers to is cba58541954c.

I realized that I should mention that a speedup of 1422x is really a best cast speedup. Code which is already vectorized will see a much smaller speedup (if any). This is because Octave already efficiently implements vectorization.


  1. Hello Max,

    Could you help me on compiling problem on octave?
    I want to implement preconditioner for octave, and I create a folder with some source files. I don't know how to compile those files in octave and link to final binary file.

    Could you help me on that?

    thank you!

    1. Are you sure you need to compile the preconditioner directly into Octave? I would recommend using Oct files if possible. There is a section in the manual that describes how to do this: http://tinyurl.com/dxhd3y7

      Hope that helps

    2. I am doing project to contribute some preconditioner to octave. since the octave's built-in preconditioner is in octave/src/DLD-FUNCTIONS, I think it is better to put source code directly into octave. Could you give me some guide on how to do it?

      Thank you!

    3. It looks like the files in src/DLD-FUNCTIONS are automatically found and linked in. The guide in the link I gave above should still apply, as the code in src/DLD-FUNCTIONS are actually all oct files. I think this method requires one file per function (but I don't use it, so I'm not sure). Is this your case?

  2. Hi Max,

    Great work. Really looking forward to your results. This will be great!

    Keep on being awesome.

  3. Looks very good. This can be a milestone in the GNU Octave development :)

  4. Good luck with your project. You might want to take a look at McVM which has a JIT for Matlab. See http://www.sable.mcgill.ca/mclab/mcvm_mcjit.html. That web page also contains links to papers and the theses.

    1. Thanks for the link. I read through the type inference section of the thesis and found it to be quite interesting.