Merge pull request #2128 from alalek:ocl_cleanup_runtime

pull/2105/merge
Andrey Pavlenko 11 years ago committed by OpenCV Buildbot
commit a75cfe13e7
  1. 34
      modules/core/include/opencv2/core/opencl/runtime/ocl_runtime.hpp
  2. 4
      modules/core/src/opencl/runtime/generator/filter/opencl_clamdfft_functions.list
  3. 75
      modules/core/src/opencl/runtime/generator/template/ocl_clamdblas_runtime.cpp.in
  4. 25
      modules/core/src/opencl/runtime/generator/template/ocl_clamdblas_runtime.hpp.in
  5. 75
      modules/core/src/opencl/runtime/generator/template/ocl_clamdfft_runtime.cpp.in
  6. 25
      modules/core/src/opencl/runtime/generator/template/ocl_clamdfft_runtime.hpp.in
  7. 10
      modules/core/src/opencl/runtime/generator/template/ocl_runtime_impl_opencl.hpp.in
  8. 24
      modules/core/src/opencl/runtime/generator/template/ocl_runtime_opencl.hpp.in
  9. 6
      modules/core/src/opencl/runtime/generator/template/ocl_runtime_opencl_wrappers.hpp.in

@ -1,34 +0,0 @@
#ifndef __OPENCV_CORE_OCL_RUNTIME_HPP__
#define __OPENCV_CORE_OCL_RUNTIME_HPP__
#ifdef HAVE_OPENCL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#else // HAVE_OPENCL_STATIC
#include "ocl_runtime_opencl.hpp"
#endif // HAVE_OPENCL_STATIC
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
#endif
#ifndef CL_DEVICE_HALF_FP_CONFIG
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
#endif
#ifndef CL_VERSION_1_2
#define CV_REQUIRE_OPENCL_1_2_ERROR CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2")
#endif
#endif // HAVE_OPENCL
#endif // __OPENCV_CORE_OCL_RUNTIME_HPP__

@ -5,7 +5,7 @@ clAmdFftDestroyPlan
clAmdFftEnqueueTransform
//clAmdFftGetLayout
//clAmdFftGetPlanBatchSize
clAmdFftGetPlanContext
//clAmdFftGetPlanContext
//clAmdFftGetPlanDim
//clAmdFftGetPlanDistance
//clAmdFftGetPlanInStride
@ -22,7 +22,7 @@ clAmdFftSetPlanBatchSize
//clAmdFftSetPlanDim
clAmdFftSetPlanDistance
clAmdFftSetPlanInStride
clAmdFftSetPlanLength
//clAmdFftSetPlanLength
clAmdFftSetPlanOutStride
clAmdFftSetPlanPrecision
clAmdFftSetPlanScale

@ -1,75 +0,0 @@
#include "precomp.hpp"
#ifdef HAVE_CLAMDBLAS
#include "opencv2/ocl/cl_runtime/cl_runtime.hpp"
#include "opencv2/ocl/cl_runtime/clamdblas_runtime.hpp"
#if defined(_WIN32)
static void* WinGetProcAddress(const char* name)
{
static HMODULE opencl_module = NULL;
if (!opencl_module)
{
opencl_module = GetModuleHandleA("clAmdBlas.dll");
if (!opencl_module)
{
opencl_module = LoadLibraryA("clAmdBlas.dll");
if (!opencl_module)
return NULL;
}
}
return (void*)GetProcAddress(opencl_module, name);
}
#define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
#endif // _WIN32
#if defined(linux)
#include <dlfcn.h>
#include <stdio.h>
static void* GetProcAddress (const char* name)
{
static void* h = NULL;
if (!h)
{
h = dlopen("libclAmdBlas.so", RTLD_LAZY | RTLD_GLOBAL);
if (!h)
return NULL;
}
return dlsym(h, name);
}
#define CV_CL_GET_PROC_ADDRESS(name) GetProcAddress(name)
#endif
#ifndef CV_CL_GET_PROC_ADDRESS
#define CV_CL_GET_PROC_ADDRESS(name) NULL
#endif
@CL_FN_ENUMS@
@CL_FN_NAMES@
static void* openclamdblas_check_fn(int ID)
{
void* func = CV_CL_GET_PROC_ADDRESS(openclamdblas_fn_names[ID]);
if (!func)
{
std::ostringstream msg;
msg << "OpenCL AMD BLAS function is not available: [" << openclamdblas_fn_names[ID] << "]";
CV_Error(CV_StsBadFunc, msg.str());
}
extern void* openclamdblas_fn_ptrs[];
*(void**)(openclamdblas_fn_ptrs[ID]) = func;
return func;
}
namespace {
@CL_FN_SWITCH@
}
@CL_FN_DEFINITIONS@
@CL_FN_PTRS@
#endif

