This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cluster:96 [2011/02/09 19:55] hmeij |
cluster:96 [2015/03/13 17:52] (current) hmeij [Note] |
||
---|---|---|---|
Line 1: | Line 1: | ||
\\ | \\ | ||
**[[cluster: | **[[cluster: | ||
+ | |||
+ | ==== Note ==== | ||
+ | |||
+ | You can also run matlab jobs via scripts like other software. | ||
+ | |||
+ | Create a file with the matlab commands and then create a shell script to submit the job. | ||
+ | |||
+ | It would look like | ||
+ | |||
+ | < | ||
+ | |||
+ | #!/bin/bash | ||
+ | # submit via 'bsub < run.serial' | ||
+ | |||
+ | #BSUB -q matlab | ||
+ | |||
+ | #BSUB -J test | ||
+ | #BSUB -o test.stdout | ||
+ | #BSUB -e test.stderr | ||
+ | |||
+ | |||
+ | |||
+ | matlab -no display < my_code.m > /dev/null | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Matlab 2013a ==== | ||
+ | |||
+ | Is now the default matlab version, just change the paths in scripts below | ||
+ | --- // | ||
==== Matlab 2010b ==== | ==== Matlab 2010b ==== | ||
Line 11: | Line 41: | ||
* [[http:// | * [[http:// | ||
- | In the examples | + | === Serial 1 === |
+ | |||
+ | In the example | ||
This old way still works for distributed jobs: | This old way still works for distributed jobs: | ||
+ | |||
< | < | ||
% distributed matlab jobs | % distributed matlab jobs | ||
- | % start ' | + | % start ' |
% set up the scheduler and matlab worker environment | % set up the scheduler and matlab worker environment | ||
Line 23: | Line 56: | ||
set(sched, ' | set(sched, ' | ||
set(sched, ' | set(sched, ' | ||
- | set(sched, ' | + | set(sched, ' |
% specify location for worker output | % specify location for worker output | ||
Line 34: | Line 67: | ||
% 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: | results{1: | ||
+ | % better to do it like Simple2.m | ||
+ | |||
</ | </ | ||
- | This old way for parallel jobs does not, not sure why: | + | === Serial 2 === |
+ | |||
+ | After you submit the job, you can exit matlab. | ||
< | < | ||
- | % start ' | ||
- | % set up the scheduler and matlab | + | % distributed |
- | %2007a sched = findResource(' | + | % start 'matlab |
- | %2007a set(sched, ' | + | |
- | sched = findResource(' | + | |
- | set(sched, ' | + | |
- | set(sched, 'SubmitArguments', | + | |
+ | % set up the scheduler and matlab worker environment | ||
+ | sched = findResource(' | ||
set(sched, ' | set(sched, ' | ||
set(sched, ' | set(sched, ' | ||
- | set(sched, ' | + | set(sched, ' |
% specify location for worker output | % specify location for worker output | ||
Line 60: | Line 96: | ||
% create job and assign tasks to be done | % create job and assign tasks to be done | ||
+ | j = createJob(sched); | ||
+ | T = createTask(j, | ||
- | set(pj, ' | + | % submit job, then exit matlab interactive session |
- | set(pj, ' | + | submit(j) |
+ | get(sched) | ||
- | % create job and assign tasks to be done | + | </ |
- | pj = createParallelJob(sched); | + | |
- | T = createTask(pj, | + | |
+ | === Parallel === | ||
+ | |||
+ | Slightly different syntax. | ||
+ | |||
+ | < | ||
+ | |||
+ | % parallel matlab jobs | ||
+ | % start ' | ||
+ | |||
+ | % set up the scheduler and matlab worker environment | ||
+ | sched = findResource(' | ||
+ | set(sched, ' | ||
+ | set(sched, ' | ||
+ | set(sched, ' | ||
+ | |||
+ | % specify location for worker output | ||
+ | set(sched, ' | ||
+ | pj = createParallelJob(sched); | ||
+ | set(pj, ' | ||
+ | set(pj, ' | ||
+ | T = createTask(pj, | ||
% 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 ' | + | % at system prompt type ' |
</ | </ | ||
+ | |||
+ | |||
\\ | \\ | ||
**[[cluster: | **[[cluster: |