mexcuda gives unsupported GNU version error
Mostrar comentarios más antiguos
I am trying to call my custom CUDA kernel funciton (C++) from MatLab. I got an error about gcc version, and I need a help to solve it.
When I run
mexcuda -v kernel_func.cu
I got the follwing error:
In file included from /usr/include/cuda_runtime.h:83,
from <command-line>:
/usr/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc
versions later than 8 are not supported!
138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
| ^~~~~
Error in mexcuda (line 168)
[varargout{1:nargout}] = mex(mexArguments{:});
Matlab version is R2022a (I also tried R2019b and got the same error). nvcc version is 11.7 (I also tryied nvcc version 10.1 and got the same error).
The default gcc / g++ version is 9. So, I tryied to set gcc-8 as follows.
mexcuda GCC=/usr/bin/g++-8 CPPLIB_DIR=/usr/lib/gcc/x86_64-linux-gnu/8/libstdc++.so VER=8 -v kernel_func.cu
Although it seems the configuration was modified and used gcc-8, I got the same error. The following is a part of printed configuraiton.
Compiler location: /home/kfujii2/miniconda3/envs/grid_random/bin/nvcc
CXX : /home/kfujii2/miniconda3/envs/grid_random/bin/nvcc
INCLUDE : -I"/usr/local/bin/matlab-R2022a_Linux/extern/include" -I"/usr/local/bin/matlab-R2022a_Linux/simulink/include" -I"/usr/local/bin/matlab-R2022a_Linux/toolbox/parallel/gpu/extern/include/" -I"/home/kfujii2/miniconda3/envs/grid_random/include"
LD="gcc"
LDXX="/usr/bin/g++-8"
CUDA_ROOT : /home/kfujii2/miniconda3/envs/grid_random
LIBDEVICE : /home/kfujii2/miniconda3/envs/grid_random/nvvm/libdevice
CUDA_LIBS : /usr/local/bin/matlab-R2022a_Linux/bin/glnxa64
GCC : /usr/bin/g++-8
CPPLIB_DIR : /usr/lib/gcc/x86_64-linux-gnu/8/libstdc++.so
VER : 8
GCCDIR : /usr
GCC_TARGET : x86_64-linux-gnu
MATLABROOT : /usr/local/bin/matlab-R2022a_Linux
ARCH : glnxa64
To make sure, I checked nvcc version from Matlab command prompt:
>>!which nvcc
/home/kfujii2/miniconda3/envs/grid_random/bin/nvcc
>> !nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0
When I call the kernel function from C++ main function, GPU works fine. What am I missing? How can I solve this error?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with GPU Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!