필터 지우기
필터 지우기

mex: link of ' "mexGPUExample.mexa64"' failed

조회 수: 5 (최근 30일)
Þ™
Þ™ 2013년 11월 27일
답변: Jan Barowski 2015년 2월 25일
>> setenv('MW_NVCC_PATH','/usr/local/cuda-5.5/bin/nvcc') >> mex mexGPUExample.cu /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): In function `atexit': (.text+0x12): undefined reference to `__cxa_atexit' collect2: error: ld returned 1 exit status
mex: link of ' "mexGPUExample.mexa64"' failed.
Unable to complete successfully.
>> >>
how to solve it?

답변 (3개)

Þ™
Þ™ 2013년 11월 27일
I got it,I update my g++-4.4,so it worked.

Joao
Joao 2014년 6월 26일
I also have this problem in a linux mint 17 Matlab R2014a cuda5.5 setup. Changing the gcc/g++ version from 4.8 to 4.7.3 did not fix the mex error.
my Matlab output is
///
>> mex -largeArrayDims mexGPUExample.cu
Building with 'nvcc'.
Error using mex
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): In function `atexit':
(.text+0x12): undefined reference to `__cxa_atexit'
collect2: error: ld returned 1 exit status
///
In matlab, mexing .c and .cpp files works, and in the command line nvcc .cu files works as well.
Any ideas?

Jan Barowski
Jan Barowski 2015년 2월 25일
I got the same error using Matlab 2015 Prerelease on Ubuntu 14.04 with CUDA 6.5 and g++4.8. Thanks to Matlab support we figured out, that manually linking does the trick. Here is my compile script for the matlab mex/gpu example:
myArch = computer('arch'); pathToOpts = fullfile(matlabroot, ... 'toolbox', 'distcomp', 'gpu', ... 'extern', 'src', 'mex', myArch,'gcc',... ['mex_CUDA_' myArch '.xml']); copyfile(pathToOpts,'.','f')
mex -v -largeArrayDims mexGPUExample.cu -lstdc++ -lc
Hope this helps!

카테고리

Help CenterFile Exchange에서 GPU CUDA and MEX Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by