diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-11-20 16:27:02 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2016-11-20 16:27:02 +0100 |
commit | 90eb8738c47a95ce0d141582bfba9d83ed8d6e50 (patch) | |
tree | bbb98551a17fe7275a92199b20f6f374d358ee3e /src | |
parent | 2f0697564fea11bd3f91e4474d766de54ca5ac1b (diff) |
Forced OpenCL 1.1 compilation and disabled a deprecation warning
Diffstat (limited to 'src')
-rw-r--r-- | src/clpp11.hpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp index d306bb87..0383f53a 100644 --- a/src/clpp11.hpp +++ b/src/clpp11.hpp @@ -45,6 +45,7 @@ #include <cstring> // std::strlen // OpenCL +#define CL_USE_DEPRECATED_OPENCL_1_2_APIS // to disable deprecation warnings #if defined(__APPLE__) || defined(__MACOSX) #include <OpenCL/opencl.h> #else @@ -388,6 +389,7 @@ class Program { // Compiles the device program and returns whether or not there where any warnings/errors void Build(const Device &device, std::vector<std::string> &options) { + options.push_back("-cl-std=CL1.1"); auto options_string = std::accumulate(options.begin(), options.end(), std::string{" "}); const cl_device_id dev = device(); CheckError(clBuildProgram(*program_, 1, &dev, options_string.c_str(), nullptr, nullptr)); @@ -441,23 +443,8 @@ class Queue { queue_(new cl_command_queue, [](cl_command_queue* s) { CheckErrorDtor(clReleaseCommandQueue(*s)); delete s; }) { auto status = CL_SUCCESS; - #ifdef CL_VERSION_2_0 - size_t ocl_version = device.VersionNumber(); - if (ocl_version >= 200) - { - cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - *queue_ = clCreateCommandQueueWithProperties(context(), device(), properties, &status); - CLError::Check(status, "clCreateCommandQueueWithProperties"); - } - else - { - *queue_ = clCreateCommandQueue(context(), device(), CL_QUEUE_PROFILING_ENABLE, &status); - CLError::Check(status, "clCreateCommandQueue"); - } - #else - *queue_ = clCreateCommandQueue(context(), device(), CL_QUEUE_PROFILING_ENABLE, &status); - CLError::Check(status, "clCreateCommandQueue"); - #endif + *queue_ = clCreateCommandQueue(context(), device(), CL_QUEUE_PROFILING_ENABLE, &status); + CLError::Check(status, "clCreateCommandQueue"); } // Synchronizes the queue |