Warning: Undefined array key "DOKU_PREFS" in /usr/share/dokuwiki/inc/common.php on line 2082
cluster:96 [DokuWiki]

User Tools

Site Tools


cluster:96

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
cluster:96 [2011/02/09 14:55]
hmeij
cluster:96 [2011/02/24 16:05]
hmeij
Line 11: Line 11:
   * [[http://www.mathworks.com/help/toolbox/distcomp/bqxceii-1.html|Part2]]   * [[http://www.mathworks.com/help/toolbox/distcomp/bqxceii-1.html|Part2]]
  
-In the examples below the code waits for the results.  Don't do that when submitting jobs, it is just for debug purposes. Change the last 3 lines with this 'get(sched)' and then you exit Matlab interactive session.+===== Serial 1 ===== 
 + 
 +In the example belowthe code waits for the results.  Don't do that when submitting jobs, it is just for debugging purposes.
  
 This old way still works for distributed jobs: This old way still works for distributed jobs:
 +
 <code> <code>
  
 % distributed matlab jobs % distributed matlab jobs
-% start 'matlab -nodisplay', issue the command 'newSimple'+% start 'matlab -nodisplay', issue the command 'Simple'
  
 % set up the scheduler and matlab worker environment % set up the scheduler and matlab worker environment
Line 23: Line 26:
 set(sched, 'HasSharedFilesystem', true); set(sched, 'HasSharedFilesystem', true);
 set(sched, 'ClusterMatlabRoot', '/share/apps/matlab/2010b') set(sched, 'ClusterMatlabRoot', '/share/apps/matlab/2010b')
-set(sched, 'SubmitFcn', @distributedSubmitFcn  +set(sched, 'SubmitFcn', @lsfSimpleSubmitFcn)
  
 % specify location for worker output % specify location for worker output
Line 34: Line 37:
 % submit job, wait for jobs to finish, fetch output % submit job, wait for jobs to finish, fetch output
 submit(j) submit(j)
 +
 % WARNING: this may hang if the workers are busy! % WARNING: this may hang if the workers are busy!
 waitForState(j) waitForState(j)
 results = getAllOutputArguments(j); results = getAllOutputArguments(j);
 results{1:5} results{1:5}
 +% better to do it like Simple2.m
 +
  
 </code> </code>
  
-This old way for parallel jobs does notnot sure why:+===== Serial 2 ===== 
 + 
 +After you submit the jobyou can exit matlab. 
 <code> <code>
-% start 'matlab -nodisplay', issue the command 'myPJob' 
  
-set up the scheduler and matlab worker environment +distributed matlab jobs 
-%2007a sched = findResource('scheduler', 'configuration', 'generic'+start 'matlab -nodisplay', issue the command 'Simple2'
-%2007a set(sched, 'Configuration', 'generic'+
-sched = findResource('scheduler','type','LSF'+
-set(sched, 'SubmitArguments', '-R type==LINUX64'+
-set(sched, 'SubmitArguments', '-q matlab')+
  
 +% set up the scheduler and matlab worker environment
 +sched = findResource('scheduler', 'type', 'generic');
 set(sched, 'HasSharedFilesystem', true); set(sched, 'HasSharedFilesystem', true);
 set(sched, 'ClusterMatlabRoot', '/share/apps/matlab/2010b') set(sched, 'ClusterMatlabRoot', '/share/apps/matlab/2010b')
-set(sched, 'SubmitFcn', @lsfParallelSubmitFcn  +set(sched, 'SubmitFcn', @lsfSimpleSubmitFcn)
  
 % specify location for worker output % specify location for worker output
Line 60: Line 66:
  
 % create job and assign tasks to be done % create job and assign tasks to be done
 +j = createJob(sched);
 +T = createTask(j, @rand, 1, {{3,3} {3,3} {3,3} {3,3} {3,3}});
  
-set(pj, 'MaximumNumberOfWorkers', 4+% submit job, then exit matlab interactive session 
-set(pj, 'MinimumNumberOfWorkers', 4)+submit(j
 +get(sched)
  
-% create job and assign tasks to be done +</code>
-pj = createParallelJob(sched); +
-T = createTask(pj, @rand, 1, {{3,3} {3,3} {3,3} {3,3} {3,3}});+
  
 +===== Parallel =====
 +
 +Slightly different syntax.  Adjust your number of workers values based on some benchmarking, not always do the most workers finish a job in the shortest amount of time.
 +
 +<code>
 +
 +% parallel matlab jobs
 +% start 'matlab -nodisplay', issue the command 'Simplep'
 +
 +% set up the scheduler and matlab worker environment
 +sched = findResource('scheduler', 'type', 'generic')
 +set(sched, 'HasSharedFilesystem', true);
 +set(sched, 'ClusterMatlabRoot', '/share/apps/matlab/2010b')
 +set(sched, 'ParallelSubmitFcn', @lsfParallelSubmitFcn)
 +
 +% specify location for worker output
 +set(sched, 'DataLocation', '/home/hmeij/hp/matlab')
 +pj = createParallelJob(sched);
 +set(pj, 'MaximumNumberOfWorkers', 8)
 +set(pj, 'MinimumNumberOfWorkers', 8)
 +T = createTask(pj, @rand, 1, {{300,300}});
  
 % submit job, wait to finish, get status jobs, gather results % submit job, wait to finish, get status jobs, gather results
 submit(pj) submit(pj)
 get(sched) get(sched)
- 
 % you can now exit matlab % you can now exit matlab
-% at system prompt type 'bjobs' +% at system prompt type 'bjobs' 
  
 </code> </code>
 +
 +
  
 \\ \\
 **[[cluster:0|Home]]** **[[cluster:0|Home]]**
cluster/96.txt · Last modified: 2015/03/13 13:52 by hmeij