Discussion:
[PyCUDA] a beginner wants help
elodw
2014-07-07 18:48:48 UTC
Permalink
Hello,

i want to start with pycuda and had a very beginner question:

ok, the header lines are clear,
same to_gpu statement and the get statement,
thats it.

What is the problem defined in Python:

a=array[1000,100]

for i in range(1000-1):
for j in range(i+1,1000):
calculate euclidean difference between a[i] and a[j]

can i do this without using an extra kernel
if i need a kernel how looks it

thanks in advance
Ernst
Andreas Kloeckner
2014-07-09 02:22:06 UTC
Permalink
Dear Ernst,
Post by elodw
ok, the header lines are clear,
same to_gpu statement and the get statement,
thats it.
a=array[1000,100]
calculate euclidean difference between a[i] and a[j]
can i do this without using an extra kernel
if i need a kernel how looks it
I'm afraid, PyCUDA's arrays are not currently smart enough to do this,
so you'll need to write your own kernel. I unfortunately can't write
that for you, but you should be able to take a look at the CUDA docs and
give it a shot.

Hope that helps,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140708/b03d0988/attachment.sig>
elodw
2014-07-09 07:57:34 UTC
Permalink
Thank You very much Andreas,

Your hint helps me very much.
I know now, where i have to go on
and where not.

Ernst
Post by Andreas Kloeckner
Dear Ernst,
Post by elodw
ok, the header lines are clear,
same to_gpu statement and the get statement,
thats it.
a=array[1000,100]
calculate euclidean difference between a[i] and a[j]
can i do this without using an extra kernel
if i need a kernel how looks it
I'm afraid, PyCUDA's arrays are not currently smart enough to do this,
so you'll need to write your own kernel. I unfortunately can't write
that for you, but you should be able to take a look at the CUDA docs and
give it a shot.
Hope that helps,
Andreas
Loading...