[sending to [email protected] again, I think I replied to the wrong
address last time so I'm not sure they ended up on the list]
On 2014-09-25 00:53, Andreas Kloeckner wrote:
Thomas Unterthiner <[email protected]> writes:
The C library uses the runtime API, thus it does not do any explicit
context management. It calls cudaDeviceReset() before it returns to
Python (which as far as I understand should undo any implicit context
allocations it did before, according to
http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/online/group__CUDART__DRIVER.html
).
If needed, I can see if I can provide a minimal C library that exhibits
the behavior. I just wanted to make sure I didn't have any mistakes in
my PyCUDA code beforehand.
I seem to remember that what Nvidia hacked together in terms of their
runtime/driver API
interoperability requires that the runtime API (in your case the C
library) be in charge of managing CUDA contexts.
Andreas
From what little I found by googling around, mixing runtime API/context
APIs seems to be quite a mess. I found no clear indication of how to
handle this within the C library. Do you by any chance have any
pointers? (I have forgotten to point this out before: I do have the
source code to the C library and can modify it if there's something I
can do from there. But I'd rather not rewrite the whole thing using the
driver API if it can be avoided).
Ideally what I'd want is to shut down PyCUDA completely before calling
the C library, and re-initializing it from the ground up again
afterwards. But for some reason this doesn't seem to work the way I
envisioned. So either
1) I forgot some steps when shutting down PyCUDA
2) I forgot some steps when re-initializing PyCUDA
3) the C library doesn't clean up properly before exiting
4) as both PyCUDA and the C library operate within the same
process/thread, I can't avoid some sort of co-dependence between the two
I was hoping it would be one of the cases 1-3, as these are probably
easiest to remedy. Can you confirm that I did 1 and 2 correctly (the
code I used for these two steps is included in the first email to the
list)?
Cheers
Thomas
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda