Hey all,
I am trying to see if I can use a pointer from cudaMalloc and use it in the OpenCL api. It seems kinda of a goofy thing to want to do, but I want to see if it works. I could only get a CUDA project running in Ubuntu by using Nvidia’s Cuda C SDK template project. I then added -lOpenCL to the libs of the common.mk which was fine. Then when I tried to add #include to template.cu, I get over a hundred errors. They all look similar to this, but with different function names at the end:
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/xmmintrin.h(334): error: identifier “__builtin_ia32_cmpeqps” is undefined
I am having a hard time figuring out why. Please help if you can. Also, if there is an easier way to set up a project that’ll be able to call the CUDA and OpenCL APIs let me know.
Hey all,
I am trying to see if I can use a pointer from cudaMalloc and use it in the OpenCL api. It seems kinda of a goofy thing to want to do, but I want to see if it works. I could only get a CUDA project running in Ubuntu by using Nvidia’s Cuda C SDK template project. I then added -lOpenCL to the libs of the common.mk which was fine. Then when I tried to add #include to template.cu, I get over a hundred errors. They all look similar to this, but with different function names at the end:
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include/xmmintrin.h(334): error: identifier “__builtin_ia32_cmpeqps” is undefined
I am having a hard time figuring out why. Please help if you can. Also, if there is an easier way to set up a project that’ll be able to call the CUDA and OpenCL APIs let me know.
Sorry, this isn’t possible. OpenCL doesn’t use pointers - it uses opaque handles for all its memory allocation, so there’s no way to pass pointers between the two APIs.
We’ve thought about ways to provide interoperability between CUDA and OpenCL (particularly for calling CUDA libraries like CUFFT from OpenCL), but don’t have anything available currently.
Sorry, this isn’t possible. OpenCL doesn’t use pointers - it uses opaque handles for all its memory allocation, so there’s no way to pass pointers between the two APIs.
We’ve thought about ways to provide interoperability between CUDA and OpenCL (particularly for calling CUDA libraries like CUFFT from OpenCL), but don’t have anything available currently.
hey all,
i’ve also tried to enable shared memory between opencl and cuda functions. what i’ve done is allocating gpu memory using cudaMalloc and then providing this pointer to clCreateBuffer function as host pointer.
in case when data is first copied from host memory to device memory using cudaMemcpy and the original cuda pointer, and then copying the data back to host memory using clEnqueueReadBuffer using the cl_mem object received from clCreateBuffer i was successfull in receiving the original data.
however if i first copy the data form host memory to device memory using clEnqueueWriteBuffer and then copy the data back using cudaMemcpy, then i get invalid data.
i’m now not sure what is the reason for this behaviour. is it just luck that it does function in first case or is it a valid approach of achieving shared memory for OpenCL and CUDA applications? does it have anything to do with the UVA support from CUDA?
i would be glad if anybody would help me…
greetings
max