フィルターのクリア

Pass a Matlab Function handle to mex file in GPU computing

2 ビュー (過去 30 日間)
Qun Wu
Qun Wu 2017 年 9 月 6 日
編集済み: Walter Roberson 2017 年 9 月 20 日
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)

回答 (1 件)

Joss Knight
Joss Knight 2017 年 9 月 9 日
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.
  1 件のコメント
Qun Wu
Qun Wu 2017 年 9 月 19 日
I am making a Matlab GUI where the user can input the ODE model of a system and some related parameters. And then it shows the result of some control algorithm. I need the model to do some calculations in GPU device. So I try to find a way to pass the model to GPU. Thank you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by