Artur,

Artur Makhmutov <mahmutov....@gmail.com> writes:
> I am not sure if this is the right place to ask for a tech support, 
> please ignore the message if it is not.
>
> My problem is described as follows: I am trying to run one of the 
> example scripts (I use ubuntu, pycharm with venv python virtual 
> environment):
>
>> |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.size * a.dtype.itemsize) 
>> cuda.memcpy_htod(a_gpu, a) mod = SourceModule(""" __global__ void 
>> doublify(float *a) { int idx = threadIdx.x + threadIdx.y*4; a[idx] *= 
>> 2; } """) func = mod.get_function("doublify") func(a_gpu, 
>> block=(4,4,1)) a_doubled = numpy.empty_like(a) 
>> cuda.memcpy_dtoh(a_doubled, a_gpu) print ("original array:") print (a) 
>> print ("doubled with kernel:") print (a_doubled)|
> And I get the following error:
>
> (snip)
> But if I run it with the 'python test.py' from the terminal itself, 
> thenĀ  it executes just fine:
>
>> |(test380) art@HP:~/PycharmProjects/pycuda$ python test.py original 
>> array: [[ 0.63286567 -0.5732655 0.0824481 0.17147891] [-0.24867015 
>> -2.4119377 -0.41027954 -0.67181575] [-1.2339077 -1.23354 1.0630324 
>> 0.3807849 ] [-1.5976559 -1.5595584 -0.03161036 -0.50650793]] doubled 
>> with kernel: [[ 1.2657313 -1.146531 0.1648962 0.34295782] [-0.4973403 
>> -4.8238754 -0.8205591 -1.3436315 ] [-2.4678154 -2.46708 2.1260648 
>> 0.7615698 ] [-3.1953118 -3.1191168 -0.06322072 -1.0130159 ]] |
> I wonder if it supposed to work like that or am I missing something? I 
> have checked the .bashrc file, nvcc --version, gcc --version and other 
> hints from the manual, everything seems to be correct. Would much 
> appreciate your help.

See if you can run

os.system("nvcc --help")

from within PyCharm. (I suspect not.) If not, then PyCharm is changing
your $PATH so that nvcc is no longer visible. If so, then you should ask
the PyCharm folks how to fix that.

HTH,
Andreas

Attachment: signature.asc
Description: PGP signature

_______________________________________________
PyCUDA mailing list -- pycuda@tiker.net
To unsubscribe send an email to pycuda-le...@tiker.net

Reply via email to