|
@@ -50,7 +50,10 @@ kernel_gpu_opencl_wrapper( params_common common,
|
|
|
int* epiCol,
|
|
|
int* tEpiRowLoc,
|
|
|
int* tEpiColLoc,
|
|
|
- avi_t* frames)
|
|
|
+ avi_t* frames,
|
|
|
+ int platform_id,
|
|
|
+ int device_id,
|
|
|
+ int use_gpu)
|
|
|
{
|
|
|
|
|
|
//======================================================================================================================================================150
|
|
@@ -111,10 +114,9 @@ kernel_gpu_opencl_wrapper( params_common common,
|
|
|
|
|
|
}
|
|
|
|
|
|
- // Select platform
|
|
|
- int plat = 1;
|
|
|
- platform = platforms[plat];
|
|
|
- printf("Selecting platform %d\n", plat);
|
|
|
+ // Select platform on the basis of the passed as function argument
|
|
|
+ platform = platforms[platform_id];
|
|
|
+ printf("Selecting platform %d\n", platform_id);
|
|
|
|
|
|
//====================================================================================================100
|
|
|
// CREATE CONTEXT FOR THE PLATFORM
|
|
@@ -124,11 +126,14 @@ kernel_gpu_opencl_wrapper( params_common common,
|
|
|
cl_context_properties context_properties[3] = { CL_CONTEXT_PLATFORM,
|
|
|
(cl_context_properties) platform,
|
|
|
0};
|
|
|
-
|
|
|
- // Create context for selected platform being GPU
|
|
|
+
|
|
|
+ // Create the device_type selector in the basis of the argument passed (use_gpu)
|
|
|
+ cl_device_type device_type = use_gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU;
|
|
|
+
|
|
|
+ // Create context for selected platform being GPU or CPU
|
|
|
cl_context context;
|
|
|
context = clCreateContextFromType( context_properties,
|
|
|
- CL_DEVICE_TYPE_CPU,
|
|
|
+ device_type,
|
|
|
NULL,
|
|
|
NULL,
|
|
|
&error);
|
|
@@ -180,10 +185,9 @@ kernel_gpu_opencl_wrapper( params_common common,
|
|
|
|
|
|
}
|
|
|
|
|
|
- // Select device (previousely selected for the context) (if there are multiple devices, choose the first one)
|
|
|
- int devi = 0;
|
|
|
- device = devices[devi];
|
|
|
- printf("Selecting device %d\n", devi);
|
|
|
+ // Select device on the basis of the argument passed as function argument
|
|
|
+ device = devices[device_id];
|
|
|
+ printf("Selecting device %d\n", device_id);
|
|
|
|
|
|
//====================================================================================================100
|
|
|
// CREATE COMMAND QUEUE FOR THE DEVICE
|