Cuda compiler not working with GCC 4.5 +

前端 未结 5 1358
野性不改
野性不改 2020-12-21 12:55

I am new to Cuda, and I am trying to compile this simple test_1.cu file:

#include 

__global__ void kernel(void)
{
}

int main (v         


        
5条回答
  •  清歌不尽
    2020-12-21 13:41

    In my case I didn't have root rights, so I couldn't fully replace the current gcc (4.7) with the older version 4.4 (which I think would be a bad alternative). Although I did have rights where CUDA was installed. My solution was to create an extra folder (e.g. /somepath/gccfornvcc/), wherever I had rights, then to create a link to an nvcc accepted compiler. I already had gcc 4.4 available (but you can install it, without removing your current version).

    ln -s [path to gcc 4.4]/gcc-4.4 /somepath/gccfornvcc/gcc
    

    Then, in the same folder where the nvcc binary lives, you should find a file called nvcc.profile . There you just need to add the following line:

    compiler-bindir = /somepath/gccfornvcc
    

    And that will make nvcc use the proper compiler. This helps keeping the system in a proper state, keeping the newest compiler, but nvcc (only nvcc) will use the old compiler version.

提交回复
热议问题