P.S. Fixes include corrected invocations of prepare() and prepared_call(),
of course.


On Thu, Sep 4, 2014 at 12:46 PM, Bogdan Opanchuk <manti...@gmail.com> wrote:

> Hi Bruce,
>
> Looks like the docs for Function.prepare() are a bit outdated, I've
> created a PR for that. As for the example, since I cannot register on the
> wiki (some cryptic error appears), I've created a gist with the corrected
> version: https://gist.github.com/Manticore/6ff4400cde2750e61bff
>
> Fixes:
> - Py3 safe
> - Fixed indentation in run_benchmark()
> - Fixed repetition of test sizes in run_benchmark()
> - Added labels to the graphs and some description to the output
>
> Best regards,
> Bogdan
>
>
> On Thu, Sep 4, 2014 at 12:03 PM, Bruce Labitt <bdlab...@gmail.com> wrote:
>
>> Hi Bogdan,
>>
>> Thanks for pointing that out.  It seems that is not the only error in
>> this example.  Adding a carriage return, and re-running yields a TypeError
>>
>> In [5]: run MatrixTranspose.py
>>
>> ---------------------------------------------------------------------------
>> TypeError                                 Traceback (most recent call
>> last)
>>
>> /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in
>> execfile(fname, *where)
>>     202             else:
>>     203                 filename = fname
>> --> 204             __builtin__.execfile(filename, *where)
>>
>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>> <module>()
>>      217
>>     218 #check_transpose()
>> --> 219 run_benchmark()
>>     220
>>     221
>>
>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>> run_benchmark()
>>     183
>>     184         for i in range(warmup):
>> --> 185             _transpose(target, source)
>>     186
>>     187         count = 10
>>
>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>> _transpose(tgt, src)
>>     118
>>     119 def _transpose(tgt, src):
>> --> 120     krnl = _get_transpose_kernel()
>>     121
>>     122     w, h = src.shape
>>
>>
>> <string> in _get_transpose_kernel()
>>
>> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/tools.pyc
>> in context_dependent_memoize(func, *args)
>>     421         context_dependent_memoized_functions.append(func)
>>     422         arg_dict = ctx_dict.setdefault(cur_ctx, {})
>> --> 423         result = func(*args)
>>     424         arg_dict[args] = result
>>     425         return result
>>
>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>> _get_transpose_kernel()
>>      51
>>      52     func = mod.get_function("transpose")
>> ---> 53     func.prepare("PPii", block=(block_size, block_size, 1))
>>      54
>>      55     from pytools import Record
>>
>> TypeError: function_prepare() got an unexpected keyword argument 'block'
>>
>> This TypeError occurs for
>> http://wiki.tiker.net/PyCuda/Examples/MatrixTranspose and the downloaded
>> wiki-examples (after fixing the double #defines on a line)
>>
>> Best regards,
>> Bruce
>>
>>
>>
>>
>>
>> On Wed, Sep 3, 2014 at 9:39 PM, Bogdan Opanchuk <manti...@gmail.com>
>> wrote:
>>
>>> Hi Bruce,
>>>
>>> Seems to be a typo in the Wiki. If you look at
>>> http://wiki.tiker.net/PyCuda/Examples/MatrixTranspose (where
>>> MatrixTranspose.py originally comes from), you can see in line 24 two
>>> "#define"s in one line. Incidentally, if someone has an account there,
>>> could you fix that?
>>>
>>> Best regards,
>>> Bogdan
>>>
>>>
>>> On Thu, Sep 4, 2014 at 11:24 AM, Bruce Labitt <bdlab...@gmail.com>
>>> wrote:
>>>
>>>> Probably not the desired response.  Can someone suggest a fix?
>>>> Thanks,
>>>> Bruce
>>>>
>>>> In [3]: run MatrixTranspose.py
>>>>
>>>> ---------------------------------------------------------------------------
>>>> CompileError                              Traceback (most recent call
>>>> last)
>>>> /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in
>>>> execfile(fname, *where)
>>>>     202             else:
>>>>     203                 filename = fname
>>>> --> 204             __builtin__.execfile(filename, *where)
>>>>
>>>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>>>> <module>()
>>>>     216
>>>>     217 #check_transpose()
>>>> --> 218 run_benchmark()
>>>>     219
>>>>     220
>>>>
>>>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>>>> run_benchmark()
>>>>     182
>>>>     183         for i in range(warmup):
>>>> --> 184             _transpose(target, source)
>>>>     185
>>>>     186         count = 10
>>>>
>>>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>>>> _transpose(tgt, src)
>>>>     117
>>>>     118 def _transpose(tgt, src):
>>>> --> 119     krnl = _get_transpose_kernel()
>>>>     120
>>>>     121     w, h = src.shape
>>>>
>>>> <string> in _get_transpose_kernel()
>>>>
>>>> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/tools.pyc
>>>> in context_dependent_memoize(func, *args)
>>>>     421         context_dependent_memoized_functions.append(func)
>>>>     422         arg_dict = ctx_dict.setdefault(cur_ctx, {})
>>>> --> 423         result = func(*args)
>>>>     424         arg_dict[args] = result
>>>>     425         return result
>>>>
>>>> /home/bruce/Apps/pycuda/examples/wiki-examples/MatrixTranspose.py in
>>>> _get_transpose_kernel()
>>>>      47         A_t[glob_idx_a_t] = A_shared[threadIdx.x][threadIdx.y];
>>>>      48     }
>>>> ---> 49     """% {"block_size": block_size})
>>>>      50
>>>>      51     func = mod.get_function("transpose")
>>>>
>>>> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/compiler.pyc
>>>> in __init__(self, source, nvcc, options, keep, no_extern_c, arch, code,
>>>> cache_dir, include_dirs)
>>>>     249
>>>>     250         cubin = compile(source, nvcc, options, keep,
>>>> no_extern_c,
>>>> --> 251                 arch, code, cache_dir, include_dirs)
>>>>     252
>>>>     253         from pycuda.driver import module_from_buffer
>>>>
>>>> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/compiler.pyc
>>>> in compile(source, nvcc, options, keep, no_extern_c, arch, code, cache_dir,
>>>> include_dirs)
>>>>     239         options.append("-I"+i)
>>>>     240
>>>> --> 241     return compile_plain(source, options, keep, nvcc, cache_dir)
>>>>     242
>>>>     243
>>>>
>>>> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/compiler.pyc
>>>> in compile_plain(source, options, keep, nvcc, cache_dir)
>>>>     130         raise CompileError("nvcc compilation of %s failed" %
>>>> cu_file_path,
>>>>     131                 cmdline, stdout=stdout.decode("utf-8",
>>>> "replace"),
>>>> --> 132                 stderr=stderr.decode("utf-8", "replace"))
>>>>     133
>>>>     134     if stdout or stderr:
>>>>
>>>> CompileError: nvcc compilation of /tmp/tmp5xdcrZ/kernel.cu failed
>>>> [command: nvcc --cubin -arch sm_30
>>>> -I/usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/cuda
>>>> kernel.cu]
>>>> [stderr:
>>>> kernel.cu(10): error: "#" not expected here
>>>>
>>>> kernel.cu(10): error: expected a ";"
>>>>
>>>> kernel.cu(12): error: identifier "A_T_BLOCK_STRIDE" is undefined
>>>>
>>>> 3 errors detected in the compilation of
>>>> "/tmp/tmpxft_00001e6b_00000000-6_kernel.cpp1.ii".
>>>> ]
>>>>
>>>> In [4]:
>>>>
>>>>
>>>> _______________________________________________
>>>> PyCUDA mailing list
>>>> PyCUDA@tiker.net
>>>> http://lists.tiker.net/listinfo/pycuda
>>>>
>>>>
>>>
>>
>
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to