I do aim to use only one context (I don't know why I would want more than one; 
the stuff I'm doing is mostly serial but the memory shouldn't leave the GPU).

> On 31. Jul 2018, at 09:16, Bogdan Opanchuk <[email protected]> wrote:
> 
> First of all, are you using multiple contexts or a single one? If you only 
> have one context, `Thread(pycuda.autoinit.context)` should be enough for 
> Reikna (don't know about scikit-cuda, though).
> 
> Now if you have several contexts, things become more complicated. CUDA 
> maintains a global context stack, if you want to use a specific context, you 
> have to make sure it is on top of the stack (using corresponding PyCUDA 
> functions). For Reikna, you must use a `Thread` object created for a specific 
> context (or anything derived from it) only when that context is active.
> 
> On Tue, Jul 31, 2018 at 5:07 PM, Rasmus Diederichsen 
> <[email protected] <mailto:[email protected]>> wrote:
> I don't know cuda really and use the 3 libraries mentioned in the subject. I 
> time and again run into CUDA errors of the form "Invalid resource handle" 
> which appear in some cases, but not in others, i.e. the same function will 
> error or not depending on what ran before it, even if totally unrelated. I 
> gather from this that it has to do with state in CUDA, possibly mismanaging 
> contexts. But since it's hard to reproduce without all my code, I can't open 
> issues about this, so hopefully someone can just give me general pointers.
> 
> I am using the `pycuda.autoinit.context` for all the Reikna `Thread`s.
> Neither reikna nor scikit-cuda seem to have functionality for setting context 
> globally or passing it to functions
> I have tried using my own context instead, but meet the same issues
> 
> What are the steps in general to ensure these issues don't come up? How can I 
> handle this when multiple files are in play?
> 
> Cheers,
> Rasmus
> 
> _______________________________________________
> PyCUDA mailing list
> [email protected] <mailto:[email protected]>
> https://lists.tiker.net/listinfo/pycuda 
> <https://lists.tiker.net/listinfo/pycuda>
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
PyCUDA mailing list
[email protected]
https://lists.tiker.net/listinfo/pycuda

Reply via email to