That is what I thought it was doing but for some reason, this call starts
looking for the kernel with the name "_source" in the binary. When it
throws an exception it gives me the error:

"[XRT] ERROR: kernel '_source' not found"

 we catch this error in our error messages. When I removed XRT error
catching system (I changed the code to not give an error if the kernel name
is _source), it goes into pyopencl and gives me the following error from
L450:

"'_source' was not found as a program info attribute or as a kernel name"

Best,
Shivangi Agarwal


On Sun, Jul 21, 2019 at 2:53 PM Andreas Kloeckner <li...@informa.tiker.net>
wrote:

> "Shivangi Agarwal" <shivangiagarwa...@gmail.com> writes:
> > Sorry about that...
> >
> > Yes, we do not support building from source since we provide the
> binaries.
> >
> > I am using v2019.1. I compiled from source and tried running my Hello
> World example again, but I am getting the same error. I am reattaching my
> pdb log:
> >
> > -> prg.hello(commands, (1, ), (1, ), d_buf)
> > (Pdb) s
> > --Call--
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(434)__getattr__()
> > -> def __getattr__(self, attr):
> > (Pdb) n
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(435)__getattr__()
> > -> try:
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(436)__getattr__()
> > -> knl = Kernel(self, attr)
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(439)__getattr__()
> > -> knl.num_args
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(440)__getattr__()
> > -> knl._source = getattr(self, "_source", None)
> > (Pdb) a
> > self = <pyopencl.Program object at 0x7f5c52c66e90>
> > attr = hello
> > (Pdb) s
> > --Call--
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(434)__getattr__()
> > -> def __getattr__(self, attr):
> > (Pdb) n
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(435)__getattr__()
> > -> try:
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(436)__getattr__()
> > -> knl = Kernel(self, attr)
> > (Pdb) a
> > self = <pyopencl.Program object at 0x7f5c52c66e90>
> > attr = _source
> > (Pdb) n
> > [XRT] ERROR: kernel '_source' not found
> > LogicError: <pyopenc...5280b110>
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(436)__getattr__()
> > -> knl = Kernel(self, attr)
> > (Pdb) n
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(449)__getattr__()
> > -> except LogicError:
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(450)__getattr__()
> > -> raise AttributeError("'%s' was not found as a program "
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(451)__getattr__()
> > -> "info attribute or as a kernel name" % attr)
> > (Pdb)
> > AttributeError: Attribut...l name",)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(451)__getattr__()
> > -> "info attribute or as a kernel name" % attr)
> > (Pdb)
> > --Return--
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(451)__getattr__()->None
> > -> "info attribute or as a kernel name" % attr)
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(442)__getattr__()
> > -> if self._build_duration_info is not None:
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(443)__getattr__()
> > -> build_descr, was_cached, duration = self._build_duration_info
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(444)__getattr__()
> > -> if duration > 0.2:
> > (Pdb)
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(448)__getattr__()
> > -> return knl
> > (Pdb)
> > --Return--
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(448)__getattr__()-><pyopenc...52c90b90>
> > -> return knl
> > (Pdb)
> > --Call--
> >>
> /usr/local/lib/python2.7/dist-packages/pyopencl/__init__.py(837)kernel_call()
> > -> def kernel_call(self, queue, global_size, local_size, *args,
> **kwargs):
> > (Pdb) c
> > Result: Hello World
> >
> >
> >
> > I put a breakpoint right before creating the 'hello' kernel. This calls
> __getattr___  in  __init__.py L 434. I kept stepping through the code and
> in L440, the arguments passed into "knl._source = getattr(self, "_source",
> None)" are:
> >
> > self = <pyopencl.Program object at 0x7f5c52c66e90>
> > attr = hello
> >
> > this calls the __getattr__ function in L434, but in L436, when creating
> the kernel "knl = Kernel(self, attr)" it passes in a different value for
> attr:
> >
> > self = <pyopencl.Program object at 0x7f5c52c66e90>
> > attr = _source
> >
> > This is where the code errors out.
>
> This is all as intended. (What it is trying to do is transfer the source
> code from the Program object to the Kernel object, for debugging
> purposes, if it is available.) When you say, "This is where the code
> errors out", what do you observe? (in particular, what error?)
>
> getattr(self, "_source", None)
>
> simply should not fail, as far as I can tell, so I am surprised to hear
> that it does. You are right that pyopencl should largely work without
> these two lines, but it is quite likely that you will cause other
> unpredictable problems in error paths down the line if you don't have
> them.
>
> Andreas
>
_______________________________________________
PyOpenCL mailing list -- pyopencl@tiker.net
To unsubscribe send an email to pyopencl-le...@tiker.net

Reply via email to