David G Grier <david.gr...@nyu.edu> writes:

> I am using pycuda to compute holograms for an optical trapping
> application that uses PyQt4 for a GUI front end.  I would like to move
> the pycuda computation into a QThread to keep the GUI responsive.
>
> Is there an up-to-date working example of "the right way" to move a
> pycuda computational object into a QThread using moveToThread?
> Despite much searching, I have not turned up sample code.  The
> pycuda FAQ addresses subclassing threads, but not moveToThread
> method of QThread.
>
> The following minimal example of a "do nothing" background
> object appears to work correctly.  It creates an object,
> moves it into a thread, creates a pycuda context for the object in
> its thread, and then stops the object by quitting the thread.
> Before I dig deeper, can anyone confirm that this is the right approach?
> Or am I missing something

As long as you make a new context for each thread (and destroy it at the
end) as you do, you should be OK.

Andreas

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
https://lists.tiker.net/listinfo/pycuda

Reply via email to