GPU Coder: compilation error
16 views (last 30 days)
Show older comments
I am trying to create a MEX function from the following simple function:
function G = ft2(g, delta)
% Input
% - g: gpuArray, double, complex, size: N x N
% - delta: double, size: 1 x 1
G = fftshift(fft2(fftshift(g))) * delta^2;
end
Although the MEX generation was successful when I specify the input g as a double array (non-gpuArray), it was not successful when I specify it as a double gpuArray. The build was successful but the compilation seems to have failed. The buildLog is like below:
----
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(197): error #256: invalid redeclaration of type name "size_t"
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\vcruntime_new.h(48): error #351: first parameter of allocation function must be of type "size_t"
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\type_traits(407): error #247: class template "std::_Is_memfunptr" has already been defined
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\crt/common_functions.h(117): error #351: first parameter of allocation function must be of type "size_t"
....
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\sm_32_intrinsics.hpp(132): error #3041: asm operand type size(8) does not match type/size implied by constraint 'r'
Error limit reached.
100 errors detected in the compilation of "C:/Users/Daigo/AppData/Local/Temp/tmpxft_00002b68_00000000-10_ft2_initialize.cpp1.ii".
Compilation terminated.
ft2_initialize.cu
ninja: build stopped: subcommand failed.
----
There are more than 100 error messages. It seems like they have something to do with C complier and CUDA toolkit. I cannot imagine how much effort I will need to fix all the issues in the log. Does anyone have advice on the use of GPU Coder?
0 Comments
Accepted Answer
Kumar Pallav
on 23 Mar 2022
Hi,
Please go through the installation and configuration deatils for GPU coder.
Prerequisites for GPU coder: Installing Prerequisite Products - MATLAB & Simulink (mathworks.com)
Setting up prerequisites: Setting Up the Prerequisite Products - MATLAB & Simulink (mathworks.com)
GPU environment check and setup app: The GPU Environment Check and Setup App - MATLAB & Simulink (mathworks.com)
After the above prerequisites, you can follow the example in documentation for code generation using GPU coder app.
Hope it helps!
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with GPU Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!