cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

neko
Adept I

Is it possible to access the same host pinned buffer from multiple devices of same/different context(s) ?

Hi,

as a part of simplifying and optimization of our code we would like to use the same host pinned buffer across multiple devices, where:

1.)     each device is a part of the same context with its own queue and all reads/writes over this buffer will be enqueued into the queue of only one device at the same time.

2.)     same as 1 except that devices can be part of different contexts

The second variant is preferred since we would like to use more than one platform at time.

If none of this solution is correct or standard, is there any way how to achieve this ?

0 Likes
1 Solution
thesmith
Adept I

Hi,

1) I never tried it myself, but AFAIK it will work.

2) This is not possible with pure OpenCL. When creating a Buffer object, notice how you pass the context as a parameter. That Buffer object is valid only in the specified context:


Buffer(const Context &context, cl_mem_flags flags, ::size_t size, void *host_ptr = NULL, cl_int *err = NULL);



View solution in original post

0 Likes
1 Reply
thesmith
Adept I

Hi,

1) I never tried it myself, but AFAIK it will work.

2) This is not possible with pure OpenCL. When creating a Buffer object, notice how you pass the context as a parameter. That Buffer object is valid only in the specified context:


Buffer(const Context &context, cl_mem_flags flags, ::size_t size, void *host_ptr = NULL, cl_int *err = NULL);



0 Likes