AnsweredAssumed Answered

multithreading and OpenCL?

Question asked by cipoint on Aug 14, 2013
Latest reply on Aug 17, 2013 by himanshu.gautam

Since I've installed a dual-GPU graphics card today I'm wondering how to utilize both GPUs using two independent host threads. The problem is that the program crashes without any error output as soon as I start the second thread, which initializes a completely new platform. The only difference between the two threads is that thread A uses device 0 and thread B uses device 1.


I know that I can use the same platform and simply create a new context and add the second device to that context. But that would lead to some major changes in my code. Therefore, I'm looking for the simpliest way.


What works is: Compile program with one thread and choose device 0. Execute program. Compile program with one thread and device 1. Execute program.

Now both programs run in their own processes and that works fine. But as soon as I try to utilize both devices in one process it fails.


As I said both threads have their own cl_platform objects (and of course all other objects belonging to the platform). Actually they don't share anything at all. I don't understand why there are problems.


PS: Sometimes I do get a message from the system:

pure virtual method called

terminate called without an active exception

Aborted (core dumped)