Hi, all
ubuntu 12.04, pycuda 2011.2.2, python 2.7, gcc 4.6.3 , cuda 4.1, 64 bit machine.
I am running small test script which is giving error(script with error is given below).It says gcc 4.6 and higher not supported. So, i used this :
~$export CC = gcc-4.4
~$echo $CC returns gcc-4.4.
But, I am getting same error. Looks like python is still using gcc 4.6.3.
I typed ~$gcc --version and it returned gcc 4.6.3.
I just want gcc to change to 4.4 only in my account. I am avoiding ‘sudo’ command as i might cause any unwanted changes to others or maybe me too. Any suggestions ?
code and error are as follows (portion in bold results in error):
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
import numpy
a = numpy.random.randn(4,4)
a = a.astype(numpy.float32)
a_gpu = cuda.mem_alloc(a.nbytes)
cuda.memcpy_htod(a_gpu,a) mod = SourceModule(“”"
… global void doublify(float a)
… {
… int idx = threadIdx.x + threadIdx.y4
… a[idx] *=2;
… }
… “”") Traceback (most recent call last):
File “”, line 7, in
File “/usr/local/lib/python2.7/dist-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py”, line 283, in init
arch, code, cache_dir, include_dirs)
File “/usr/local/lib/python2.7/dist-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py”, line 273, in compile
return compile_plain(source, options, keep, nvcc, cache_dir)
File “/usr/local/lib/python2.7/dist-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py”, line 129, in compile_plain
cmdline, stdout=stdout, stderr=stderr)
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpS_7lJ_/kernel.cu failed
[command: nvcc --cubin -arch sm_11 -I/usr/local/lib/python2.7/dist-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/…/include/pycuda kernel.cu]
[stderr:
In file included from /usr/local/cuda/bin/…/include/cuda_runtime.h:59:0,
from :0:
/usr/local/cuda/bin/…/include/host_config.h:82:2: error: #error – unsupported GNU version! gcc 4.6 and up are not supported!
]
[5]+ Stopped python
I tried this too…@ubuntu:~$ ln -s -f /usr/bin/gcc-4.4 /usr/bin/gcc (edit: by mistake i wrote 4.1 here.) ln: cannot remove `/usr/bin/gcc’: Permission denied.
If permission of supersudo is needed, then it will change their gcc too.That i don’t want.
That’s the idea… But rather than overwriting the links, you can if you want have several directories with links to several different versions of gcc, one per directory. Then you select the one you want by simply adjusting your PATH, for pointing in priority to it.
And if you feel like installing a tool for doing it properly, I encourage you to have a look at the command “module”. Actually, I install it on all my machine for both having transparently as many concurrent versions of cuda and gcc installed.
gilles@laptop:~$ module av
------------------------------- /opt/modulefiles -------------------------------
cuda/4.0 cuda/4.2(default) gcc/4.4
cuda/4.1 cuda/5.0b gcc/4.5(default)
gilles@laptop:~$ module whatis
cuda/4.0 : loads the CUDA 4.0 tools
cuda/4.1 : loads the CUDA 4.1 tools
cuda/4.2 : loads the CUDA 4.2 tools
cuda/5.0b : loads the CUDA 5.0b tools
gcc/4.4 : GCC 4.4 (gcc, g++, gfortran) coming from Ubuntu
gcc/4.5 : GCC 4.5 (gcc, g++, gfortran) coming from Ubuntu
gilles@laptop:~$ gcc --version
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
Copyright (C) 2010 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.
gilles@laptop:~$ module load gcc/4.4
gilles@laptop:~$ gcc --version
gcc (Ubuntu/Linaro 4.4.5-15ubuntu1) 4.4.5
Copyright (C) 2010 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.