Comments (5)
I think something else is going on here. I tried this simple example and it worked fine for me:
cl_int errorCode = CL_SUCCESS; std::vector<int> my_vec(256); std::shared_ptr<cl::Buffer> buffer = std::make_shared<cl::Buffer>( context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, my_vec.size() * sizeof(my_vec[0]), my_vec.data(), &errorCode);Note that the overload at the line indicated above is:
template< typename IteratorType > Buffer::Buffer( const Context &context, IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr, cl_int* err)That doesn't look like the overload that you want. Can you check if there is something happening to cause this overload to be chosen instead?
I checked my expression. i found it's my fault about data type clarify, it works after i changed to this:
std::shared_ptr<cl::Buffer> buffer0 = std::make_shared<cl::Buffer>(*(clContext->GetCLContext()),
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
(cl::size_type)storage->bufferSize_,
const_cast<void *>(src),
&status);
storage->bufferSize_ is "int" so it causes function overload. Thank you so much for your help!
from opencl-headers.
Hello, yes, we switched to a single opencl.hpp
approximately a year ago:
The new opencl.hpp
is an improved version of cl.hpp
. It supports all versions of OpenCL so it should work just fine for your OpenCL 1.2 implementation. Give it a try and please don't hesitate to let us know if you find any issues. Thanks!
from opencl-headers.
Hello, yes, we switched to a single
opencl.hpp
approximately a year ago:The new
opencl.hpp
is an improved version ofcl.hpp
. It supports all versions of OpenCL so it should work just fine for your OpenCL 1.2 implementation. Give it a try and please don't hesitate to let us know if you find any issues. Thanks!
Thanks so much for your reply, and i appreciate all you guys' contribution in OpenCL.
from opencl-headers.
@bashbaug I got one more question. when i use shared_ptr< cl::Buffer > for alloc like these, they will be wrong:
std::shared_ptr<cl::Buffer> buffer = std::shared_ptr<cl::Buffer>(new cl::Buffer(
*(clContext->GetCLContext()), CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, storage->bufferSize_, src, &status));
std::shared_ptr<cl::Buffer> buffer0 = std::make_shared<cl::Buffer>(
*(clContext->GetCLContext()), CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, storage->bufferSize_, src, &status);
and they come the same error when compile:
CL/opencl.hpp:9131:58: error: no type named 'value_type' in 'std::__1::iterator_traits<int>'
typedef typename std::iterator_traits<IteratorType>::value_type DataType;
HOWEVER, when i createImage2d by using shared_ptr style. It will work. Why cl::Buffer wrong? holp you can help me, thanks!
from opencl-headers.
I think something else is going on here. I tried this simple example and it worked fine for me:
cl_int errorCode = CL_SUCCESS;
std::vector<int> my_vec(256);
std::shared_ptr<cl::Buffer> buffer = std::make_shared<cl::Buffer>(
context,
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
my_vec.size() * sizeof(my_vec[0]),
my_vec.data(),
&errorCode);
Note that the overload at the line indicated above is:
template< typename IteratorType >
Buffer::Buffer(
const Context &context,
IteratorType startIterator,
IteratorType endIterator,
bool readOnly,
bool useHostPtr,
cl_int* err)
That doesn't look like the overload that you want. Can you check if there is something happening to cause this overload to be chosen instead?
from opencl-headers.
Related Issues (20)
- how can i generate libOpenCL.so HOT 2
- WiFi cracker HOT 1
- should the headers include an extension version?
- #include <libclew/ocl_init.h> HOT 1
- Why cannot find <CL\opencl.h> when using Android NDK Building? HOT 1
- Generate tests that use all definitions provided by the headers HOT 1
- missing POCL vendor ID
- Added this repo as a submodule HOT 2
- Increment CMake Version Number HOT 1
- re-enable testing in test_half
- How to install OpenCL SDK for FreeBSD?
- Build warning/note
- install *.pc below CMAKE_INSTALL_DATADIR HOT 3
- clEnqueueWriteHostPipeINTEL XML discrepancy HOT 3
- XML and header discrepancy for clSetMemObjectDestructorAPPLE HOT 1
- Random value when use pragma unroll
- Guard definitions for provisional extensions with a dedicated opt-in macro
- Provide version macros for individual extensions HOT 7
- update copyright dates to 2024
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencl-headers.