Changes between Version 2 and Version 3 of cypress/Matlab


Ignore:
Timestamp:
Aug 13, 2015 4:08:14 PM (6 years ago)
Author:
fuji
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • cypress/Matlab

    v2 v3  
    6363
    6464=== Running MATLAB in Parallel with Multithreads ===
     65MATLAB supports multithreaded computation for a number of functions and expressions that are combinations of element-wise functions.
     66These functions automatically execute on multiple threads if data size is large enough.
     67Note that on Cypress, in default, MATLAB runs with a single threads, and you have to explicitly specify the number of threads in your code.
     68For example,
     69{{{#!matlab
     70% Matlab Test Code "FuncTest.m"
     71%
     72LASTN = maxNumCompThreads(str2num(getenv('SLURM_JOB_CPUS_PER_NODE')));
     73nth = maxNumCompThreads;
     74fprintf('Number of Threads = %d.\n',nth);
    6575
    66 === Running MATLAB with Automatic Offloading ===
     76N=2^(14);
     77A = randn(N);
     78st = cputime;
     79tic;
     80B = sin(A);
     81realT = toc;
     82cpuT = cputime -st;
     83fprintf('Real Time = %f(sec)\n',realT);
     84fprintf('CPU Time = %f(sec)\n',cpuT);
     85fprintf('Speedup Factor = %f\n',cpuT / realT);
     86}}}
     87
     88In above code, the line,
     89{{{#!matlab
     90LASTN = maxNumCompThreads(str2num(getenv('SLURM_JOB_CPUS_PER_NODE')));
     91}}}
     92defines the number of threads.
     93The environmental variable, '''SLURM_JOB_CPUS_PER_NODE''' has the value set in SLURM script, for example,
     94{{{#!bash
     95#!/bin/bash
     96#SBATCH --qos=normal            # Quality of Service
     97#SBATCH --job-name=matlabMT     # Job Name
     98#SBATCH --time=1:00:00          # WallTime
     99#SBATCH --nodes=1               # Number of Nodes
     100#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
     101#SBATCH --cpus-per-task=10      # Number of threads per task (OMP threads)
     102
     103module load matlab
     104matlab -nodesktop -nodisplay -nosplash -r "FuncTest; exit;"
     105}}}
     106The number of cores per process (task) is set by '''--cpus-per-task=10'''.
     107This value goes to '''SLURM_JOB_CPUS_PER_NODE''' and you can use it to determine the number of threads used in the code.
    67108
    68109
     110==== Explicit parallelism ====
     111The ''parallel computing toolbox'' is available on Cypress.
     112You can use up to 12 workers for shared parallel operations on a single node in the current MATLAB version.
     113Our license does not include MATLAB Distributed Computing Server. Therefore, multi-node parallel operations are not supported.
     114
     115
     116 
     117=== Running MATLAB with Automatic Offloading ===