Results 1 to 2 of 2

Thread: multiple contexts and devices

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    1

    multiple contexts and devices

    I have questions regarding contexts and multiple devices.

    Multiple devices can be attached to a single context.

    My questions are:
    1. If you have multiple devices (say 1 CPU and 2 GPU),
    when do you want share a context between devices?
    Or is it always better to have 1 device per context?

    2. Is there a good example of transferring buffers
    between different contexts?

    Thanks.

  2. #2

    Re: multiple contexts and devices

    Quote Originally Posted by brdavs
    My questions are:
    1. If you have multiple devices (say 1 CPU and 2 GPU),
    when do you want share a context between devices?
    Or is it always better to have 1 device per context?
    In most cases, you want one context that spans all devices. First, memory is transparently transferred between devices in the same context. Second, an event is only valid in a context where it was created, so synchronization is much simpler than if you have to do it manually for two contexts.

    Quote Originally Posted by brdavs
    2. Is there a good example of transferring buffers
    between different contexts?
    Well, transfer from the device in context 1 to host via clEnqueueReadBuffer and then copy it into the other buffer that is used by device in context 2 via clEnqueueWriteBuffer.

Similar Threads

  1. Replies: 5
    Last Post: 08-09-2011, 06:36 AM
  2. Replies: 3
    Last Post: 01-05-2011, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •