The lsqcurvefit Matlab function is used to fit the paramaters of a model curve to a real curve (acquired data from experiment or observation) so that de square differences are minimized. lsqcurvefit
The function is time consuming, and maybe prohibitive if used on large set of curves.
Can it be straightforwardly used inside a CUDA kernel, being then all the program coded in Matlab? (Edit: this is, without writing a custom version of lsqcurvefit in C for the kernel. For instance: write the kernel code in Matlab (using there "any" matlab function like lsqcurvefit()), then compile the kernel with a Matlab provided tool, and finally execute the kernel in the GPU, called from matlab host code).
Thanks
There are many ways to combine the capabilities of matlab with GPUs, but there isn't any matlab code that can be used in a CUDA kernel.
Related
I have recently purchased a P100 GPU in hopes of speeding up parallel code and need some help deciding how to translate MATLAB code into a CUDA code ( I've moved away from plain gpuarrays in MATLAB ). I have experimented with .ptx kernels and MEX-files and have run into some roadblocks with both.
The parallel code has elementwise exponentiation, elementwise multiplication, and FFT and IFFT calls. It also incorporates complex numbers.
Are .ptx files compiled from CUDA-kernels or MEX CUDA files easier to work with and which will allow me to perform my necessary FFT, IFFT, exp, and mult calls?
It's simple really. You have to use MEX because you want to call into the NVIDIA cufft library, which you can only do from the host. However, there are basically no circumstances in which you will get a reasonable speed-up over calling FFT and IFFT from MATLAB, because those functions just call directly into cufft, with the added advantage of MATLAB's GPU memory pool and FFT plan cache. So maybe you should focus on the element-wise kernels.
So I am using MATLAB for a project and am discussing the use of the power method for finding stationary distributions of Markov chains and its convergence rate. I was wondering what method/algorithms MATLAB's eig() function uses to find the eigenvectors of a matrix?
Normally Matlab is using LAPACK routines to do calculation. With that in mind I guess that from here you will be able to find the code that matlab runs. Be Aware LAPACK is in Fortran.
MATLAB Incorporates LAPACK
I like to use cuSolver code for Eigen value decomposition of complex matrix in Matlab.
I am using MATLAB CUDA kernel and it seems that its not possible to interface cuSolver with MATLAB as the cuSolver contains the code for host as well as for device (as mentioned here: http://docs.nvidia.com/cuda/cusolver/#syevd-example1)
while MATLAB CUDA kernel works only for the kernel function..
Please comment.
Any other idea to compute Eigenvalue decomposition of large no of matrices containing complex data in parallel on GPU by using Matlab environment?
You almost certainly need to use the MEX interface. This allows you to take in gpuArray data, and call kernels and other CUDA library functions.
See the doc: http://uk.mathworks.com/help/distcomp/run-mex-functions-containing-cuda-code.html for more.
do you know if MATLAB supports the LAPACK spptrf function.
This function is quite a bargain when you gotta compute Cholesky factorization of a huge positive definite symmetric matrix.
It allows for the factorization by only giving the upper triangular matrix, stored as uni-dimensional matrix, as input.
Or, else, is chol built-in function already using spptrf internally?
EDIT
I have been able to find the lapack library on the File Exchange http://www.mathworks.com/matlabcentral/fileexchange/16777-lapack, with the desired implementation of the spptrf function.
EDIT 2
MATLAB running on my machine is fatally crashing each time I call spptrf.
Is there any alternative way to directly handle this function?
I was wondering if there was a way to use the Bhattacharyya distance or kernel with SVM in Matlab?
I'm using the built-in SVM tool in Matlab and defining the Bhattacharyya as an external kernel function, but it seems like it can't be used this way (as in it's not a suitable kernel function).
Is there a known way to use it with SVM preferably in Matlab?
If not how can I find out more about how the default kernel functions work so that I can adjust the function to work?
Thank you.