Hi there,
I am trying to use Pycuda with a device kernel which recursively calls itself via dynamic parallelism. I do this with a 750Ti so it should be supported. I have also done some research on how to alter the command option list in the kernel source pycuda compile command. But I am still getting the error:
"cuModuleDataEx failed: named symbol not found - ".
Any ideas or pointers? Thanks,
Eric
---------------------------
Dr. Eric Michael Scheffel
Assistant Professor in Economics
University of Nottingham Business School China
Site: http://www.ericscheffel.com
This message and any attachment are intended solely for the addressee and may contain confidential information.
If you have received this message in error, please send it back to me, and immediately delete it.
Please do not use, copy or disclose the information contained in this message or in any attachment.
Any views or opinions expressed by the author of this email do not necessarily reflect the views of The University of Nottingham Ningbo China.
This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system:
you are advised to perform your own checks.
Email communications with The University of Nottingham Ningbo China may be monitored as permitted by UK and Chinese legislation.
1 i am actually solving pearson correlation coefficient (pcc)
2
3 import pycuda.driver as cuda
4 import pycuda.gpuarray as gpuarray
5 import pycuda.autoinit
6 from pycuda.compiler import SourceModule
7 import numpy as np
8 import time
9
10 start = time.time()
11 N = np.int32(512000)
12 block_size = 512
13 gridsize = N/block_size
14 x_cpu = np.random.randn(N).astype(np.float32)
15 x_gpu = gpuarray.to_gpu(x_cpu)
16
17 y_cpu = np.random.randn(N).astype(np.float32)
18 y_gpu = gpuarray.to_gpu(y_cpu)
19
20 #r = np.array(0).astype(np.float32)
21 res = gpuarray.empty_like(x_gpu)
22 xy_sum = gpuarray.sum(x_gpu * y_gpu)
23 x_sum = gpuarray.sum(x_gpu)
24 y_sum = gpuarray.sum(y_gpu)
25 sq_of_sum_of_x = gpuarray.sum(x_sum * x_sum)
26 #sq_of_sum_of_x = x_sum * y_sum # do in gpu
27 sq_of_sum_of_y = gpuarray.sum(y_sum * y_sum) # do in gpu
28 sum_of_ysq = gpuarray.sum(y_gpu * y_gpu)
29 sum_of_xsq = gpuarray.sum(x_gpu * x_gpu)
30 #res = gpuarray.sum(res1)
31 arr =
np.array([xy_sum,x_sum,y_sum,sq_of_sum_of_x,sq_of_sum_of_y,sum_of_ysq
,sum_of_xsq])
32 arr_gpu = gpuarray.to_gpu(arr)
33 print ("array=%s" %(arr))
# this is kernel1
34 '''kernels = SourceModule("""
35 __global__ void pcc(float *res,int N,float xy,float x,float y,float
sqsumx,float sqsumy,float sumysq, float sumxsq )'''
36
37 kernels = SourceModule("""
38 __global__ void pcc(float *res,int N, float *arr)
39 {
40 res[0] = arr[0];
41 // res[0] = 55;
42 // res[0]= (N * xy);// - (x * y)); //
43 // res[0] = sqrt((N * sqsumx - sumxsq)*(N * sqsumy - sumysq));
44 }
45 """)
46
47 cov = kernels.get_function("pcc")
48 cov(res,N,arr,block=(block_size,1,1),grid = (gridsize,1))
49 #####################################################################
#this second kernel
kernels = SourceModule("""
35 __global__ void pcc(float *res,int N,float xy,float x,float y,float
sqsumx,float sqsumy,float sumysq, float sumxsq )
39 {
40
41
42 res[0]= ((N * xy)- (x * y))/sqrt((N * sqsumx - sumxsq)*(N * sqsumy -
sumysq));
44 }
45 """)
cov = kernels.get_function("pcc")
cov(res,N,xy_sum,x_sum,y_sum,sq_of_sum_of_x,sq_of_sum_of_y,sum_of_ysq,sum_o
f_xsq,block=(block_size,1,1),grid = (gridsize,1))
50 ####################################################################
51 pcc = gpuarray.sum(res[0])
52 #pcc = gpuarray.sum((N * xy_sum - x_sum *
y_sum)/sqrt((N*sum_of_xsq-sq_of_su
m_of_x)*(N*sum_of_ysq-sq_of_sum_of_y)))
53 #print ("result of xy=%s" %(result))
54 print ("result of xy w/o kernal function = %s" %(xy_sum))
55 print ("result of x*x=%s" %(x_sum))
56 print ("result of y*y=%s" %(y_sum))
57 print ("result of sum of square of x=%s" %(sum_of_xsq))
58 print ("result of sum of square of y=%s" %(sum_of_ysq))
59 print ("result of sq_of_sum_of_x=%s" %(sq_of_sum_of_x))
60 print ("result of pcc=%s" %(pcc))
61 finish = time.time()
62 print("exection time =%s" %(finish-start))
please ignore the serial number
sir, if use kernel1 the i get error as
arr_gpu = gpuarray.to_gpu(arr)
File
"/opt/python/lib/python2.7/site-packages/pycuda-2016.1.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.py",
line 976, in to_gpu
result.set(ary)
File
"/opt/python/lib/python2.7/site-packages/pycuda-2016.1.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.py",
line 243, in set
_memcpy_discontig(self, ary, async=async, stream=stream)
File
"/opt/python/lib/python2.7/site-packages/pycuda-2016.1.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.py",
line 1192, in _memcpy_discontig
src = _as_strided(src, shape=(src.size,), strides=(src.dtype.itemsize,))
File
"/opt/python/lib/python2.7/site-packages/numpy/lib/stride_tricks.py",
line 32, in as_strided
array.dtype = x.dtype
TypeError: Cannot change data-type for object array.
and if i use kernel 2 the i get answer as
res[0] = 0.0
i.e it does not value from ((N * xy)- (x * y))/sqrt((N * sqsumx -
sumxsq)*(N * sqsumy - sumysq));
can you please help me out sir.
-----------------------------------------
___________________
D I S C L A I M E R
This e-mail may contain privileged information and is intended solely for
the individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail in error and
destroy it from your system. Though considerable effort has been made to
deliver error free e-mail messages but it can not be guaranteed to be secure
or error-free as information could be intercepted, corrupted, lost, destroyed,
delayed or incomplete, or may contain viruses. The recipient must verify
the integrity of this e-mail message.
Dnia 2016-07-02 03:25 Andreas Kloeckner napisał(a):
>Tomasz Rybak <tomasz.rybak(a)post.pl> writes:
>> Would you apply this patch in repository??
>> Debian has policy that python means Python 3, and python3 is for Python 3
>> interpreter.
>> If not - that's not a problem, now it is automatically applied during
>> building of Debian packages.
>
>Done.
>
Thanks.
Best regards.
Tomasz Rybak
I was trying to rebuild PyCUDA 2016.1.1 (as tagged on GitHub) package using
CUDA 7.5 and Sphinx 1.4.4.
There was warning regarding http to https redirect on documen.tician.de,
patch below:
Index: pycuda-2016.1.1/doc/source/conf.py
===================================================================
--- pycuda-2016.1.1.orig/doc/source/conf.py
+++ pycuda-2016.1.1/doc/source/conf.py
@@ -187,5 +187,5 @@ latex_documents = [
intersphinx_mapping = {
'http://docs.python.org/dev': None,
'http://docs.scipy.org/doc/numpy/': None,
- 'http://documen.tician.de/codepy/': None,
+ 'https://documen.tician.de/codepy/': None,
}
There was also error when building documentation, see the trace:
# Sphinx version: 1.4.4
# Python version: 2.7.12rc1 (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.8
# Last messages:
# Running Sphinx v1.4.4
# loading pickled environment...
# not yet created
# loading intersphinx inventory from
http://docs.python.org/dev/objects.inv...
# intersphinx inventory has moved: http://docs.python.org/dev ->
https://docs.python.org/dev
# loading intersphinx inventory from
https://documen.tician.de/codepy/objects.inv...
# loading intersphinx inventory from
http://docs.scipy.org/doc/numpy/objects.inv...
# building [mo]: targets for 0 po files that are out of date
# Loaded extensions:
# sphinx.ext.mathjax (1.4.4) from
/usr/lib/python2.7/dist-packages/sphinx/ext/mathjax.pyc
# alabaster (0.7.8) from
/usr/lib/python2.7/dist-packages/alabaster/__init__.pyc
# sphinx.ext.intersphinx (1.4.4) from
/usr/lib/python2.7/dist-packages/sphinx/ext/intersphinx.pyc
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/sphinx/cmdline.py", line 244, in
main
app.build(opts.force_all, filenames)
File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 298,
in build
self.builder.build_update()
File "/usr/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line
248, in build_update
to_build = list(to_build)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 174,
in get_outdated_docs
self.config_hash = get_stable_hash(cfgdict)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 59,
in get_stable_hash
return get_stable_hash(list(obj.items()))
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 59,
in get_stable_hash
return get_stable_hash(list(obj.items()))
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 59,
in get_stable_hash
return get_stable_hash(list(obj.items()))
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in get_stable_hash
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 61,
in <genexpr>
obj = sorted(get_stable_hash(o) for o in obj)
File "/usr/lib/python2.7/dist-packages/sphinx/builders/html.py", line 62,
in get_stable_hash
return md5(text_type(obj).encode('utf8')).hexdigest()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 0:
ordinal not in range(128)
This is caused by doc/source/conf.py, html_theme_options, which contains
Unicode characters for floppy and rocket. I did not have any problems with
PyOpenCL, probably because 2016.1 does not contain those glyphs.
Andreas - how have you built documentation for your web page? Is there some
special option for Sphinx I should use?
Best regards
Tomasz Rybak