0

Suppose I have a GPU and driver version supporting unified addressing; two GPUs, G0 and G1; a buffer allocated in G1 device memory; and that the current context C0 is a context for G0.

Under these circumstances, is it legitimate to cuMemcpy() from my buffer to host memory, despite it having been allocated in a different context for a different device?

So far, I've been working under the assumption that the answer is "yes". But I've recently experienced some behavior which seems to contradict this assumption.

einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

1

Calling cuMemcpy from another context is legal, regardless of which device the context was created on. Depending on which case you are in, I recommend the following:

  • If this is a multi-threaded application, double-check your program and make sure you are not releasing your device memory before the copy is completed
  • If you are using the cuMallocAsync/cuFreeAsync API to allocate and/or release memory, please make sure that operations are correctly stream-ordered
  • Run compute-sanitizer on your program

If you keep experiencing issues after these steps, you can file a bug with NVIDIA here.

Anis Ladram
  • 667
  • 3
  • 5