gcc version: 4.4.1
cuda toolkit: 2.3
While compiling .cu (cuda) file with c/c++ code developer usually will get following error.
/usr/include/c++/4.4/ext/atomicity.h(46): error: identifier "__sync_fetch_and_add" is undefinedIt seems still there are problems while compiling cuda with gcc 4.4 and above.
/usr/include/c++/4.4/ext/atomicity.h(50): error: identifier "__sync_fetch_and_add" is undefined
I found only this way to workaround this problem.
nvcc --device-emulation --compiler-bindir=/usr/bin/gcc-4.3 -arch sm_13 main.cu -o run
- --device-emulation: for cuda supporting device emulation in case if real hardware is not available.
- --compiler-bindir=/usr/bin/gcc-4.3: to use gcc version 4.3 this will solve the problem.
- -arch sm_13: in case if atomic function are used in implementation, compiles with 1.3 cuda supporting hardware
Excelent! Adding "--compiler-bindir=/usr/bin/gcc-4.3" after nvcc really solved the problem "__sync_fetch_and_add is undefined".
ReplyDeleteIt started to happen after upgrading to Ubuntu 10.04.
Thanks
[]'s