Commit 6feac46c authored by Lisa Gerhardt's avatar Lisa Gerhardt

Merge branch 'agreiner/oar_updates' into 'master'

Agreiner/oar updates

See merge request !428
parents 338b3fcb 9803c439
......@@ -27,9 +27,9 @@ LINPACK and EISPACK projects. Today, MATLAB engines incorporate the
LAPACK and BLAS libraries, embedding the state of the art in software
for matrix computation.
## How to Use MATLAB on Edison and Cori
## How to Use MATLAB on Cori
MATLAB is available at NERSC on Edison and Cori. The number of MATLAB
MATLAB is available at NERSC on Cori (and Edison until it retires). The number of MATLAB
licenses at NERSC is not very large (currently 16), so users should
not be running a MATLAB session when it is not being actively used. If
you use NX, it's particularly easy to think you've released your
......@@ -43,16 +43,16 @@ batch job to the regular queue.
### Running Interactively
To run MATLAB interactively on Edison, connect with ssh -X or via NX,
To run MATLAB interactively on Cori, connect with ssh -X or via NX,
and do the following:
```
salloc -p regular -N 1 -c 24 -t 30:00
salloc -q interactive -N 1 -c 32 -C haswell -t 30:00
module load matlab
matlab
```
It is also possible to run MATLAB on an Edison login node directly:
It is also possible to run MATLAB on a Cori login node directly. Production computing should not be undertaken on login nodes, however. For long-running or compute intensive jobs, use a batch script.
```
module load matlab
......@@ -62,29 +62,31 @@ matlab
### Batch Jobs
To run one instance of MATLAB non-intearctively through a batch job,
you can use the following job script on Edison:
you can use the following job script on Cori:
```
#!/bin/bash -l
#SBATCH -p regular
#SBATCH -q regular
#SBATCH -N 1
#SBATCH -c 24
#SBATCH -c 32
#SBATCH -C haswell
#SBATCH -t 00:30:00
cd $SLURM_SUBMIT_DIR # optional, since this is the default behavior
module load matlab
matlab -nodisplay -r < myjob -logfile myjob.log
srun -n 1 -c 32 matlab -nodisplay -r < myjob.m -logfile myjob.log
```
Where `myjob.m` is your MATLAB script.
### Parallelism in MATLAB
To prepare a MATLAB cluster with 24 cores (within MATLAB) do:
To prepare a MATLAB cluster with 32 cores (within MATLAB) do:
```
cluster = parcluster('local')
cluster.NumWorkers = 24
saveAsProfile(cluster,'edison_cluster')
pp = parpool('edison_cluster', 24)
cluster.NumWorkers = 32
saveAsProfile(cluster,'cori_cluster')
pp = parpool('cori_cluster', 32)
```
#### Running MATLAB Parallel Commands
......@@ -130,10 +132,7 @@ script (or interactive job).
Another way to run MATLAB in parallel is to run multiple instances of
a compiled MATLAB program. By compiling, you create a stand-alone
application that doesn't need to obtain a separate license from the
NERSC license server to run. The MathWorks web site has details about
using
the
[MATLAB Compiler](https://www.mathworks.com/products/compiler.html).
NERSC license server to run. See [MATLAB Compiler](matlab_compiler) for details.
## Documentation
......
#MATLAB compiler
MATLAB Compiler™ lets you share MATLAB® programs as standalone applications.
All applications created with MATLAB Compiler use the MATLAB Runtime, which enables royalty-free deployment to users who do not need MATLAB. You can package the runtime with the application, or have your users download it during installation.
The MATLAB web site has more about [MATLAB Compiler support for MATLAB and toolboxes](https://www.mathworks.com/products/compiler/compiler_support.html), and a helpful video about [creating standalone applications](https://www.mathworks.com/videos/getting-started-standalone-applications-using-matlab-compiler-100088.html).
The following example shows a general approach on how to build MATLAB stand-alone applications from scripts.
##Example
On Cori over NX:
```
module load matlab; module load matlab/MCRv901
```
Copy the example below to a file in your home directory and launch MATLAB
```
matlab
```
This example shows a matrix factorization, using a function that performs a Cholesky decomposition. It will read data from and write results to CSV files. This script produces an upper triangular matrix R from the diagonal and upper triangle of matrix A, satisfying the equation `R'*R=A`. `A_path` is the path to CSV-formatted data for A and `outpath` is where R will be written to as a CSV file.
```
% decomposition.m
function R = decomposition(A_path, outpath)
% A_path: Path to CSV data
% A: Matrix positive definite
% R: upper triangular matrix R from the diagonal and upper
% triangle of matrix A, satisfying the equation R'*R=A
A = csvread(A_path);
R = chol(A);
csvwrite(outpath)
```
From the command line, one can also use the MATLAB compiler as follows:
```
mkdir build; cd build
mcc -m ../decomposition.m
```
After the build process is completed, execute the program with the following syntax and the needed input arguments. For this particular example the variables are **A: Matrix positive definite** and **outpath: path to where results will be written to**:
Under
$HOME/matlab_examples/build/decomposition/for_testing if GUI was used
or
under $HOME/matlab_examples/build if mcc was used:
```
./run_decomposition.sh $MCR_ROOT $HOME/matlab_examples/data.csv ./out.csv
```
Note that the MCR_ROOT variable is set by `module load matlab/MCRv901`. It is recommended to copy these libraries to Lustre if your application is very IO intensive.
The complete documentation for mcc can be found in the [MATLAB documentation](https://www.mathworks.com/help/mps/ml_code/mcc.html).
......@@ -16,3 +16,5 @@ NEWT consists of two parts:
1. A web service that resides at https://newt.nersc.gov/newt.
2. A javascript library called newt.js which provides you with helper functions to access the NEWT service through simple AJAX calls.
You can learn more about the NEWT API and get a copy of the newt.js library at [https://newt.nersc.gov/](https://newt.nersc.gov/)
\ No newline at end of file
......@@ -39,7 +39,9 @@ nav:
- BerkeleyGW: applications/berkeleygw/index.md
- CP2K: applications/cp2k/index.md
- Mathematica : applications/mathematica/index.md
- MATLAB : applications/matlab/index.md
- MATLAB :
- MATLAB Overview: applications/matlab/index.md
- MATLAB Compiler: applications/matlab/matlab_compiler.md
- NAMD : applications/namd/index.md
- SIESTA : applications/siesta/index.md
- PARATEC: applications/paratec/index.md
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment