0

我在 Matlab 中有一个非常复杂的符号函数,我想在 GPU 上对其进行评估。

当我搜索时,为了评估,我们需要使用gpuArray,但是当我尝试使用以下代码在 GPU matlab 上评估函数时:

joint_pdf_function_handle = @(x1,x2)sqrt(1.99e+2).*1.0./pi.^2.*exp(2.4e+1./2.5e+1).*exp(sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x1).*2.0).*(sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x1).*2.0).*4.925125628140704e+1-sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x2).*2.0).*4.974874371859296e+1).*(-1.0./2.0)+(sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x2).*2.0).*(sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x1).*2.0).*4.974874371859296e+1-sqrt(2.0).*erfcinv(integral(@(x)(1.0./sqrt(x.^2+9.0).*besselk(1,sqrt(x.^2+9.0).*(4.0./2.5e+1)).*7.757157130525889e-1)./pi,-Inf,x2).*2.0).*4.925125628140704e+1))./2.0).*1.0./sqrt(x1.^2+9.0).*1.0./sqrt(x2.^2+9.0).*besselk(1,sqrt(x1.^2+9.0).*(4.0./2.5e+1)).*besselk(1,sqrt(x2.^2+9.0).*(4.0./2.5e+1)).*1.157788944723618e-1
x1_space = gpuArray.linspace(-10,10,25)  ;
x2_space = gpuArray.linspace(-10,10,25) ; 
[X Y] = meshgrid(x1_space,x2_space) ; 
F = arrayfun(joint_pdf_function_handle ,X, Y)  ;

然后我收到以下错误:

The function 'symengine' cannot be executed because it has resolved to the P-code file:
C:\Program Files\Polyspace\R2019a\toolbox\symbolic\symbolic\symengine.p

问题是如果我像这样在 CPU 上运行代码,它工作正常:

x1_space = linspace(-10,10,25)  ;
x2_space = linspace(-10,10,25) ; 
[X Y] = meshgrid(x1_space,x2_space) ; 
F = arrayfun(joint_pdf_function_handle ,X, Y)  ;

我将不胜感激您能提供的任何帮助。

4

0 回答 0