Commit 650609aa authored by Andrey Kamaev's avatar Andrey Kamaev Committed by OpenCV Buildbot

Merge pull request #429 from bitwangyaoyao:2.4_setdevEx

parents 6dc3b662 a639a1ae
......@@ -84,20 +84,26 @@ namespace cv
//this function may be obsoleted
//CV_EXPORTS cl_device_id getDevice();
//the function must be called before any other cv::ocl::functions, it initialize ocl runtime
//each Info relates to an OpenCL platform
//there is one or more devices in each platform, each one has a separate name
CV_EXPORTS int getDevice(std::vector<Info> &oclinfo, int devicetype = CVCL_DEVICE_TYPE_GPU);
//set device you want to use, optional function after getDevice be called
//the devnum is the index of the selected device in DeviceName vector of INfo
CV_EXPORTS void setDevice(Info &oclinfo, int devnum = 0);
//this function is not ready yet
//CV_EXPORTS void getComputeCapability(cl_device_id device, int &major, int &minor);
//optional function, if you want save opencl binary kernel to the file, set its path
CV_EXPORTS void setBinpath(const char *path);
//The two functions below are used to get opencl runtime so that opencv can interactive with
//other opencl program
//The two functions below enable other opencl program to use ocl module's cl_context and cl_command_queue
CV_EXPORTS void* getoclContext();
CV_EXPORTS void* getoclCommandQueue();
//this function enable ocl module to use customized cl_context and cl_command_queue
//getDevice also need to be called before this function
CV_EXPORTS void setDeviceEx(Info &oclinfo, void *ctx, void *qu, int devnum = 0);
//////////////////////////////// Error handling ////////////////////////
CV_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func);
......
This diff is collapsed.
......@@ -12,10 +12,12 @@
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
// Guoping Long, longguoping@gmail.com
// Yao Wang, bitwangyaoyao@gmail.com
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
......@@ -131,15 +133,15 @@ namespace cv
//Information of the OpenCL context
cl_context clContext;
cl_command_queue clCmdQueue;
cl_device_id *devices;
cl_device_id devices;
string devName;
cl_uint maxDimensions;
size_t maxWorkGroupSize;
size_t *maxWorkItemSizes;
size_t maxWorkItemSizes[4];
cl_uint maxComputeUnits;
int double_support;
//extra options to recognize vendor specific fp64 extensions
char *extra_options;
char extra_options[512];
string Binpath;
};
}
......
......@@ -742,7 +742,7 @@ static void lkSparse_run(oclMat &I, oclMat &J,
Context *clCxt = I.clCxt;
char platform[256] = {0};
cl_platform_id pid;
clGetDeviceInfo(*clCxt->impl->devices, CL_DEVICE_PLATFORM, sizeof(pid), &pid, NULL);
clGetDeviceInfo(clCxt->impl->devices, CL_DEVICE_PLATFORM, sizeof(pid), &pid, NULL);
clGetPlatformInfo(pid, CL_PLATFORM_NAME, 256, platform, NULL);
std::string namestr = platform;
bool isImageSupported = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment