cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

wgbljl
Journeyman III

Using two Devices in parallel with one CPU thread?

I am using two Firestream GPU in my system. The problem is how to use these two GPUs in parallel. The pseudo code is like this:

The single GPU version:
for (...)  {
    //the length of the output stream is L
    kernel(...);
}

The double GPU version:
for (...)  {
    //the length of the output stream is L/2
    useDevices(0); //use the first GPU
    kernel(...);

    //the length of the output stream is L/2
    useDevices(1); //use the second GPU
    kernel(...);
}

Because the task for each GPU in the second version reduced to half of the that in the first version. I thought the time with two GPUs should be almost half of the time with single GPU.  But the fact is that they are nearly the same. BTW, I'm using one CPU thread to control two GPUs.

0 Likes
2 Replies
gaurav_garg
Adept I

Take a look at section 2.16.3 of stream computing user guide to see how to use multiple GPUs in single thread. I would suggest to create seperate threads for multiple GPUs as leveraging kernel asynchronous call requires lots of tuning and the call might not be asyncronous in some cases. Take a look at Brook+ sample MonteCarlo_MultiGPU and tutorial MultiGPU.

0 Likes

Thank you, gaurav.

Through my test, I found that, in a multi-thread program, two kernels could execute in parallel on different GPUs.

But, I still don not know how to parallelize the two kernel execution in a thread. The single thread program is much the same as the example in section 2.16.3 of stream computing user guide.

In my programm, two kernel deal with two different streams on different GPUs.

My OS is SLES 10, and the SDK is v1.4-beta.

0 Likes