MATLAB Answers

GPU CODER Unresolved extern function '_Z22mwGet​GlobalThre​adIndexv'

1 view (last 30 days)
jelin leslin
jelin leslin on 5 Jun 2020
Answered: Chao Luo on 6 Jul 2020
I am trying to compile a mex GPU code in my matlab but I get this error(attached) .I had the same error when I compiled the GPU generated source code in Visual studio but I solved it by making rdc-true in Generate relocatable device code . I dont know how to resolve this in MATLAB.

Answers (1)

Chao Luo
Chao Luo on 6 Jul 2020
Hi Jelin,
The issue is the generated CUDA code InformationFilterUpdate.cu calls a device function mwGetGlobalThreadIndex in another CUDA file, MWCudaDimUtility.cu. In this case, you need to pass "-rdc=true" to nvcc, and link the device code using nvcc.
I don't think mexcuda supports either of them. You can not pass flags to nvcc and you can not use nvcc to link the object files with mexcuda.
The solution I suggest is to modify InformationFilterUpdate.cu to copy the device functions it calls to the file. We have fixed this issue in the coming 20b release by moving the device functions to the header. For now, you can try replacing MWCudaDimUtility.hpp with the file I attached here, which is copied from 20b release.
Chao

Tags

Products

Community Treasure Hunt

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

Start Hunting!