[ 에러 메시지 ]
$ make PATH="/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda-11.4/bin::." /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -arch=compute_50 -ptx compare.cu -o compare.ptx nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). /usr/include/stdio.h(189): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(201): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(223): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(260): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(285): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(294): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(303): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(309): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(315): error: attribute "__malloc__" does not take arguments /usr/include/stdio.h(830): error: attribute "__malloc__" does not take arguments /usr/include/stdlib.h(566): error: attribute "__malloc__" does not take arguments /usr/include/stdlib.h(570): error: attribute "__malloc__" does not take arguments /usr/include/stdlib.h(799): error: attribute "__malloc__" does not take arguments 13 errors detected in the compilation of "compare.cu". make: *** [Makefile:48: compare.ptx] Error 1
[ 원인 ]
내가 사용하는 cuda와 gcc 버전이 맞지 않는 문제였다. cuda 11.4라서 gcc 10을 사용해야 하는데 우분투 머신에 깔린 gcc는 11 이었음.
[ 해결책 ]
gcc 10 버전 설치
sudo apt-get install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
gcc --version