Changes between Version 17 and Version 18 of cypress/Matlab
- Timestamp:
- 10/21/25 12:25:33 (3 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
cypress/Matlab
v17 v18 8 8 9 9 See [https://wiki.hpc.tulane.edu/trac/wiki/cypress/Matlab#CompiledMatlab] 10 == MATLAB Modules == 11 {{{ 12 [fuji@cypress1 ~]$ module av matlab 13 14 ----------------------------------------------- /share/apps/modulefiles ------------------------------------------------ 15 matlab/r2013b matlab/r2015a matlab/r2015b matlab/r2016a matlab/r2017b matlab/r2020a 16 17 ------------------------------------------- /share/apps/centos7/modulefiles -------------------------------------------- 18 matlab/r2022b matlab/r2023a 19 }}} 10 20 11 21 == Running MATLAB interactively == 22 Download example: 23 {{{ 24 git clone https://hidekiCCS:@bitbucket.org/hidekiCCS/hpc-workshop.git 25 }}} 26 12 27 Start an interactive session, 13 28 {{{#!bash 14 [fuji@cypress 2 ~]$ idev15 Requesting 1 node(s) task(s) to normal queue of defqpartition16 1 task(s)/node, 20 cpu(s)/task, 2MIC device(s)/node29 [fuji@cypress1 ~]$ idev --partition=centos7 30 Requesting 1 node(s) task(s) to normal queue of centos7 partition 31 1 task(s)/node, 20 cpu(s)/task, 0 MIC device(s)/node 17 32 Time: 0 (hr) 60 (min). 18 Submitted batch job 47343 19 JOBID=47343 begin on cypress01-063 20 --> Creating interactive terminal session (login) on node cypress01-063. 33 0d 0h 60m 34 Submitted batch job 3262352 35 JOBID=3262352 begin on cypress01-066 36 --> Creating interactive terminal session (login) on node cypress01-066. 21 37 --> You have 0 (hr) 60 (min). 22 Last login: Mon Jun 8 20:18:50 2015 from cypress1.cm.cluster 38 --> Assigned Host List : /tmp/idev_nodes_file_fuji 39 Last login: Tue Oct 21 12:13:06 2025 from cypress1.cm.cluster 23 40 }}} 24 41 Load the module 25 42 {{{#!bash 26 [fuji@cypress01-06 3 ~]$ module load matlab43 [fuji@cypress01-066 ~]$ module load matlab/r2023a 27 44 }}} 28 45 Run MATLAB on the command-line window, 29 46 {{{#!bash 30 [fuji@cypress01-063 ~]$ matlab -nodisplay -nosplash 31 MATLAB is selecting SOFTWARE OPENGL rendering. 32 33 < M A T L A B (R) > 34 Copyright 1984-2015 The MathWorks, Inc. 35 R2015a (8.5.0.197613) 64-bit (glnxa64) 36 February 12, 2015 37 38 39 To get started, type one of these: helpwin, helpdesk, or demo. 47 [fuji@cypress01-066 ~]$ matlab -nodisplay -nosplash 48 49 < M A T L A B (R) > 50 Copyright 1984-2023 The MathWorks, Inc. 51 R2023a Update 5 (9.14.0.2337262) 64-bit (glnxa64) 52 July 24, 2023 53 54 55 To get started, type doc. 40 56 For product information, visit www.mathworks.com. 41 57 42 43 Academic License44 45 58 >> 46 59 }}} 47 You will get to the MATLAB command-line and can run MATLAB code here but no graphics.60 You will get to the MATLAB command-line and can run MATLAB code here, but '''no graphics'''. 48 61 49 62 === Running MATLAB interactively with GUI === … … 68 81 }}} 69 82 70 Note that your M atlabsession will be killed when the session time exceeds the walltime limit.83 Note that your MATLAB session will be killed when the session time exceeds the walltime limit. 71 84 72 85 == Running MATLAB in a batch mode == … … 75 88 {{{#!bash 76 89 #!/bin/bash 77 #SBATCH --qos=normal # Quality of Service 90 #SBATCH --partition=centos7 # Partition 91 #SBATCH --qos=normal # Quality of Service 78 92 #SBATCH --job-name=matlab # Job Name 79 93 #SBATCH --time=24:00:00 # WallTime … … 82 96 #SBATCH --cpus-per-task=1 # Number of threads per task (OMP threads) 83 97 84 module load matlab 98 module load matlab/r2023a 85 99 matlab -nodesktop -nodisplay -nosplash < mymatlabprog.m 86 100 }}} … … 111 125 }}} 112 126 113 cd to the directory containing your matlab file and compile using matlabs C compiler {{{mcc -m <your matlab .m file>}}}. If your script is spread over many files you need to specify the directories containing those files {{{mcc -m -I <source directory> <your matlab .m file>}}}. For example, to compile my_script.m which depends on other .m files located in /home/tulaneID/myMatlab I would run127 cd to the directory containing your MATLAB file and compile using MATLAB's C compiler {{{mcc -m <your matlab .m file>}}}. If your script is spread over many files you need to specify the directories containing those files {{{mcc -m -I <source directory> <your matlab .m file>}}}. For example, to compile my_script.m which depends on other .m files located in /home/tulaneID/myMatlab I would run 114 128 {{{ 115 129 mcc -m -I /home/tulaneID/myMatlab my_script.m … … 142 156 === Running MATLAB in Parallel with Multithreads === 143 157 MATLAB supports multithreaded computation for a number of functions and expressions that are combinations of element-wise functions. 144 These functions automatically execute on multiple threads if data size is large enough.145 Note that on Cypress, by default, ~~ ~MATLAB runs with a single threads~~~, '''MATLAB utilizes the maximum number of cores, regardless of the number requested''', and therefore, you have to explicitly specify the number of threads in your code.158 These functions automatically execute on multiple threads if the data size is large enough. 159 Note that on Cypress, by default, ~~MATLAB runs with a single threads~~, '''MATLAB utilizes the maximum number of cores, regardless of the number requested''', and therefore, you have to explicitly specify the number of threads in your code. 146 160 For example, 147 161 {{{#!matlab … … 164 178 }}} 165 179 166 In above code, the line,180 In the above code, the line, 167 181 {{{#!matlab 168 182 LASTN = maxNumCompThreads(str2num(getenv('SLURM_JOB_CPUS_PER_NODE'))); … … 224 238 }}} 225 239 226 ''!CreateWorker.m'' is a M atlabcode to create workers.240 ''!CreateWorker.m'' is a MATLAB code to create workers. 227 241 {{{#!matlab 228 242 % Parallel Tool Box Test "CreateWorker.m" … … 281 295 282 296 === Running MATLAB with Automatic Offload === 283 Internally MATLAB uses Intel MKL Basic Linear Algebra Subroutines (BLAS) and Linear Algebra package (LAPACK) routines to perform the underlying computations when running on Intel processors.297 Internally, MATLAB uses Intel MKL Basic Linear Algebra Subroutines (BLAS) and Linear Algebra package (LAPACK) routines to perform the underlying computations when running on Intel processors. 284 298 285 299 Intel MKL includes Automatic Offload (AO) feature that enables computationally intensive Intel MKL functions to offload partial workload to attached '''Intel Xeon Phi''' coprocessors automatically and transparently. … … 312 326 enables Intel MKL Automatic Offload (AO). 313 327 314 The sample co se is below:328 The sample code is below: 315 329 {{{#!matlab 316 330 % … … 357 371 * Effective Work Division 358 372 * Time spent on Host during call 359 * Time spent on each available Phi coprocessor during call373 * Time spent on each available Phi coprocessor during the call 360 374 361 375 * Setting OFFLOAD_REPORT to 2 results in a report including everything from 1, and in addition:
