User Tools

Site Tools


matlab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
matlab [2022/06/05 15:31]
root
matlab [2022/06/05 19:44] (current)
root
Line 11: Line 11:
 </code> </code>
  
-==GPU computing==+==Benchmarks==
  
 Matlab in recent years has recently added a number of modern features such as GPU support, big data analysis and machine learning.   A simple benchmark follows for CPU vs GPU code to find the eigenvalues of a fairly large matrix. Matlab in recent years has recently added a number of modern features such as GPU support, big data analysis and machine learning.   A simple benchmark follows for CPU vs GPU code to find the eigenvalues of a fairly large matrix.
Line 25: Line 25:
 </code> </code>
  
-This requires about 2700 seconds on 32-core Intel nodes and 5300 seconds on 64-core AMD nodes.  Matlab matrix functions make extensive use of Intel MKL and are often more performant on Intel systems.  Also Intel AVX512 functions not present on AMD may be significant.+This requires about 2700 sec on 32-core Intel nodes and 5300 sec on 64-core AMD nodes.  Matlab matrix functions make extensive use of Intel MKL and are often more performant on Intel systems. To what degree that is deliberate on the part of Intel is disputed.  Also Intel AVX512 functions not present on AMD may be significant.  With an older version of Matlab and MKL, that time on AMD is reduced to 4400 sec.
  
-The GPU version is selected in code, commands are the same.  Initializing the first array as gpuArray is sufficient to use the available GPU functions, see [[https://www.mathworks.com/help/parallel-computing/gpu-computing-in-matlab.html]]  GPU and CPU multithreading are more effective on functions such as ''eig()'' than in serial Matlab code.+<code> 
 +module load mkl/19.0.5 matlab/R2019b 
 +</code> 
 + 
 +Matlab doesn't use module-loaded MKL (it has its own copy) but mkl versions < 20 on AMD in our module set this environment variable, see [[https://www.mathworks.com/matlabcentral/answers/330889-does-matlab-perform-well-on-amd-ryzen]] 
 + 
 +<code> 
 +MKL_DEBUG_CPU_TYPE=5 
 +</code> 
 + 
 +which improves the performance on AMD of MKL versions less than 20, which correspond to Matlab versions less than 2020. 
 + 
 +==GPU computing== 
 + 
 +The GPU version is selected in code, commands are the same.  Initializing the first array as gpuArray is sufficient to use the available GPU functions, see [[https://www.mathworks.com/help/parallel-computing/gpu-computing-in-matlab.html]]  GPU and CPU multithreading are much more effective on functions such as ''eig()'' than in serial Matlab code, which mostly requires changes such as ''parfor()'' for speedup.
  
 <code> <code>
Line 48: Line 62:
  
 [[https://research.unsw.edu.au/document/UNSW_Parallel%20Computing%20with%20MATLAB.pdf]] [[https://research.unsw.edu.au/document/UNSW_Parallel%20Computing%20with%20MATLAB.pdf]]
 +
 +[[https://www.hpc.iastate.edu/guides/using-matlab-parallel-server]]
matlab.1654443063.txt.gz · Last modified: 2022/06/05 15:31 by root