Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
software:matlab:mills [2017-09-07 16:52] – created sraskar | software:matlab:mills [2019-08-29 16:05] (current) – [Matlab script] anita | ||
---|---|---|---|
Line 4: | Line 4: | ||
On Mills, MATLAB projects should be developed using a Desktop installation of MATLAB and then copied to the cluster | On Mills, MATLAB projects should be developed using a Desktop installation of MATLAB and then copied to the cluster | ||
to be run in batch. | to be run in batch. | ||
- | consider an extended MATLAB example involving | + | consider an extended MATLAB example involving |
the first function in a loop, and to using the Parallel Toolbox. | the first function in a loop, and to using the Parallel Toolbox. | ||
Details on how to run these two scripts in batch are given with the resulting output files. | Details on how to run these two scripts in batch are given with the resulting output files. | ||
- | section with UNIX commands you can use to watch your jobs and gather [[#timing and core count]] numbers. | + | section with UNIX commands you can use to watch your jobs and gather [[#timings-and-core-count | timing and core count]] numbers. |
You will need to know how much memory and how many cores you should request for your jobs. | You will need to know how much memory and how many cores you should request for your jobs. | ||
Line 25: | Line 25: | ||
</ | </ | ||
+ | ==== Matlab License Information ==== | ||
+ | |||
+ | Matlab licenses are pushed into consumable (global, per-job) integer complexes in Grid Engine and can be checked using | ||
+ | |||
+ | < | ||
+ | qhost -h global -F | ||
+ | </ | ||
+ | |||
+ | to list number of unused license seats for each product. | ||
+ | |||
+ | Below is an example representing a snapshot of unused licensed seats for Matlab products on the cluster. | ||
+ | < | ||
+ | [traine@mills ~]$ qhost -h global -F | ||
+ | HOSTNAME | ||
+ | ------------------------------------------------------------------------------- | ||
+ | global | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | gc: | ||
+ | </ | ||
+ | |||
+ | Matlab jobs can be submitted to require a certain number of license seats to be available before a job will run. If there are inter-license dependencies for toolboxes, then you should specify all the licenses including Matlab and/or Simulink. | ||
+ | |||
+ | For example, if a Matlab job requires the Financial toolbox, then you will also need to specify all the inter-related toolbox licenses required by the Financial toolbox such as the Statistics and Optimization toolboxes as well Matlab itself. See [[http:// | ||
+ | ]] for complete details. | ||
+ | |||
+ | < | ||
+ | qsub -l MLM.MATLAB=1, | ||
+ | </ | ||
+ | |||
+ | Naturally, this isn't a to-the-moment mapping because the license server is not being queried constantly. | ||
+ | |||
+ | This will be most helpful when submitting many Matlab jobs that require a toolbox with a low-seat count. They will wait for a toolbox seat to become available rather than trying to run and having many getting the " | ||
===== Matlab function ===== | ===== Matlab function ===== | ||
Line 45: | Line 116: | ||
- | The page will using a Matlab function to illustrate using Matlab in batch and interactively. | + | The examples |
- | ===== Batch example ===== | ||
- | The basic steps to run [[: | ||
==== Matlab script ==== | ==== Matlab script ==== | ||
First, write a Matlab script file. It should have a comment on the first line describing the purpose of the script and have the '' | First, write a Matlab script file. It should have a comment on the first line describing the purpose of the script and have the '' | ||
Line 68: | Line 137: | ||
quit | quit | ||
</ | </ | ||
+ | |||
+ | This is a detailed script example, which calls the maxEig function. | ||
+ | |||
+ | <note tip> | ||
+ | Several MATLAB commands could be added to the beginning of this script to set the maximum number of computational threads to the number of slots assigned to your job. If the scheduler using CGROUPS to limit your job core count, then these commands are not necessary. | ||
+ | < | ||
+ | [compThreads, | ||
+ | if count == 1 | ||
+ | warning(' | ||
+ | autoCompThreads = maxNumCompThreads(compThreads); | ||
+ | disp(sprintf(' | ||
+ | end | ||
+ | </ | ||
+ | See [[maxNumCompThreadsGridEngine|Setting maximum number of computational threads]]</ | ||
+ | |||
+ | <note tip> | ||
+ | This script ends in a **__quit__** command (equivalent to MATLAB **__exit__**). | ||
+ | terminates MATLAB when done. If you run this from the bash command line with the '' | ||
+ | |||
+ | Without the **__quit__** you will come back to the MATLAB prompt on completion for a interactive job. If this is the last line of a batch queue script, then the only difference will be the MATLAB prompt ''>>'' | ||
+ | </ | ||
==== Grid Engine script ==== | ==== Grid Engine script ==== | ||
Line 135: | Line 225: | ||
</ | </ | ||
- | <note warning> | + | <note warning> |
In this example you will need a license for the base Matlab, and the parallel toolbox needs one license. | In this example you will need a license for the base Matlab, and the parallel toolbox needs one license. | ||
Line 292: | Line 382: | ||
We have the correct Grid Engine options '' | We have the correct Grid Engine options '' | ||
- | [[clusters: | + | [[software: |
===== Batch parallel example ===== | ===== Batch parallel example ===== | ||
Line 340: | Line 430: | ||
===== Interactive example ===== | ===== Interactive example ===== | ||
- | The basic steps to running a [[: | + | This example is based on being in your workgroup environment, |
- | + | ||
- | This demo starts in your MATLAB directory and with and active workgroup. | + | |
- | + | ||
==== Scheduling exclusive interactive job ==== | ==== Scheduling exclusive interactive job ==== | ||