Changes between Initial Version and Version 1 of cypress/RunningMATLABwithXeonPhi


Ignore:
Timestamp:
08/27/2026 04:35:02 PM (8 days ago)
Author:
fuji
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • cypress/RunningMATLABwithXeonPhi

    v1 v1  
     1=== Running MATLAB with Automatic Offload ===
     2This feature is no longer available since MATLAB R2020a.
     3
     4Internally, 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.
     5
     6Intel MKL includes the Automatic Offload (AO) feature that enables computationally intensive Intel MKL functions to offload partial workload to attached '''Intel Xeon Phi''' coprocessors automatically and transparently.
     7
     8As a result, MATLAB performance can benefit from Intel Xeon Phi coprocessors via the Intel MKL AO feature when problem sizes are large enough to amortize the cost of transferring data to the coprocessors.
     9
     10In SLURM script, make sure that option '''--gres=mic:1''' is set and ''intel-psxe'' module as well as the MATLAB module has been loaded.
     11
     12{{{#!bash
     13#!/bin/bash
     14#SBATCH --qos=normal            # Quality of Service
     15#SBATCH --job-name=matlabAO     # Job Name
     16#SBATCH --time=1:00:00          # WallTime
     17#SBATCH --nodes=1               # Number of Nodes
     18#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
     19#SBATCH --cpus-per-task=1       # Number of threads per task (OMP threads)
     20#SBATCH --gres=mic:1            # Number of Co-Processors
     21
     22module load matlab
     23module load intel-psxe
     24
     25export MKL_MIC_ENABLE=1
     26matlab  -nodesktop -nodisplay -nosplash -r "MatTest; exit;"
     27}}}
     28
     29Note that
     30{{{#!bash
     31export MKL_MIC_ENABLE=1
     32}}}
     33enables Intel MKL Automatic Offload (AO).
     34
     35The sample code is below:
     36{{{#!matlab
     37%
     38% Matrix test "MatTest.m"
     39%
     40A = rand(10000, 10000);
     41B = rand(10000, 10000);
     42tic;
     43C = A * B;
     44realT = toc;
     45fprintf('Real Time = %f(sec)\n',realT);
     46}}}
     47
     48
     49
     50See [https://wiki.hpc.tulane.edu/trac/wiki/cypress/Matlab#CompiledMatlab]
     51
     52{{{#!bash
     53#!/bin/bash
     54#SBATCH --qos=normal            # Quality of Service
     55#SBATCH --job-name=matlabAO     # Job Name
     56#SBATCH --time=1:00:00          # WallTime
     57#SBATCH --nodes=1               # Number of Nodes
     58#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
     59#SBATCH --cpus-per-task=1       # Number of threads per task (OMP threads)
     60#SBATCH --gres=mic:1            # Number of Co-Processors
     61
     62module load matlab
     63module load intel-psxe
     64mcc -m MatTest.m
     65export MKL_MIC_ENABLE=1
     66./MatTest
     67}}}
     68
     69To generate the offload report at run time,
     70{{{
     71export OFFLOAD_REPORT=2
     72}}}
     73
     74* Setting OFFLOAD_REPORT to 0 (or not setting it) results in no offload report.
     75
     76* Setting OFFLOAD_REPORT to 1 results in a report including:
     77 * Name of function called
     78 * Effective Work Division
     79 * Time spent on Host during call
     80 * Time spent on each available Phi coprocessor during the call
     81
     82* Setting OFFLOAD_REPORT to 2 results in a report including everything from 1, and in addition:
     83 * Amount of data transferred to and from each Phi during call