I have a very Complicated symbolic function in Matlab and I want to evaluate it on GPU.
As I searched, for evaluation, we need to use gpuArray
but when I try to evaluate function on GPU matlab using this code :
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) ;
then I get following error :
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
the thing is if I run code on CPU like this, it works fine :
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) ;
I would appreciate any help you can provide.