Matlab Mexfiles and Cuda: Evaluate function handle?

No mexCallMATLAB will not be callable from the GPU. In general, host-side calls cannot be made from within the body of a CUDA Kernel.

No, mexCallMATLAB will not be callable from the GPU. In general, host-side calls cannot be made from within the body of a CUDA Kernel. You may find that if you have access to Parallel Computing Toolbox, you can use GPUArrays with arrayfun.

For example, if the function you wish to evaluate across many points looks like this: function y = myFcn( x ) y = 1; for ii = 1:10 y = sin(x * y); end Then you could call this on the GPU like so: gx = gpuArray( rand(1000) ); gy = arrayfun( @myFcn, gx ).

Woah thanks, I think this is the post I was looking for! Just the question now: How can I access this from my mex-file if I can't use mexCallMATLAB out of the CUDA kernel? – Col Heather May 8 '11 at 13:28 Actually, my suggestion is really not to use a CUDA kernel directly, but to use the arrayfun method as an alternative.

If you have existing CUDA code that you wish to run from within MATLAB, Parallel Computing Toolbox supports a "CUDAKernel" object to help with that. – Edric May 8 '11 at 17:43.

If your MEX function is written in C to run on the CPU, then there is no way for that function to run on the GPU without modification. An alternative approach providing a way to run MATLAB code on the GPU is to use Jacket which has support for most things people do in MATLAB.

I think you got me wrong. I wonder if the mexCallMATLAB can be evaluated on the GPU at all. So when I have a CUDA kernel in my C-mexfile (to run on GPU) with several function-evaluations like the code posted above (->call matlab feval-function via mexCallMATLAB), I wonder if they are executed on the GPU or on the CPU (since matlab runs on the CPU usually and so probably also the matlab-builtin function feval... – Col Heather May 5 '11 at 20:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions