Code covered by the BSD License  

Highlights from
Enhancing e-Infrastructures with Advanced Technical Computing: Parallel MATLAB® on the Grid

Exercise5_simBioScriptParfor.m
%% Information about the application
% A MATLAB application from the field of systems biology was chosen for
% experimental runs. The application was created using SimBiology which
% extends MATLAB with functionality for modeling, simulating, and
% analyzing biochemical pathways.
%
% The application allows a user to model and simulate the dynamics of a
% simple gene regulation network, and understand the effect of
% stochasticity on the final state of the system.  A ensemble of stochastic
% runs were performed on a gene-regulation model, and the distribution of
% state was studied at any given time point. Several hundred thousand
% simulations might need to be performed to obtain a smooth probability
% distribution function, requiring several days of computation on one
% MATLAB.

% The model used in this script was adpated from the following publication :
% Kepler TB, Elston TC. Stochasticity in transcriptional regulation:
% Origins, consequences and % mathematical representations. Biophys J.
% 2001;81:31163136.

%% Version for submission to cluster
% No serial code in this version. Also, when submitting to the cluster via
% batch, you do not need to open up a matlabpool. 


% Total number of runs
numberOfRuns = 20;

% Load SimBiology model
sbioloadproject GeneRegulation m1

% Pre-allocate memory
data   = zeros(numberOfRuns, numel(m1.Species))   ;


%% Define simulation settings

% Pre-allocate memory
dataParfor   = zeros(numberOfRuns, numel(m1.Species))   ;


%% Running an ensemble of stochastic simulations

tic

% change the for loop to a parfor to run in parallel

parfor i = 1:numberOfRuns
    dataParfor(i, :) =  simulation ;
end

elapsedTimeParallel = toc;  

Contact us at files@mathworks.com