This shows a simple multiply by two cuda function called from MATLAB. I have CUDA 6.5 and gcc 4.8.1 and MATLAB R2015a. Take a look at this documentation https://www.mathworks.com/help/releases/R2013b/distcomp/run-mex-functions-containing-cuda-code.html
module load gcc/4.8.1 #Load if available on the cluster
module load cuda/6.5
module load MATLAB/r2015a
mcc -m test.m # -> 'test' #Compile matlab if running on clusterCompile the mex file
mex mexGPUExample.cu #First compile the mexCuda fileqsub cuda.sh