MATLAB: Coder.checkGpuInstall() error

errorgpuGPU Coder

Hello,
when I'm running the coder.checkGpuInstall() command, I'm getting the following output.
>> coder.checkGpuInstall();
Host CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
------------------------------------------------------------------------
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0: Permission denied
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0/x86_64-linux-gnu: not found
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0/backward: Permission denied
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: %INCLUDE%: not found

gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0: Permission denied
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0/x86_64-linux-gnu: not found
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: /usr/include/c++/6.4.0/backward: Permission denied
gpuSimpleTest_mex.sh: 13: ./setEnv.sh: %INCLUDE%: not found
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "gpuSimpleTest_data.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "gpuSimpleTest_initialize.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "gpuSimpleTest_terminate.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "gpuSimpleTest.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "interface/_coder_gpuSimpleTest_info.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "interface/_coder_gpuSimpleTest_api.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "interface/_coder_gpuSimpleTest_mex.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "MWCudaDimUtility.cu"
nvcc -c -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Wno-deprecated-declarations -arch sm_35 -I "/usr/local/MATLAB/R2018b/simulink/include" -I "/usr/local/MATLAB/R2018b/toolbox/shared/simtargets" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0/codegen/mex/gpuSimpleTest" -I "/tmp/tpbaf8b361_989d_48c7_be02_539e57f665a0" -I "./interface" -I "/usr/local/MATLAB/R2018b/extern/include" -I "." "cpp_mexapi_version.cpp"
nvcc -Xlinker --version-script,gpuSimpleTest_mex_mex.map gpuSimpleTest_data.o gpuSimpleTest_initialize.o gpuSimpleTest_terminate.o gpuSimpleTest.o _coder_gpuSimpleTest_info.o _coder_gpuSimpleTest_api.o _coder_gpuSimpleTest_mex.o MWCudaDimUtility.o cpp_mexapi_version.o -Xlinker --no-undefined -shared -Xlinker --as-needed -Xlinker -rpath-link,/usr/local/MATLAB/R2018b/bin/glnxa64 -L/usr/local/MATLAB/R2018b/bin/glnxa64 -Xlinker -rpath-link,/usr/local/MATLAB/R2018b/extern/bin/glnxa64 -L/usr/local/MATLAB/R2018b/extern/bin/glnxa64 -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -Xnvlink -w -Wno-deprecated-gpu-targets -o gpuSimpleTest_mex.mexa64 -arch sm_35 -Xlinker -lcuda -lcudart -lemlrt -lcovrt -lut -lmwmathutil -lc
nvlink fatal : Input file '/usr/local/MATLAB/R2018b/bin/glnxa64/libcudadevrt.a:cuda_device_runtime.o' newer than toolkit (91 vs 90)
gmake: *** [gpuSimpleTest_mex.mexa64] Error 1
------------------------------------------------------------------------
??? Build error: C++ compiler produced errors. See the Build Log for further details.
Code generation failed: View Error Report
Code Generation : FAILED (Test GPU code generation failed with the following error 'emlc:compilationError'.)
Compatible GPU : PASSED
cuDNN Environment : PASSED
Because of the "Permission denied" error, I run MATLAB with sudo and I checked the permissons for the 6.4.0 folder. I changed them, so that everyone has access to the corresponding folder. I although checked that the Environment Variables point to the right directories.
After running the gpuDevice command I get the following output:
CUDADevice with properties:
Name: 'GeForce GTX 1080 Ti'
Index: 1
ComputeCapability: '6.1'
SupportsDouble: 1
DriverVersion: 9.1000
ToolkitVersion: 9.1000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 1.1720e+10
AvailableMemory: 1.1092e+10
MultiprocessorCount: 28
ClockRateKHz: 1620000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
The operating system of the PC is Ubuntu 16.04 and I have never worked with Linux before. Does anybody have an idea what causes the error?
Thank you very much!

Best Answer

The problem was solved by a reinstallation of Ubuntu.
Related Question