cuda-context

What does cudaSetDevice() do to a CUDA device's context stack?

僤鯓⒐⒋嵵緔 提交于 2020-08-08 07:02:08
问题 Suppose I have an active CUDA context associated with device i , and I now call cudaSetDevice(i) . What happens? : Nothing? Primary context replaces the top of the stack? Primary context is pushed onto the stack? It actually seems to be inconsistent. I've written this program, running on a machine with a single device: #include <cuda.h> #include <cuda_runtime_api.h> #include <cassert> #include <iostream> int main() { CUcontext ctx1, primary; cuInit(0); auto status = cuCtxCreate(&ctx1, 0, 0);

Can multiple processes share one CUDA context?

无人久伴 提交于 2020-05-15 09:26:21
问题 This question is a followup on Jason R's comment to Robert Crovellas answer on this original question ("Multiple CUDA contexts for one device - any sense?"): When you say that multiple contexts cannot run concurrently, is this limited to kernel launches only, or does it refer to memory transfers as well? I have been considering a multiprocess design all on the same GPU that uses the IPC API to transfer buffers from process to process. Does this mean that effectively, only one process at a