After finally getting around getting the GPU doing some computations with simple numbers and vectors successfully, I decided it was time to move on writing some kernels that can take in large amounts of experimental data from file.
However I cant seem to get nvcc to compile code that includes any form of IO code. My simple test example is
/usr/include/c++/4.4/ext/atomicity.h(46): error: identifier “__sync_fetch_and_add” is undefined
/usr/include/c++/4.4/ext/atomicity.h(50): error: identifier “__sync_fetch_and_add” is undefined
2 errors detected in the compilation of “/tmp/tmpxft_00000c77_00000000-4_Powerspec.cpp1.ii”.
I tried using both the stdio.h and iosteam libraries since I figured that might be the cause, but I get the same error in all cases. I hope someone can spread some light on how to tackle this problem since I have been unable to locate anything about it in the CUDA material I have on hand. Thanks in advance.
Yes I am using gcc 4.4. If that is a problem can you recommend another compiler to use instead that will work? And since I am using ubuntu, will it be enough to get it through its package system and just install it. Or do I need to do something to CUDA as well to make it work ?
Okay I found out i had gcc-4.3 installed already, since I had ubuntu 9.04 back when I installed CUDA and it worked fine. I did however upgrade to 9.10 when it was released. I just assumed that everything still worked since all my CUDA projects could still compile, but they of course did not include any IO commands except printf() which worked fine.
I have been reading over that other thread, and I must admit that I am at a loss about what it says.
The only makefile related to CUDA I can find is with the SDK. But I guess those are not the ones meant.
I figure that I need to make sure that the command gcc and g++ relates to their 4.3 variants instead of the 4.4 ones.
So my question is how do I make nvcc use 4.3 instead. Do I have to make a local makefile in the folder I am in that specify it or type in some sort of command before I try to compile ? Please bear in mind that I am not an expert linux user.
Thanks for your help and comments so far btw.
I have a similar problem here. I tried to change the compiler as you suggested. But I have others errors.
Anyone can help please?
nanoscope@lpmvpc25:~/Desktop/project$ sudo ln -sf /usr/bin/gcc-4.3 /usr/bin/gcc
nanoscope@lpmvpc25:~/Desktop/project$ sudo ln -sf /usr/bin/g++-4.3 /usr/bin/g++
nanoscope@lpmvpc25:~/Desktop/project$ g++ --version
g++ (Ubuntu 4.3.4-10ubuntu1) 4.3.4
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
nanoscope@lpmvpc25:~/Desktop/project$ gcc --version
gcc (Ubuntu 4.3.4-10ubuntu1) 4.3.4
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
nanoscope@lpmvpc25:~/Desktop/project$ nvcc unf_max_cuda.cu
unf_max_cuda.cu(95): error: identifier "_ZSt4cout" is undefined
unf_max_cuda.cu(95): error: identifier "_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_" is undefined
2 errors detected in the compilation of "/tmp/tmpxft_0000121f_00000000-5_unf_max_cuda.cpp2.i".
If I remove a line where appear just a “cout” and an “endl” I get this:
I have a similar problem here. I tried to change the compiler as you suggested. But I have others errors.
Anyone can help please?
nanoscope@lpmvpc25:~/Desktop/project$ sudo ln -sf /usr/bin/gcc-4.3 /usr/bin/gcc
nanoscope@lpmvpc25:~/Desktop/project$ sudo ln -sf /usr/bin/g++-4.3 /usr/bin/g++
nanoscope@lpmvpc25:~/Desktop/project$ g++ --version
g++ (Ubuntu 4.3.4-10ubuntu1) 4.3.4
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
nanoscope@lpmvpc25:~/Desktop/project$ gcc --version
gcc (Ubuntu 4.3.4-10ubuntu1) 4.3.4
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
nanoscope@lpmvpc25:~/Desktop/project$ nvcc unf_max_cuda.cu
unf_max_cuda.cu(95): error: identifier "_ZSt4cout" is undefined
unf_max_cuda.cu(95): error: identifier "_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_" is undefined
2 errors detected in the compilation of "/tmp/tmpxft_0000121f_00000000-5_unf_max_cuda.cpp2.i".
If I remove a line where appear just a “cout” and an “endl” I get this: