Matlab with XeonPhi
Using automtaic-offload to XeonPhi. The key is to tell Matlab to use MKL subroutine for blas and lapack
Example
- matlab.m
version -blas version -lapack getenv('MKL_MIC_ENABLE') % generate random n x n matrix A = rand(25000); % Matrix Multiply tic B = A * A; toc % LU Matrix Factorization tic B = lu(A); toc
SGE script
#!/bin/bash #$ -q xphi.q #S -l h_vmem=10G #$ -l excl ##request exclusive access # load Matlab and Intel environment module load intel/mic module load matlab ## Tell matlab to use MKL export BLAS_VERSION=$MKLROOT/lib/intel64/libmkl_rt.so export LAPACK_VERSION=$MKLROOT/lib/intel64/libmkl_rt.so export MKL_MIC_MAX_MEMORY=16G # This single line allows MKL to decide whether to offload # certain matrix operations to one or both MICs export MKL_MIC_ENABLE=1 # This next line reports what was # offloaded to the MIC export OFFLOAD_REPORT=2 # Run program matlab -nodisplay -nosplash < matrix.m