Problem concerning GPU coder

1 view (last 30 days)
Kireeti Bodduna
Kireeti Bodduna on 7 Jun 2022
Answered: Infinite_king on 4 Oct 2023
Below is the content with the final error of the log file from the GPU coder in Matlab.
Could someone help me in letting me know why nvcc cannot find -lcublas as written at the end of the log file?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[1/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" cpp_mexapi_version.cpp -o build/glnxa64/cpp_mexapi_version.o
[2/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" rt_nonfinite.cpp -o build/glnxa64/rt_nonfinite.o
[3/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" PF_mother_terminate.cu -o build/glnxa64/PF_mother_terminate.o
[4/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" PF_mother_initialize.cu -o build/glnxa64/PF_mother_initialize.o
[5/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" PF_mother_emxutil.cu -o build/glnxa64/PF_mother_emxutil.o
[6/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" MWCudaDimUtility.cu -o build/glnxa64/MWCudaDimUtility.o
[7/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" interface/_coder_PF_mother_info.cu -o build/glnxa64/_coder_PF_mother_info.o
[8/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" PF_mother_data.cu -o build/glnxa64/PF_mother_data.o
[9/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" interface/_coder_PF_mother_mex.cu -o build/glnxa64/_coder_PF_mother_mex.o
[10/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" interface/_coder_PF_mother_api.cu -o build/glnxa64/_coder_PF_mother_api.o
[11/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" MWLaunchParametersUtilities.cu -o build/glnxa64/MWLaunchParametersUtilities.o
[12/13] nvcc -rdc=true -Xcompiler -fPIC,-ansi,-fexceptions,-fno-omit-frame-pointer,-pthread -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE -Xcompiler -fvisibility=hidden -Xcompiler -std=c++11 -I "." -I "/home/kireeti/KLens/video_related_files" -I "./interface" -I "/usr/local/MATLAB/R2020a/extern/include" -I "." -DMW_CUDA_ARCH=350 -DMODEL=PF_mother_mex -DMW_NEEDS_VERSION_H -c -arch sm_35 -I "/usr/local/MATLAB/R2020a/simulink/include" -I "/usr/local/MATLAB/R2020a/toolbox/shared/simtargets" PF_mother.cu -o build/glnxa64/PF_mother.o
[13/13] nvcc build/glnxa64/rt_nonfinite.o build/glnxa64/PF_mother_data.o build/glnxa64/PF_mother_initialize.o build/glnxa64/PF_mother_terminate.o build/glnxa64/PF_mother.o build/glnxa64/_coder_PF_mother_api.o build/glnxa64/_coder_PF_mother_mex.o build/glnxa64/PF_mother_emxutil.o build/glnxa64/_coder_PF_mother_info.o build/glnxa64/MWCudaDimUtility.o build/glnxa64/MWLaunchParametersUtilities.o build/glnxa64/cpp_mexapi_version.o -Xlinker --no-undefined -shared -Xlinker --as-needed -Xlinker -rpath-link,/usr/local/MATLAB/R2020a/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/bin/glnxa64" -Xlinker -rpath-link,/usr/local/MATLAB/R2020a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -o PF_mother_mex.mexa64 -lemlrt -lcovrt -lut -lmwmathutil -arch sm_35 -lcudart -lcublas -lcusolver -lcufft -lcuda -lc -Xnvlink -w -Wno-deprecated-gpu-targets
FAILED: PF_mother_mex.mexa64
nvcc build/glnxa64/rt_nonfinite.o build/glnxa64/PF_mother_data.o build/glnxa64/PF_mother_initialize.o build/glnxa64/PF_mother_terminate.o build/glnxa64/PF_mother.o build/glnxa64/_coder_PF_mother_api.o build/glnxa64/_coder_PF_mother_mex.o build/glnxa64/PF_mother_emxutil.o build/glnxa64/_coder_PF_mother_info.o build/glnxa64/MWCudaDimUtility.o build/glnxa64/MWLaunchParametersUtilities.o build/glnxa64/cpp_mexapi_version.o -Xlinker --no-undefined -shared -Xlinker --as-needed -Xlinker -rpath-link,/usr/local/MATLAB/R2020a/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/bin/glnxa64" -Xlinker -rpath-link,/usr/local/MATLAB/R2020a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -o PF_mother_mex.mexa64 -lemlrt -lcovrt -lut -lmwmathutil -arch sm_35 -lcudart -lcublas -lcusolver -lcufft -lcuda -lc -Xnvlink -w -Wno-deprecated-gpu-targets
/usr/bin/ld: cannot find -lcublas
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Answers (1)

Infinite_king
Infinite_king on 4 Oct 2023
Hi,
I understand that you are facing an issue while using GPU Coder.
The error is possibly occurring because “cuBLAS” was not installed on your system or it was not installed in the default path.
% Default path
'/usr/local'
To check whether cuBLAS is installed on your system, please look for the “include” folder containing cublas.h. The path should be as follows
% include path
'/usr/local/cuda/include/cublas.h'
% If CUDA Toolkit was installed in 'path_to_cuda_root'
'<path_to_cuda_root>/cuda/include/cublas.h'
The issue you are facing can be resolved by reinstalling the NVIDIA HPC SDK or CUDA Toolkit.
For more information refer the following documentation
  1. https://www.mathworks.com/help/gpucoder/ref/gpucoder.html
  2. https:/www.mathworks.com/help/gpucoder/ref/gpucodersetup-app.html
  3. https://developer.nvidia.com/cublas
Hope this is helpful.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!