Difference between revisions of "Streams and Multi-GPU using CUVI"
From CUVI Wiki
(Created page with "==Using Streams with CUVI== CUVI framework provides a way to use streams with minimal coding effort. Each function call in CUVI takes an optional parameter to specify the stre...") |
|||
Line 1: | Line 1: | ||
==Using Streams with CUVI== | ==Using Streams with CUVI== | ||
CUVI framework provides a way to use streams with minimal coding effort. Each function call in CUVI takes an optional parameter to specify the stream on which it should run. The code below shows how a simple function call of CUVI can be divided into streaming calls on GPU. For most of the cases this will result in better performance as copying image data to GPU and processing that data on GPU happens simultaneously. | CUVI framework provides a way to use streams with minimal coding effort. Each function call in CUVI takes an optional parameter to specify the stream on which it should run. The code below shows how a simple function call of CUVI can be divided into streaming calls on GPU. For most of the cases this will result in better performance as copying image data to GPU and processing that data on GPU happens simultaneously. | ||
===CUVI example=== | |||
In this example we use CUVI's RGB2Gray function from Color Operations module on a full HD input image | |||
{| | |||
|style="font-size:130%;"| | |||
<syntaxhighlight lang="cpp"> | |||
//You may notice that all the functions below take an optional parameter for stream. If the users doesn't wish to use it the program will execute on a single stream by default | |||
//Creating a 3-channel Image container on GPU | |||
CuviImage* gimg = new CuviImage(size,img->depth,3); | |||
//Creating a sing channel Image container for output on GPU | |||
CuviImage* gout = new CuviImage(size,img->depth,1); | |||
//Uploading RGB image to GPU | |||
gimg->upload(img->imageData,img->widthStep); | |||
//function call | |||
cuvi::colorOperations::RGB2Gray(gimg,gout); | |||
</syntaxhighlight> | |||
|} | |||
===Same example with Streams=== |
Revision as of 13:49, 4 May 2012
Using Streams with CUVI
CUVI framework provides a way to use streams with minimal coding effort. Each function call in CUVI takes an optional parameter to specify the stream on which it should run. The code below shows how a simple function call of CUVI can be divided into streaming calls on GPU. For most of the cases this will result in better performance as copying image data to GPU and processing that data on GPU happens simultaneously.
CUVI example
In this example we use CUVI's RGB2Gray function from Color Operations module on a full HD input image
|