ubuntu - CUDA and gcc compatibility issue -
i getting error
/usr/local/cuda-5.0/bin/../include/host_config.h:82:2: error: #error -- unsupported gnu version! gcc 4.7 , not supported! make: * [src/throughput.o] error 1
in host_config.h assure compatibility 4.6
#if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 6) #error -- unsupported gnu version! gcc 4.7 , not supported!
i have both 4.6 , 4.7
elect@elect-desktop:/usr/local/cuda-5.0/bin$ gcc gcc gcc-4.7 gcc-nm-4.7 gcc-4.6 gcc-ar-4.7 gcc-ranlib-4.7
looking on net suggest add together link gcc-4.6 in cuda bin directory.
so did
elect@elect-desktop:/usr/local/cuda-5.0/bin$ sudo ln -s /usr/bin/gcc-4.6 gcc
and error
**** build of configuration debug project throughput **** create building file: ../src/throughput.cu invoking: nvcc compiler nvcc -g -g -o0 -gencode arch=compute_20,code=sm_20 -odir "src" -m -o "src/throughput.d" "../src/throughput.cu" gcc: error trying exec 'cc1plus': execvp: no such file or directory make: *** [src/throughput.o] error 1 **** build finished ****
googling 1 time again didn't bring me on clear situations (gcc downgrading, etc)
so asking here problem since cuda supposed compatible gcc-4.6 ...
my system:
ubuntu 12.10 64b cuda_5.0.35_linux_64_ubuntu11.10-1this tutorial code trying compile @ moment
/** * copyright 1993-2012 nvidia corporation. rights reserved. * * please refer nvidia end user license understanding (eula) associated * source code terms , conditions rule utilize of * software. use, reproduction, disclosure, or distribution of * software , related documentation outside terms of eula * strictly prohibited. */ #include <stdio.h> #include <stdlib.h> static const int work_size = 256; /** * macro checks homecoming value of cuda runtime phone call , exits * application if phone call failed. */ #define cuda_check_return(value) { \ cudaerror_t _m_cudastat = value; \ if (_m_cudastat != cudasuccess) { \ fprintf(stderr, "error %s @ line %d in file %s\n", \ cudageterrorstring(_m_cudastat), __line__, __file__); \ exit(1); \ } } __device__ unsigned int bitreverse(unsigned int number) { number = ((0xf0f0f0f0 & number) >> 4) | ((0x0f0f0f0f & number) << 4); number = ((0xcccccccc & number) >> 2) | ((0x33333333 & number) << 2); number = ((0xaaaaaaaa & number) >> 1) | ((0x55555555 & number) << 1); homecoming number; } /** * cuda kernel function reverses order of bits in each element of array. */ __global__ void bitreverse(void *data) { unsigned int *idata = (unsigned int*) data; idata[threadidx.x] = bitreverse(idata[threadidx.x]); } /** * host function prepares info array , passes cuda kernel. */ int main(void) { void *d = null; int i; unsigned int idata[work_size], odata[work_size]; (i = 0; < work_size; i++) idata[i] = (unsigned int) i; cuda_check_return(cudamalloc((void**) &d, sizeof(int) * work_size)); cuda_check_return(cudamemcpy(d, idata, sizeof(int) * work_size, cudamemcpyhosttodevice)); bitreverse<<<1, work_size, work_size * sizeof(int)>>>(d); cuda_check_return(cudathreadsynchronize()); // wait gpu launched work finish cuda_check_return(cudagetlasterror()); cuda_check_return(cudamemcpy(odata, d, sizeof(int) * work_size, cudamemcpydevicetohost)); (i = 0; < work_size; i++) printf("input value: %u, device output: %u\n", idata[i], odata[i]); cuda_check_return(cudafree((void*) d)); cuda_check_return(cudadevicereset()); homecoming 0; }
the problem stems cuda toolchain not beingness able find valid c++ compiler. nvcc
compiler driver, requires working c++ compiler compile code.
the right way [note using unsupported linux version, utilize advice @ own risk], set local directory holding links supported compiler suite (this mean matching, supported verions of gcc , g++) , pass --compiler-bindir
argument nvcc
when compile. example:
$ ls -l $home/cuda/bin total 16 lrwxr-xr-x 1 talonmies koti 16 feb 9 12:41 g++ -> /usr/bin/g++-4.2 lrwxr-xr-x 1 talonmies koti 16 feb 9 12:41 gcc -> /usr/bin/gcc-4.2
here have set of links supported compiler. can compile this:
$ nvcc --compiler-bindir=$home/cuda/bin -c -arch=sm_12 -xptxas="-v" nanobench.cu ptxas info : 0 bytes gmem ptxas info : compiling entry function '_z5benchifli128000eevpjpt_i' 'sm_12' ptxas info : used 5 registers, 28 bytes smem, 12 bytes cmem[1]
this safest , to the lowest degree invasive way utilize alternative compilers scheme compiler not supported.
gcc ubuntu cuda
No comments:
Post a Comment