context from queue problem

27 views
Skip to first unread message

Samir Kharchi

unread,
Jun 28, 2016, 1:45:30 PM6/28/16
to boost-compute
Hi,

I am creating several context instances (one for each device) and put them in a vector.
For each context I also create a command_queue instance (initialised with the previously generated context instance and the according device) and put them in a vector.

Now, every time I call boost::compute::copy(v.begin(),v.end(),t.begin(),queue) then in command_queue::enqueue_copy_buffer the call to "BOOST_ASSERT(buffer.get_context() == this->get_context())" always triggers a break point.

While buffer.get_context() correctly points to my previously allocated context, this->get_context() always returns another pointer address.

Why is that (and how can this happen at all)? I only have a single GPU device, so my vector containers only contain a single context & queue instance (and as I only have that single gpu device, this is my default device).
Can you clarify or does somebody know why this happens?

Btw. doing this with a context and queue retrieved via ::default_xxx() etc. works fine. No crash with copy() or copy_async() (I tried both)

I must be missing something or not seeing it correctly.
Thanks in advacne
Cheers
Sam

for(auto& gpu : gpus)
{
   m_cl_contexts
.push_back(clgpu::context(gpu));
   m_cl_queues
.push_back(clgpu::command_queue(m_cl_contexts.back(),gpu));
}

P.S.: it's my second day with boost compute and I am loving it already btw.

Jakub Szuppe

unread,
Jun 28, 2016, 2:00:55 PM6/28/16
to boost-compute
Hi, 

Do you pass a context or an queue to the vector you create? If you do not, the default conxtext
and the default queue are used.

I'm glad to hear that you like Boost.Compute :)

Samir Kharchi

unread,
Jul 5, 2016, 3:08:42 PM7/5/16
to boost-compute
Hi Jakub!

first of all sorry for my delayed response (I was on vacation). And thank you very much, this indeed was it! It works now as it should :)

Cheers
Sam

Jakub Szuppe

unread,
Jul 5, 2016, 3:11:04 PM7/5/16
to boost-compute
Glad, I could help ;)
Reply all
Reply to author
Forward
0 new messages