Using GNU Octave to Run Matlab Code on Graham

Description: Octave is a high level interpreted language that is largely compatible with Matlab and is a productive tool for interacting with and performing calculations on multidimensional numeric arrays. Several research fields have substantial analytic tools developed in Matlab. Being able to use these research tools within an open source platform has several benefits and this is particularly the case when executing the computations on shared research clusters.

This course explores generalizable strategies of using Octave on the Graham cluster to execute procedures established in Matlab.

When performing some of the computations established in high-level languages like and Octave and Matlab the procedures may not scale well and result in a poor performance for large arrays. This training session also provides a hands on exploration of profiling tools for monitoring the performance of operations in Octave and compares different forms of simple operations.

For example, given a three dimensional "data" array, subtracting the row means from the original array:

  1. The explicit nested for loop form is:
    for rind=1:size(data,1);
       for pind=1:size(data,3);
          outdata(rind,:,pind)=data(rind,:,pind)-mean(data(rind,:,pind),2);
       end;
    end;
    
  2. Using repmat expansion of an intermediate array:
  3. outdata=data-repmat(mean(data,2),1,size(data,2));
    
  4. Using bsxfun singlton dimension expansion:
    outdata=bsxfun(@minus,data,mean(data,2));
    

From the profiling summaries of these procedures the performance benefits of using bsxfun binary expansion are examined. Specifically, this vectorization provides a method to perform operations along a dimension of an array using a single call to a basic function without the need to generate intermediate arrays. During this seminar the example of using vectorization for the mean subtraction will then be expanded to a more complex procedure of correlating rows of the data array. After working with the profiler on attendees’ own laptops the methods will be replicated on the Graham systems.

Instructor: James Desjardins, SHARCNET, Brock University.

Prerequisites: Although no previous experience with Octave is necessary to take part in this course, some previous experience with research computing is helpful. That being said, any attendee familiar with the Software Carpentry Octave/Matlab course material will be able to follow all topics in this course. Attendees will require their own laptops with Octave 4.0.0 (or later) installed

Course materials: TBP.