Profiling Function Vectorization in Octave (Matlab)
Description: Octave is a high level interpreted language that is highly compatible with Matlab and is a productive tool for interacting with and performing calculations on multidimensional numeric arrays. When performing calculations some forms of the procedures do not scale well and result in a poor performance for large arrays. This training session 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:
outdata=data-repmat(mean(data,2),1,size(data,2));
3. 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 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 bsxfun 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 SHARCNET 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.


