GPU Coder Build Error

1 Ansicht (letzte 30 Tage)
ding barry
ding barry am 16 Mai 2022
Beantwortet: Ram Kokku am 17 Dez. 2023
According to official documentation I run a GPUcoder example mandelbrot_count
This is official function,but get error in Check for Run-Time Issues step,
function count = mandelbrot_count(maxIterations,xGrid,yGrid) %#codegen
% Add kernelfun pragma to trigger kernel creation
coder.gpu.kernelfun;
% mandelbrot computation
z0 = xGrid + 1i*yGrid;
count = ones(size(z0));
z = z0;
for n = 0:maxIterations
z = z.*z + z0;
inside = abs(z)<=2;
count = count + inside;
end
count = log(count);
this is My device information, how Can I set the correct setting in this,Thank you

Antworten (2)

Infinite_king
Infinite_king am 13 Dez. 2023
Bearbeitet: Infinite_king am 13 Dez. 2023
Hi ding barry,
I understand that you are encountering an error while generating CUDA code for the 'mandelbrot_count' function using GPU Coder.
The cause of the error was incorrect code generation configuration settings. To generate the code without any errors, follow the steps below.
  • Create a GPU code generation configuration object.
% For mex
cfg = coder.gpuConfig('MEX');
% For static library
cfg = coder.gpuConfig('LIB');
% For Dynamic Linked library
cfg = coder.gpuConfig('DLL');
% For executable
cfg = coder.gpuConfig('EXE');
  • Enable or disable required libraries.
% set the value to 'false' to disable
% Enabling Nvidia cuFFT
cfg.GpuConfig.EnableCUFFT = true;
% Enabling Nvida cuBLAS
cfg.GpuConfig.EnableCUBLAS = true;
  • Set the required Compiler flags,
% For example
cfg.GpuConfig.CompilerFlags = '--fmad=false';
  • Generate the code using ‘codegen’ command
% arg1, arg2 … are the arguments
codegen mandelbrot_count -args {arg1,arg2,arg3} -nargout 1
  • You change the configuration settings of code generation in the app itself. In the ‘Check for Run-Time Issues’ screen, on the top right, you can find the ‘settings’ option
  • In the settings select GPU Code section, in which you can change the configuration settings.
For more information, refer the following MATLAB documentation,
  1. https://www.mathworks.com/help/gpucoder/gs/gpu-code-generation-the-mandelbrot-set.html
  2. https://www.mathworks.com/help/gpucoder/ref/coder.gpucodeconfig.html
  3. https://www.mathworks.com/help/coder/ref/codegen.html#d126e4648
Hope this is helpful.

Ram Kokku
Ram Kokku am 17 Dez. 2023
@ding barry - Looks like you encountered a bug in GPU Coder. I reported this to the team resposible.
Run-time checks is an optional step in code generation. You can skip this step and move on to code generation and verification. that should run just fine.

Kategorien

Mehr zu Get Started with GPU Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by