Discussion:
pycuda execute error
(too old to reply)
张鲁宁
1970-01-01 00:00:00 UTC
Permalink
I successfully installed pycuda,by install the Microsoft VC compiler for python 2.7, but when i executing the test code, it comes out a new error . The tarceback is too long to read,I have no clue about it,could anybody offer me some help again please? thank you so much.


from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print f.maker.fgraph.toposort()
t0 = time.time()
for i in xrange(iters):
r = f()
t1 = time.time()
print 'Looping %d times took' % iters, t1 - t0, 'seconds'
print 'Result is', r
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print 'Used the cpu'
else:
print 'Used the gpu'
张鲁宁
1970-01-01 00:00:00 UTC
Permalink
I successfully installed pycuda,by install the Microsoft VC compiler for python 2.7, but when i executing the test code, it comes out a new error . The tarceback is too long to read,I have no clue about it,could anybody offer me some help again please?


I dont know how to set the .theanorc.txt, I copied it from net and edit it a little,i dont know how to make all these thing rignt, ,intalling cuda 7.5 also dont work.... I really need your help,have you met this situation? I use vs2010, anaconda 2, use pip intall to install theano and pycuda,Use conda install mingw libpython, os is win7 64bit,my gpu is GTX770m,and set all the env varible to path,but while using cpu,the code can run correctly,but after setting it to gpu, it comes out a lot error. I was so depressedThank you advance.


from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print f.maker.fgraph.toposort()
t0 = time.time()
for i in xrange(iters):
r = f()
t1 = time.time()
print 'Looping %d times took' % iters, t1 - t0, 'seconds'
print 'Result is', r
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print 'Used the cpu'
else:
print 'Used the gpu'
Peter Walsh
2017-03-29 11:35:11 UTC
Permalink
CUDA sdk only supports certain specific versions of visual studio.

Note that Microsoft VC compiler for Python is NOT the same thing as visual
studio! You need both of these installed.

I suggest you install vs2013 community edition (free). Then try to run the
pure c++ cuda samples. If that all works ok then move on to testing pycuda.
Post by 张鲁宁
I successfully installed pycuda,by install the Microsoft VC compiler for
python 2.7, but when i executing the test code, it comes out a new error .
The tarceback is too long to read,I have no clue about it,could anybody
offer me some help again please?
I dont know how to set the .theanorc.txt, I copied it from net and edit
it a little,i dont know how to make all these thing rignt, ,intalling cuda
7.5 also dont work.... I really need your help,have you met this situation?
I use vs2010, anaconda 2, use pip intall to install theano and pycuda,Use
conda install mingw libpython, os is win7 64bit,my gpu is GTX770m,and set
all the env varible to path,but while using cpu,the code can run
correctly,but after setting it to gpu, it comes out a lot error. I was so
depressedThank you advance.
1. from theano import function, config, shared, sandbox
2. import theano.tensor as T
3. import numpy
4. import time
5.
6. vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
7. iters = 1000
8.
9. rng = numpy.random.RandomState(22)
10. x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
11. f = function([], T.exp(x))
12. print f.maker.fgraph.toposort()
13. t0 = time.time()
15. r = f()
16. t1 = time.time()
17. print 'Looping %d times took' % iters, t1 - t0, 'seconds'
18. print 'Result is', r
19. if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.
20. print 'Used the cpu'
22. print 'Used the gpu'
_______________________________________________
PyCUDA mailing list
https://lists.tiker.net/listinfo/pycuda
Chris O'Halloran
2017-03-29 20:02:19 UTC
Permalink
Hi all,

I've just had success install pycuda with Visual Studio 2015 Community
Edition following these instructions.

https://msdn.microsoft.com/en-us/library/dd831853.aspx

I started by not installing any add-on or development environments just
Visual Studio

Then create a Visual C++ project so that the Windows SDK(?) gets installed.
I was short on disk space so I was avoiding all cruft.

Then amend the system path to find the cl.exe. See the instruction here
https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_PyCUDA_On_Anaconda_For_Windows?lang=en

Note I installed Visual Studio first so that the Cuda installer then picks
up that Visual Studio is installed. Cuda 8 support Visual Studio 2015.

Then Anaconda for the python environment. Note the additional lib required.

conda install libpython mingw
https://weiminwang.blog/2015/10/25/installing-cuda-7-5-and-pycuda-on-windows-for-testing-theano-with-gpu/

Then pycuda

You'll then find the Nvidia samples have Visual Studio projects that you
can begin to tinker with.

My experience so far is compiling is much slower on Windows that in Linux -
same machine. but that could be my inexperience with Visual Studio or that
I'm a little short on disk space (still have 8GB ram though).

Perhaps this helps,

Chris
Post by Peter Walsh
CUDA sdk only supports certain specific versions of visual studio.
Note that Microsoft VC compiler for Python is NOT the same thing as visual
studio! You need both of these installed.
I suggest you install vs2013 community edition (free). Then try to run the
pure c++ cuda samples. If that all works ok then move on to testing pycuda.
Post by 张鲁宁
I successfully installed pycuda,by install the Microsoft VC compiler for
python 2.7, but when i executing the test code, it comes out a new error .
The tarceback is too long to read,I have no clue about it,could anybody
offer me some help again please?
I dont know how to set the .theanorc.txt, I copied it from net and edit
it a little,i dont know how to make all these thing rignt, ,intalling cuda
7.5 also dont work.... I really need your help,have you met this situation?
I use vs2010, anaconda 2, use pip intall to install theano and pycuda,Use
conda install mingw libpython, os is win7 64bit,my gpu is GTX770m,and set
all the env varible to path,but while using cpu,the code can run
correctly,but after setting it to gpu, it comes out a lot error. I was so
depressedThank you advance.
1. from theano import function, config, shared, sandbox
2. import theano.tensor as T
3. import numpy
4. import time
5.
6. vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
7. iters = 1000
8.
9. rng = numpy.random.RandomState(22)
10. x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
11. f = function([], T.exp(x))
12. print f.maker.fgraph.toposort()
13. t0 = time.time()
15. r = f()
16. t1 = time.time()
17. print 'Looping %d times took' % iters, t1 - t0, 'seconds'
18. print 'Result is', r
19. if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.
20. print 'Used the cpu'
22. print 'Used the gpu'
_______________________________________________
PyCUDA mailing list
https://lists.tiker.net/listinfo/pycuda
_______________________________________________
PyCUDA mailing list
https://lists.tiker.net/listinfo/pycuda
Loading...