Re: [PyOpenCL] Pyopencl pickle support

2016-08-17 Thread Andreas Kloeckner
Marcos Paulo Rocha  writes:
> But multithreading will suffer the problem of GIL doesn't it ?

Well, if you're doing it right, then all of your threads will either be
waiting for some OpenCL operation to complete or waiting for IO. Neither
of those is affected by the GIL.

Andreas

___
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl


Re: [PyOpenCL] Pyopencl pickle support

2016-08-17 Thread Marcos Paulo Rocha
In a application that i'm working, the programs is written in a form of a
graph. A example of part of one application is bellow:

[image: Inline image 1]
Each node of the graph is a different process. When a node receive all of
your inputs, he is ready to start. This way, concurrency occurs naturally
between some nodes of the graph.
One of the goals of the library that i'm working, is to make easy,
development of applications with the behavior of the image. The ideia is
that nodes: Nodes CP_IN, CP_OUT and EX_KERNEL can be used to abstract the
copy, kernel setup and invocation to the final user.
I hope that now i have make myself clear about my goals and you can help me
to solve this problem.

Thanks!
Best Regards,
Marcos Rocha


On Wed, Aug 17, 2016 at 1:35 PM, Andreas Kloeckner 
wrote:

> Marcos Paulo Rocha  writes:
> > Thanks for reply Andreas.
> > Andreas, i need to access PyOpenCL objects in another process because i'm
> > working in a dataflow library and i would like to make copy and kernels
> > calls in parallel. I'm doing asynchronous copies and need that process
> > responsible for executing kernel receive event object of copy and the
> > buffer to set as kernel parameter. So there is another way to achieve
> this
> > behavior without using pickle ?
>
> I'm not sure what goal the different processes achieve here. To do
> concurrent copy and kernel invocations, all you need is two different
> commandqueues (from a single thread even). Just submit the copies to one
> and the kernel to the other. They'll run in parallel if the hardware is
> capable of doing that.
>
> Andreas
>
___
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl


Re: [PyOpenCL] Pyopencl pickle support

2016-08-16 Thread Andreas Kloeckner
Hi Marcos,

Marcos Paulo Rocha  writes:
> Hi, i'm using multiprocessing and pyopencl and need to pass pyopencl
> objects between processes. The problem is that pyopencl objects aren't
> compatibles with pickle module, using by multiprocessing lib. Any idea to
> solve this problem ?

Honestly, the only PyOpenCL object that I could think of that we could
meaningfully pickle is a device. Contexts, command queues, buffers, and
all the other stuff are not likely to make sense in the context of
another process. (At the OpenCL API level they're pointers, and they
each carry substantial non-enumerable state that we just can't package
up.) But even for devices, you're probably better off sending (platform
name, device name, index) triples...

Sorry,
Andreas

___
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl