필터 지우기
필터 지우기

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 CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by