@ -1,25 +0,0 @@
#ifndef __OPENCV_OCL_CLAMDBLAS_RUNTIME_HPP__
#define __OPENCV_OCL_CLAMDBLAS_RUNTIME_HPP__
#ifdef HAVE_CLAMDBLAS
@CLAMDBLAS_REMAP_ORIGIN@
#include <clAmdBlas.h>
@CLAMDBLAS_REMAP_DYNAMIC@
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_OCL_SHARED)) && (defined WIN32 || defined _WIN32 || defined WINCE)
#define CL_RUNTIME_EXPORT __declspec(dllimport)
#else
#define CL_RUNTIME_EXPORT
#endif
#endif
@CLAMDBLAS_FN_DECLARATIONS@
#endif
#endif // __OPENCV_OCL_CLAMDBLAS_RUNTIME_HPP__

@ -1,75 +0,0 @@
#include "precomp.hpp"
#ifdef HAVE_CLAMDFFT
#include "opencv2/ocl/cl_runtime/cl_runtime.hpp"
#include "opencv2/ocl/cl_runtime/clamdfft_runtime.hpp"
#if defined(_WIN32)
static void* WinGetProcAddress(const char* name)
{
static HMODULE opencl_module = NULL;
if (!opencl_module)
{
opencl_module = GetModuleHandleA("clAmdFft.Runtime.dll");
if (!opencl_module)
{
opencl_module = LoadLibraryA("clAmdFft.Runtime.dll");
if (!opencl_module)
return NULL;
}
}
return (void*)GetProcAddress(opencl_module, name);
}
#define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
#endif // _WIN32
#if defined(linux)
#include <dlfcn.h>
#include <stdio.h>
static void* GetProcAddress (const char* name)
{
static void* h = NULL;
if (!h)
{
h = dlopen("libclAmdFft.Runtime.so", RTLD_LAZY | RTLD_GLOBAL);
if (!h)
return NULL;
}
return dlsym(h, name);
}
#define CV_CL_GET_PROC_ADDRESS(name) GetProcAddress(name)
#endif
#ifndef CV_CL_GET_PROC_ADDRESS
#define CV_CL_GET_PROC_ADDRESS(name) NULL
#endif
@CL_FN_ENUMS@
@CL_FN_NAMES@
static void* openclamdfft_check_fn(int ID)
{
void* func = CV_CL_GET_PROC_ADDRESS(openclamdfft_fn_names[ID]);
if (!func)
{
std::ostringstream msg;
msg << "OpenCL AMD FFT function is not available: [" << openclamdfft_fn_names[ID] << "]";
CV_Error(CV_StsBadFunc, msg.str());
}
extern void* openclamdfft_fn_ptrs[];
*(void**)(openclamdfft_fn_ptrs[ID]) = func;
return func;
}
namespace {
@CL_FN_SWITCH@
}
@CL_FN_DEFINITIONS@
@CL_FN_PTRS@
#endif

@ -1,25 +0,0 @@
#ifndef __OPENCV_OCL_CLAMDFFT_RUNTIME_HPP__
#define __OPENCV_OCL_CLAMDFFT_RUNTIME_HPP__
#ifdef HAVE_CLAMDFFT
@CLAMDFFT_REMAP_ORIGIN@
#include <clAmdFft.h>
@CLAMDFFT_REMAP_DYNAMIC@
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_OCL_SHARED)) && (defined WIN32 || defined _WIN32 || defined WINCE)
#define CL_RUNTIME_EXPORT __declspec(dllimport)
#else
#define CL_RUNTIME_EXPORT
#endif
#endif
@CLAMDFFT_FN_DECLARATIONS@
#endif
#endif // __OPENCV_OCL_CLAMDFFT_RUNTIME_HPP__

@ -1,10 +0,0 @@
@CL_FN_ENUMS@
@CL_FN_NAMES@
namespace {
@CL_FN_SWITCH@
}
@CL_FN_DEFINITIONS@
@CL_FN_PTRS@

@ -1,24 +0,0 @@
#ifndef __OPENCV_OCL_CL_RUNTIME_OPENCL_HPP__
#define __OPENCV_OCL_CL_RUNTIME_OPENCL_HPP__
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
@CL_REMAP_DYNAMIC@
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_OCL_SHARED)) && (defined WIN32 || defined _WIN32 || defined WINCE)
#define CL_RUNTIME_EXPORT __declspec(dllimport)
#else
#define CL_RUNTIME_EXPORT
#endif
#endif
@CL_FN_DECLARATIONS@
#endif // __OPENCV_OCL_CL_RUNTIME_OPENCL_HPP__

@ -1,6 +0,0 @@
#ifndef __OPENCV_OCL_CL_RUNTIME_OPENCL_WRAPPERS_HPP__
#define __OPENCV_OCL_CL_RUNTIME_OPENCL_WRAPPERS_HPP__
@CL_FN_INLINE_WRAPPERS@
#endif // __OPENCV_OCL_CL_RUNTIME_OPENCL_WRAPPERS_HPP__
Loading…
Cancel
Save