This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
cluster:96 [2011/02/09 19:53] hmeij created |
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: | ||
< | < | ||
% 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 | ||
+ | |||
</ | </ | ||
+ | |||
+ | === Serial 2 === | ||
+ | |||
+ | After you submit the job, you can exit matlab. | ||
+ | |||
+ | < | ||
+ | |||
+ | % distributed 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, ' | ||
+ | |||
+ | % create job and assign tasks to be done | ||
+ | j = createJob(sched); | ||
+ | T = createTask(j, | ||
+ | |||
+ | % submit job, then exit matlab interactive session | ||
+ | submit(j) | ||
+ | get(sched) | ||
+ | |||
+ | </ | ||
+ | |||
+ | === 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(pj) | ||
+ | get(sched) | ||
+ | % you can now exit matlab | ||
+ | % at system prompt type ' | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
\\ | \\ | ||
**[[cluster: | **[[cluster: |