Pass a Matlab Function handle to mex file in GPU computing
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to pass a Matlab function(.m file) which is for the math operation only to one mex file. the mex file is for GPU computing including one _global_ type function and several _device_ type functions. I want to pass the .m file to one of the device functions for calculations.
Following some posters online, I find the method that is able to integrate C++ shared library. http://www.mathworks.com/help/compiler_sdk/cxx/c-shared-library-target-1.html?#responsive_offcanvas
However, it seems that the method can only pass the function to mex instead of to _device_ type function in mex file. I got some errors when calling the generated .dll from _device_ type function since the method is using mwArray class which is including some host functions. And we can not call host function from device function. Can you please give me any suggestions? Thank you.
Qun
(newie to GPU)
0 comentarios
Respuestas (1)
Joss Knight
el 9 de Sept. de 2017
Hi Qun. What you appear to be trying to do is have a GPU run a MATLAB function. This, I'm afraid, is impossible. MATLAB is running on the host. Only the host can issue eval commands to MATLAB.
If you can be more specific about what you're trying to do then perhaps we can come up with a solution that doesn't require you to rewrite your MATLAB function in CUDA C++. For instance, you may find you can use gpuArray/arrayfun to execute your code, with no need to use MEX at all.
Ver también
Categorías
Más información sobre GPU Computing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!